On 26/07/2017 at 06:09, xxxxxxxx wrote:
The document returned is not valid(don't know why but it's seem to be the issue), or at least it is valid only when you explicitly use SetParameter.
Then instead use ForceGetLink
case MSG_DESCRIPTION_POSTSETPARAMETER:
{
if (!node)
return true;
// get the changed id
DescriptionPostSetValue* dpsv = static_cast<DescriptionPostSetValue*>(data);
//2015 is the id of my shaderlink
if ((*(dpsv->descid))[0].id == 2015)
{
GeData parameter;
if (node->GetParameter(DescLevel(2015), parameter, DESCFLAGS_GET_0)) {
BaseLink* link = parameter.GetBaseLink();
if (link)
{
BaseList2D* linkedShader = link->ForceGetLink();
if (linkedShader)
GePrint(linkedShader->GetName());
}
}
}
break;
}
Note that you can also use SetDParameter wich I guess it's more cleaner (https://plugincafe.maxon.net/topic/9852/13266_setdparameter-or-message-postsetparameter)
Bool TestObj::SetDParameter(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
{
if (!node)
return false;
// 2015 is my shaderlink id
if (id[0].id == 2015)
{
BaseDocument* doc = node->GetDocument();
if (!doc) return SUPER::SetDParameter(node, id, t_data, flags);
BaseLink* link = t_data.GetBaseLink();
if (!link) return SUPER::SetDParameter(node, id, t_data, flags);
BaseList2D* linkedShader = link->ForceGetLink();
if (linkedShader)
GePrint(linkedShader->GetName());
}
return SUPER::SetDParameter(node, id, t_data, flags);
}