Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / C++ API: Name of Parent Object within Custom Property _Define() Callback.
  RSS 2.0 ATOM  

C++ API: Name of Parent Object within Custom Property _Define() Callback.
Rate this thread
 
55256
 
Permlink of this thread  
avatar
  • Total Posts: 101
  • Joined: 31 August 2010 07:17 AM

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_DefineCRefin_ctxt )
{
 Context ctxt
in_ctxt );
 
 
CustomProperty oCustomProperty;
 
oCustomProperty ctxt.GetSource();

 
// root custom property for general values
 
Application app;
 
Property myRootProperty;
 
app.GetActiveSceneRoot().GetPropertyFromNameL"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.GetParameterValueL"LastLayerID" );
 
lLastLayerID++;
 
myRootProperty.PutParameterValueL"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.AddParameterL"LayerName",CValue::siStringcapsL"Name"L""mySIObjectUniqueNameoParam ); 
 
oCustomProperty.AddParameterL"UniqueLayerID"CValue::siInt2capsL"Layer ID"L"", (LONG)lLastLayerID, (LONG)0, (LONG)20000, (LONG)0, (LONG)20000oParam );

 return 
CStatus::OK;
}

I use Softimage 2012 64bit under Windows 7. I develop in C++.



Replies: 0
avatar

You won’t be able to get the parent in the Define callback. It’s too early in the creation of the custom property. You can get that info in the OnInit callback.



Replies: 0
avatar

Thanks Stephen,

I thought, Define() callback is the right place to add parameters into Custom Property. Nevermind, I will try to add this parameter in another place, maybe in the OnInit() callback.

Thanks.



Replies: 0