That post is about establishing the creation of properties and perform an action by the heirs of FBComponent. It is often necessary when registering variables for use in the tables of properties (BrowsingProperty visual component) and to interact with the interface of the MotionBuilder.

1) The enumeration property FBPropertyEnum

It’s about FBPropertyEnum

For this purpose we introduce the following variables

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
enum kMyEnum (

kDefaultItemClassic,

kDefaultItemRANSAC

)

const char * FBPropertyBaseEnum :: mStrings [] = ("Classic", "RANSAC");

static kMyEnum GetEnumValue (HIObject* pObject)

(

SampleComponent *pComponent = FBCast<SampleComponent> (pObject);

/ / Return pComponent->mWindDirection;

return kDefaultItemClassic;

)

static void SetEnumValue (HIObject* pObject, kMyEnum pValue)

(

SampleComponent *pComponent = FBCast<SampleComponent> (pObject);

/ / pComponent->mWindDirection = pValue;

)

The above functions are necessary to specify values and the transfer of a handler for input / output values.

Next, we introduce a new property – FBPropertyBaseEnum mEnum;

Now you can create it as a domestic and add to the list of properties. This is all done inside your class, the heir of FBComponent:

1
2
3
mEnum.CreateInternal (this, "Algorithm", (fbExternalGetSetHandler) GetEnumValue, (fbExternalGetSetHandler) SetEnumValue);

PropertyAdd ( &mEnum);

2) action property FBPropertyAction

It should define the functions of processing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
static bool GetActionValue (HIObject* pObject)

(

SampleComponent *pComponent = FBCast<SampleComponent> (pObject);

/ / Return pComponent->mWindDirection;

return true;

)

static void SetActionValue (HIObject* pObject, bool pValue)

(

SampleComponent *pComponent = FBCast<SampleComponent> (pObject);

pValue = true;

/ / pComponent->mWindDirection = pValue;

)

SetActionValue will be called when you press the button twice, true and false in the parameter pValue

The event runs from Boolean data type.

Now the creation of the properties

1
2
3
4
5
6
7
FBPropertyAction mAction;

...

mAction.CreateInternal (this, "Action", (fbExternalGetSetHandler) GetActionValue, (fbExternalGetSetHandler) SetActionValue);

PropertyAdd ( &mAction);
OR SDK – about FBPropertyEnum & FBPropertyAction
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *