Deleting a node without crashing

Deleting a node without crashing

Anonymous
Not applicable
1,117 Views
3 Replies
Message 1 of 4

Deleting a node without crashing

Anonymous
Not applicable

I am writing an import plugin, and we import our proprietary format for the whole scene, and then import a different proprietary format for debug visualization (e.g. the visibility level of each triangle). This all works fine.

 

We are now trying to export this combined scene as an FBX, but with all the hidden geometry being deleted. So, as we load the visualization, we examine each node as to whether it is hidden or not, and try to delete it (or colorize, or hide, depending). The issue is all attempts to delete nodes result in a crash.

 

I've tried DeleteMe(), Delete(), Detach() then delete to no avail. Everything I've found on the web implies DeleteMe() is the call to use as this handles detaching, deleting, and undo. This happens on the first item from the root node.

 

The crash is: File: s:\3ds_max_2016_di\src\3dswin\src\core\ref.cpp
Line: 1069
Function: ReferenceTarget::DeleteAllRefsToMe
Expression: currentRefMaker == NULL || numOrigRefs != currentRefMaker->NumRefs() || currentRefMaker->GetReference(which) == NULL

 

Cheers

John

0 Likes
Accepted solutions (1)
1,118 Views
3 Replies
Replies (3)
Message 2 of 4

istan
Advisor
Advisor
Accepted solution

I would assume that these nodes were not created properly by your plugin or you keep INode pointers not being valid.

Simple node deletion is easy - of course only when the nodes you created are working properly:

ip->DeleteNode(INode*)

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks! The problem was I was trying node->Delete() rather than interface->DeleteNode(Node)

 

Cheers

John

 

0 Likes
Message 4 of 4

denisT.MaxDoctor
Advisor
Advisor

as already said above a node deletion should be just simple as GetCOREInterface()->DeleteNode(node)

 

but if might be a badly organized connection of this node with another(s) (for example script controller that doesn't check validity of target nodes).   

0 Likes