Prevent GvNode from being deleted

On 12/11/2016 at 19:19, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   18 
Platform:    Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;

---------
Is there any way to prevent a GvNode from being deleted in the UI (i.e.: the user right clicks on the node and chooses Delete).

One of these nodes in our graph is what we consider the "root" node, so this shouldn't be deleted. I tried calling BaseDocument::DoUndo whenever we receive a GV_MESSAGE_NODE_REMOVED message, but I'm getting a crash somewhere in c4d_gui.cpp:

frame #8: 0x000000012b9914ca RenderMan_for_C4D.dylib`CDialogCallBack(cd=0x000000012cb5b2c0, cu=0x0000000105664340, msg=0x00007fff5fbfe810) + 138 at c4d_gui.cpp:74
   71  			GeUserArea* usr = (GeUserArea* )C4DOS.Cu->GetUserData(cu);
   72  			if (!usr)
   73  				return false;
-> 74  			res = usr->Message(*msg, result);
   75  		}
   76  		else
   77  		{

Thanks,
Ian

On 14/11/2016 at 02:32, xxxxxxxx wrote:

Hello,

as far as I can see there is no way to prevent that a certain XPRESSO node can be deleted.

I guess you are catching the GV_MESSAGE_NODE_REMOVED in an XPRESSO node? You cannot call DoUndo() there because when the message is sent the node is not yet deleted and the undo-step not yet created.

The only node that cannot be removed is the root node of a given GvNodeMaster. So if you want to define some "root" ports you can add some in-ports to the root node.

best wishes,
Sebastian