Find entry point for CallCommand( ID ) [SOLVED]



  • On 18/05/2015 at 15:43, xxxxxxxx wrote:

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

    ---------
    Often I want to find the method that is triggered by ID using CallCommand, like so:

    c4d.CallCommand(300000116) # Script Log...
    

    But the command ID is confusing. How can I call the C++ method directly without using CallCommand? For example, lets say I want to create a morph object that is listed in this menu:

    I cannot call this command because the enum is not listed in the documentation:

    BaseObject * morphDeformer = BaseObject::Alloc(Oicannotfindthisenum);
    

    What method is triggered after CallCommand( ID ) is called? I want to find this method so I can continue to use the newly created morph object throughout the script without finding it.

    I hope that makes some sense, thanks.



  • On 19/05/2015 at 07:20, xxxxxxxx wrote:

    Hello,

    of course you can use BaseObject::Alloc(). The argument for Alloc() is just a number so no enum is needed. The number needed is the ID of that object. This number is defined when RegisterObjectPlugin() is called.

    There are many ways to get this ID if it cannot be found in the documentation. One could create such an object and use a script or plugin to call GetType() to get the ID of the object. Also, you could open the "Customize Commands" dialog to search for the object or tool. There you find the ID in the bottom right corner.

    And finally you can look at your Script Log. When an object is registered, also a Command creating this object is created using the same ID. This is why one can use a command to create an object. So you can just take the ID you see in the Script Log and use it with Alloc() :

      
    BaseObject* morphDeformer = BaseObject::Alloc(1019768);  
    doc->InsertObject(morphDeformer,nullptr,nullptr);  
    

    best wishes,
    Sebastian



  • On 19/05/2015 at 09:10, xxxxxxxx wrote:

    Thanks for the methods, I did not think of that. Using the ID listed in the script log with Alloc( ID ) worked.


Log in to reply