A mapped item specifies the value driven by a specific clip instance (for example, an object's parameter or its geometry).
You can get the MappedItem from Clip::GetMappedItems.
In order to know exactly which type of AnimationSourceItem you are dealing with you can use SIObject::GetType which returns a value contained in the XSI::siAnimationSourceItemType enum.
using namespace XSI; Application app; Model root = app.GetActiveSceneRoot(); X3DObject myCube; root.AddGeometry( L"Cube", L"MeshSurface", L"", myCube ); // Create the first animation source CValueArray args(9); CValue outArg; args[0] = root; args[1] = L"cube.kine.local.posx,cube.kine.local.posy,cube.kine.local.posz"; args[3] = L"StoredStaticPose"; args[4] = true; args[7] = false; args[8] = false; app.ExecuteCommand( L"StoreAction", args, outArg ); Source mySource(outArg); // Create the first clip CValueArray addClipArgs(6); addClipArgs[0] = root; addClipArgs[1] = mySource.GetFullName(); addClipArgs[5] = L"MyClip1"; app.ExecuteCommand( L"AddClip", addClipArgs, outArg ); Clip myClip(outArg); CRefArray mappedItems = myClip.GetMappedItems(); // Find the mapped item on which we want to add an effect. // We are looking for the local.posy parameter LONG i; MappedItem currItem; for(i = 0; i < mappedItems.GetCount(); ++i) { currItem = mappedItems[i]; Parameter param = currItem.GetDestination(); if(param.GetFullName().IsEqualNoCase(L"cube.kine.local.posy")) { CValueArray mappingRuleArgs(4); mappingRuleArgs[0] = myClip.GetFullName() + L".ActionClip"; mappingRuleArgs[1] = param; mappingRuleArgs[2] = L"frame"; mappingRuleArgs[3] = (LONG)(i + 1); app.ExecuteCommand(L"SetMappingRule", mappingRuleArgs, outArg); break; } } ClipEffectItem effectItem(currItem.GetClipEffectItem()); app.LogMessage(L"The expression associated with the posy item is >> " + effectItem.GetExpression());
#include <xsi_mappeditem.h>
Public Member Functions | |
MappedItem () | |
~MappedItem () | |
MappedItem (const CRef &in_ref) | |
MappedItem (const MappedItem &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
MappedItem & | operator= (const MappedItem &in_obj) |
MappedItem & | operator= (const CRef &in_ref) |
CRef | GetAnimationSource () const |
CRef | GetDestination () const |
ClipEffectItem | GetClipEffectItem () const |
MappedItem | ( | ) |
Default constructor.
~MappedItem | ( | ) |
Default destructor.
MappedItem | ( | const CRef & | in_ref | ) |
Constructor.
in_ref | constant reference object. |
MappedItem | ( | const MappedItem & | in_obj | ) |
Copy constructor.
in_obj | constant class object. |
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from SIObject.
siClassID GetClassID | ( | ) | const [virtual] |
MappedItem& operator= | ( | const MappedItem & | in_obj | ) |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
MappedItem& operator= | ( | const CRef & | in_ref | ) |
Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.
in_ref | constant class object. |
Reimplemented from SIObject.
CRef GetAnimationSource | ( | ) | const |
Returns the object which is driving the action or shape animation. This function is not available for compound clips. You can test to see whether the clip is a compound clip by testing if SIObject::GetClassID() == siClipContainerID on the Clip object.
CRef GetDestination | ( | ) | const |
ClipEffectItem GetClipEffectItem | ( | ) | const |
For all items driven by a clip there could be an associated clip effect which would affect the value after the evaluation of the animation source. This function returns the specific item in the ClipEffect which is associated to this mapped item.