On 23/08/2013 at 08:34, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I don't think I understand what TransferGoal() is supposed to be used for. Because when I use the TransferGoal() function. Nothing happens.
To be more accurate. Something does happen. But only in memory.
Nothing in the scene changes. And my link fields don't changed.
Code example trying to transfer the BaseLink object from one camera to another using TransferGoal() :
BaseObject *cam1 = doc->SearchObject("cam1"); //A camera with a cube object in it's Focus Object link field
if(!cam1) return FALSE;
BaseContainer *bc = cam1->GetDataInstance();
BaseObject *linkedOp = (BaseObject* )bc->GetLink(CAMERAOBJECT_TARGETOBJECT, doc, Obase); //Grab the cube object in the link field
BaseObject *cam2 = doc->SearchObject("cam2"); //A camera with nothing in it's Focus Object link field
if(!cam2) return FALSE;
cam1->TransferGoal(cam2, FALSE); //Transfer the Focus Object linked object from cam1 to cam2....Nothing happens?
cam2->Message(MSG_UPDATE);
cam1->Remove(); //Delete camera1
EventAdd();
From the docs:
"Transfer goals from this object to dst. This changes all BaseLink links that point to this object to point to dst instead"
I'm reading that sentence as: "Use this function to move your linked objects from one object's link field to another object's link field." But it's not working as expected for me.
Could it be that the docs are referring to classes as the "objects". Rather than actual objects in the scene?
I couldn't find any examples of this code in use anywhere.
-ScottA