I recently recompiled my python deformer plugin using C ++, but encountered some trouble.
In function "Message()",I can access the parameters“SSURFACEDEFORMERC_DRIVER” and successfully get the name using GetName ()。
but in function "ModifyObject()", access same parameters“SSURFACEDEFORMERC_DRIVER” failed,return "nullptr".
Thanks for any help!
this is part of code:
Bool SsurfaceDeformerc::Message(GeListNode* node, Int32 type, void* data)
{
if (type == MSG_DESCRIPTION_COMMAND)
{
DescriptionCommand* dc = static_cast<DescriptionCommand*>(data);
BaseContainer* node_self = (static_cast<BaseObject*>(node))->GetDataInstance();
BaseDocument* doc = node->GetDocument();
if (dc == nullptr || node_self == nullptr)
return true;
if (dc->_descId[0].id == SSURFACEDEFORMERC_INITIALIZE)
{
//successfully access
BaseObject* obj = static_cast<BaseObject*>(node_self->GetLink(SSURFACEDEFORMERC_DRIVER,doc,Obase));
ApplicationOutput(obj->GetName());
}
return true;
}
//
//
Bool SsurfaceDeformerc::ModifyObject(BaseObject* op, BaseDocument* doc, BaseObject* mod, const Matrix& op_mg, const Matrix& mod_mg, Float lod, Int32 flags, BaseThread* thread)
{
if (!mod || !op || !doc || !thread)
return false;
BaseContainer* data = mod->GetDataInstance();
//failed access
BaseObject* obj = static_cast<BaseObject*>(data->GetLink(SSURFACEDEFORMERC_DRIVER, doc, Obase));
if (!obj)
{
ApplicationOutput("No obj!"_s);
return true;
}
return true
}