|
Dear all,
I create my Custom Property, which is going to be a member of a Scene Layer. It adds needed features to my game scene layers.
• Inside Custom Property _Define() Callback, how to get the Name and Type of the Parent Object (Scene Layer in this case) containing my Custom Property, please?
I really tried many things, like calling GetParent(), GetOwners(), but it looks, like at the execution point of _Define() callback, it is not possible to know the parent of the Custom Property? I keep studying Softimage C++ SDK, but I can not find the way.
For illustration (not needed to study), below is the _Define() Callback containing some unnecessary function calls, as I tried to solve the problem:
XSIPLUGINCALLBACK CStatus LayerProperties_Define( CRef& in_ctxt ) {
Context ctxt( in_ctxt );
CustomProperty oCustomProperty;
oCustomProperty = ctxt.GetSource();
// root custom property for general values
Application app;
Property myRootProperty;
app.GetActiveSceneRoot().GetPropertyFromName( L"GameTools_Settings", myRootProperty );
SceneItem mySceneItem = oCustomProperty.GetParent();
// testing
// check if the CustomProperty parent object is Layer
if ( mySceneItem.IsA(siLayerID) )
{
// SceneItem is a layer
int nTest = 1;
}
CString mySceneItemUniqueName = mySceneItem.GetName();
CString mySceneItemFullName = mySceneItem.GetFullName();
CString mymySceneItemName = mySceneItem.GetName();
CRefArray myProjectItemArray = oCustomProperty.GetOwners();
ProjectItem myProjectItem = myProjectItemArray[0];
CString myProjectItemName = myProjectItemArray[0].GetAsText();
SIObject mySIObject = ctxt.GetSource();
CString mySIObjectUniqueName = mySIObject.GetUniqueName();
CString mySIObjectFullName = mySIObject.GetFullName();
CString MYSIObjectName = mySIObject.GetName();
SIObject myParentSIObject = mySIObject.GetParent();
// store the Parent layer
Layer myLayer = oCustomProperty.GetParent();
// Store Layer name
CString strngLayerName = myLayer.GetName();
// EOF testing
// get UniqueID and increment the value stored in GameTools_Settings
LONG lLastLayerID = myRootProperty.GetParameterValue( L"LastLayerID" );
lLastLayerID++;
myRootProperty.PutParameterValue( L"LastLayerID", (LONG)lLastLayerID );
// Default capabilities for most of these parameters
int caps = siPersistable | siAnimatable ;
CValue dft ; // Used for arguments we don't want to set
// properties
Parameter oParam;
oCustomProperty.AddParameter( L"LayerName",CValue::siString, caps, L"Name", L"", mySIObjectUniqueName, oParam );
oCustomProperty.AddParameter( L"UniqueLayerID", CValue::siInt2, caps, L"Layer ID", L"", (LONG)lLastLayerID, (LONG)0, (LONG)20000, (LONG)0, (LONG)20000, oParam );
return CStatus::OK; }
I use Softimage 2012 64bit under Windows 7. I develop in C++.
|