-
FbxObject – Storing and retrieving a data
Posted on 20 August 2009 Neill No commentsWriting and reading in fbx format has its own characteristics, I would like to briefly talk about it.
Writing and reading is carried out by overriding functions FbxStore, FbxRetrieve. In doing so, these functions are called MoBu several times:
1) for the processing of attributes – pStoreWhat & kAttributes
2) the relationship between plugs – pStoreWhat & kRelations
3) the pass of clean-up (only when reading) – pStoreWhat & kCleanup
4) the pass of special data – pStoreWhat & kData
5) pass of combining scenes – pStoreWhat & kMergeUsers often store data writing \ reading into the pass of processing attributes.
Writing \ Reading
When viewed from the types of variables, it supports 4 types of
integer – FieldWriteI / FieldReadI
real – FieldWriteD / FieldReadD
char array – FieldWriteC / FieldReadC
reference to an object – FieldWriteObjectReference / FieldReadObjectReferenceEach feature in the record as the parameter takes the value to write, while reading back the value read. You can use the parameter field name. But as times and is characteristic of the field.
The document is arranged as follows:
The use of the name (title) you want to set the end of the field. This can be done using the pFbxObject-> FieldWriteEnd ()Here’s an example:
write a range of frames. Open the name field with the title – “TimeSpan”, which put the value of the first and the last frames.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15bool ORTool_Template::FbxStore ( HFBFbxObject pFbxObject, kFbxObjectStore pStoreWhat )
{
if (pStoreWhat & kAttributes)
{
// store optical model time span
pFbxObject->FieldWriteBegin( "TimeSpan" );
{
pFbxObject->FieldWriteI( 0 );
pFbxObject->FieldWriteI( 100 );
}
pFbxObject->FieldWriteEnd();
}
return true;
}Now, reading the scene, search for a named field and values within it.
MotionBuilder, Programming C++, OpenReality, Tutorials1
2
3
4
5
6
7
8
9
10
11
12
13
14
15bool ORTool_Template::FbxRetrieve( HFBFbxObject pFbxObject, kFbxObjectStore pStoreWhat )
{
if (pStoreWhat & kAttributes)
{
if (pFbxObject->FieldReadBegin( "Optical_TimeSpan" ) )
{
int startFrame, stopFrame;
startFrame = pFbxObject->FieldReadI();
stopFrame = pFbxObject->FieldReadI();
pFbxObject->FieldReadEnd();
}
}
return true;
}Leave a Reply
You must be logged in to post a comment.

English
Russian
Recent Comments