[Closed] how to get selected nodes before deletion?
how to get selected nodes before deletion?
i need to get a list of selected nodes before i delete objects from the scene, so i use RegisterNotification with NOTIFY_SEL_NODES_PRE_DELETE message, but if i select 5 subjects in the scene, and hit ‘delete’, this will lead me into the callback function, but the returned resut from the following function is empty!
anyway to solve this?
Tab<INode *>selNodeTab;
static void DoNotifySelNodesPreDelete(void *param, NotifyInfo *info)
{
GetSelectedNodes(selNodeTab); // selNodeTab is empty
}
but in this, callback func of NOTIFY_SELECTION_SET_CHANGED, it works
static void DoNotifySelectionSetChanged(void *param, NotifyInfo *info)
{
GetSelectedNodes(selNodeTab); // selNodeTab has 5 INode *
}
static void GetSelectedNodes(Tab<INode *> &nodeTab)
{
nodeTab.SetCount(GetCOREInterface()->GetSelNodeCount());
for(int i=0;i<GetCOREInterface()->GetSelNodeCount();++i)
{
INode *node = GetCOREInterface()->GetSelNode(i);
nodeTab[i] = node;
}
}