CMotion questions

On 27/07/2013 at 12:34, xxxxxxxx wrote:

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

---------
Hi,
I have a few questions about CMotion

Q1:
If CMotion is an object plugin. Why do the headers start with the letter "t"?
And why does the tcawcycle.res file contain all sorts of TAG references in it as if it's a tag plugin?

~~ Q2:~~
How do we execute the the ADD button for the actions option in C++?

Q3:
How do we access the CMotion tree gui?
How do we add objects to it?
How do we select objects in it?

My Code:

  
#include "..\..\..\modules\ca\res\description	cawcycle.h"  
  
  
  BaseObject *cm = doc->SearchObject("CMotion");  
  if(!cm) return FALSE;  
  BaseObject *cube = doc->SearchObject("Cube");  
  if(!cube) return FALSE;  
  
  GeData d;  
  cm->GetParameter(DescID(ID_CA_WCYCLE_TAG_ACTIONS), d, DESCFLAGS_GET_0);         //Gets the current actions option  
  cm->SetParameter(DescID(ID_CA_WCYCLE_TAG_ACTIONS), GeData(1), DESCFLAGS_SET_0); //Sets the Lift(P.Y) action option  
  
  //How do we add the cube to the CMotion tree gui?  
  
  //c4d.CallButton(cm,c4d.ID_CA_WCYCLE_TAG_ACTION_ADD) //Executes the "ADD" button to create the new Lift action in Python  
  //Trying to execute the ADD button with C++ is not working   
  LONG plugin_id = doc->GetAction();  
  BasePlugin *CMplugin = FindPlugin(plugin_id, PLUGINTYPE_COMMAND);   //Find the CMotion plugin  
  if(CMplugin) GePrint("found the CMotion plugin");                   //Confirms that we've got the plugin  
  if(!CMplugin) return FALSE;  
  
  DescriptionCommand dc;  
  dc.id = DescID(ID_CA_WCYCLE_TAG_ACTION_ADD);                   //ID_CA_WCYCLE_TAG_ACTION_ADD is the id# for the button  
  CMplugin->Message(MSG_DESCRIPTION_COMMAND, &dc);               //<---Not working!!!  
  EventAdd();

-ScottA

On 28/07/2013 at 14:53, xxxxxxxx wrote:

Firstly I haven't tested this and I am not sure if its right since I have never had to manually execute a button before. But just looking at the code it seems you want to execute a button on a BaseObject but you are calling the command on the currently active tool instead.

cm->Message(MSG_DESCRIPTION_COMMAND, &dc;);

On 28/07/2013 at 16:05, xxxxxxxx wrote:

I managed to figure out how to execute the button.

    BaseObject *cm = doc->SearchObject("CMotion");  
  if(!cm) return FALSE;  
  BaseObject *cube = doc->SearchObject("Cube");  
  if(!cube) return FALSE;  
  
  GeData d;  
  cm->GetParameter(DescID(ID_CA_WCYCLE_TAG_ACTIONS), d, DESCFLAGS_GET_0);         //Gets the current actions option  
  cm->SetParameter(DescID(ID_CA_WCYCLE_TAG_ACTIONS), GeData(1), DESCFLAGS_SET_0); //Sets the Lift(P.Y) action option  
  
  //How do we add the cube to the CMotion tree gui?  
  
  DescriptionCommand dc;                                      //Create a description variable to hold the id of the button  
  dc.id = DescID(DescLevel(ID_CA_WCYCLE_TAG_ACTION_ADD));     //Get the object's "ADD" button id and assign it to "dc.id"  
  cm->Message(MSG_DESCRIPTION_COMMAND, &dc);                  //Execute that button command  
  EventAdd();

Now I just need to figure out how we drop objects into the tree gizmo. And how to select/de-select them as needed.
I'm not seeing anything in the docs that addresses this.

-ScottA

On 29/07/2013 at 03:22, xxxxxxxx wrote:

Hi Scott,

I'm afraid you can't access the CMotion objects tree gadget (ID_CA_WCYCLE_TAG_OBJECTS) of type ITEMTREE; it is private for the Character Animation module only.

On 29/07/2013 at 07:43, xxxxxxxx wrote:

I was afraid that's what you were going to say.
Thanks Yannick.

-ScottA