I am looking for the way to pass a "struct" from Tool Class to the
CustomOperator_Update() callback.
I saw two approaches to this in SDK. First one should work via UserData
attached to ctxt. You store in this
data C++ pointer to allocated memory with your struct. Second one is to
create Property and store this pointer in
property. I prefer do not create additional Property, so i tried to add
UserData to ctxt.
But i don't quite sure that i make it right.
I tried this piece of code ...
struct myStruct{
XSI::CLongArray polyData;
XSI::CValueArray edgeSegmentsArray;
}
SICALLBACK myCmd_Execute( CRef& in_ctxt ){
PlugData pData;
PlugData * pDataPtr;
pDataPtr = &pData;
ctxt.PutUserData(XSI::CValue(pDataPtr));
}
SICALLBACK myOperator_Update( CRef& in_ctxt ){
OperatorContext ctxt( in_ctxt );
CValue userData(ctxt.GetUserData());
update_func(ctxt);
return CStatus::OK;
}
... but in Update callback i didn't get pointer back.
If someone has already faced a similar problem maybe you can share some
advices.
Or maybe there is a way to pass struct without UserData or Custom Property.