Get BaseObject from ObjectData

On 10/02/2016 at 04:57, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R17 
Platform:      
Language(s) :     C++  ;

---------
Here is the newbie again, I've managed to create my object derived from ObjectData but what if I want to move it from inside itself?

Moving it seems to be trivial using BaseObject* functions but I cannot find the way to get it.

Regards and thank you in advance again!

On 10/02/2016 at 05:38, xxxxxxxx wrote:

From inside your ObjectData-derived class, you can use either the GeListNode* node passed to the method in the class:

//*---------------------------------------------------------------------------*
Bool MyObjectData::Message(GeListNode* node, Int32 type, void* data)
//*---------------------------------------------------------------------------*
{
	if (!node)
		return FALSE;
  
	BaseObject*	pObject =	static_cast<BaseObject*>(node);
  
	// etc.
  
	return SUPER::Message(node,type,data);
}

Or you can use the NodeData::Get() method:

//*---------------------------------------------------------------------------*
Bool MyObjectData::MyMethod()
//*---------------------------------------------------------------------------*
{
	GeListNode*	node =	Get();
	if (!node)
		return FALSE;
  
	BaseObject*	pObject =	static_cast<BaseObject*>(node);
  
	// etc.
  
	return TRUE;
}

On 10/02/2016 at 10:02, xxxxxxxx wrote:

Thank you second method is perfect for me