PDA

View Full Version : how to get selected nodes before deletion?


nathan7
01-15-2008, 01:40 PM
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;
}

}

CGTalk Moderation
01-15-2008, 01:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.