Finding the Symbols, create Track, DescIDs



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/06/2011 at 10:30, xxxxxxxx wrote:

    Hy there,

    I still got problems finding the IDs for example for a command. Say, I want to create a Track:

    The Documentation says:

    >> Description ID to allocate the track for. For instance a position track will be allocated like this:
    >>tr=c4d.CTrack(op, c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_POSITION, c4d.DTYPE_VECTOR, 0, ), c4d.DescLevel(c4d.VECTOR_X, c4d.DTYPE_REAL. 0)))

    So, I want to create a new Track containing a Rotation Track.
    - How can I find the proper ID to do that (I assume it will be something like c4d.ID_BASEOBJECT_ROTATION)?
    - How can I know, which IDs will actually work when given as arguments?

    Why are there 4 attributes given here (or what is the last comma for)?
    >> c4d.DescLevel(c4d.ID_BASEOBJECT_POSITION, c4d.DTYPE_VECTOR, 0, )`

    `Also, can anyone explain to me how these DescIDs and Levels work?

    Thanks a lot,
    maxx



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/06/2011 at 10:54, xxxxxxxx wrote:

    Drag & Drop the Attribute into the Python Scriptmanager and you will see it's ID.
    Anyway, you can look up every Attribute ID in the .h file
    of the corresponding object/tag/tool.
    I.e.: Ocube.h

    Scott Ayers did write a "COFFEE Bible" where you can look up the IDs for Modeling Commands.

    If you have an Idea of how your ID would be called, you can also do this:

    import c4d   
      
    def searchC4D(*partialNames) :   
        for k,v in c4d.__dict__.iteritems() :   
            for e in partialNames:   
                if e.lower() in k.lower() : yield k, v   
      
    for e in searchC4D("rotation", "position", "command") :   
        print e[0].ljust(25) + ":    " + str(e[1])
    

    Cheers, Niklas



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/06/2011 at 11:26, xxxxxxxx wrote:

    The last comma in your track code doesn't need to be there.
    It might be a typo. Or a reference to a parameter you don't need to bother using.

    As far as I understand it.
    Descriptions are used to get at sub groups of groups.
    If you look at .res files. You can see this group/subgroup layout.
    If you're trying to get at something that's a sub group of another group. Then you have to use the description code syntax to first get the parent group. Then drill down to the child group you want to edit.
    You can't just call to the subgroup directly.

    Descriptions are a C++ type of syntax. Not really the kind of code you typically see in python. And most things in C++ tend to be long and wordy. And very complicated looking.
    But I think in reality. All it is is:

    c4d.DescID(c4d.DescLevel(c4d.The parent group, c4d.It's type, 0), c4d.DescLevel(c4d.The Sub Group You want to edit, c4d.It's type, 0))
    

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/06/2011 at 08:33, xxxxxxxx wrote:

    Drag & Drop the Attribute into the Python Scriptmanager and you will see it's ID.

    I know about the IDs, but an ID for a Track? Ie., is there something I could drag into the Scriptmanager that would give me the ID: c4d.ID_BASEOBJECT_ROTATION ?

    There are so many files with IDs, how can I know which IDs are accepted by a function? Is it all trial and error ?

    I just don't get it. I am used to Java documentation or C++ Header files ... normally I can always figure out what Attributes a Method will accept. In python I am always searching for these IDs where I never know, if I actually got the right one and if the function will accept it.

    >> But I think in reality. All it is is:

    So, these IDs are nothing more than a description to get a certain value from a resource file ?

    Thank you,
    maxx



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/06/2011 at 09:17, xxxxxxxx wrote:

    If you want to animate and Attribute for instance, the Id you want is the same as the attribute id.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/06/2011 at 11:02, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I know about the IDs, but an ID for a Track? Ie., is there something I could drag into the Scriptmanager that would give me the ID: c4d.ID_BASEOBJECT_ROTATION ?

    Yes.
    Usually Tracks are not children of the scene(doc). They are children of the object you are animating.
    So to get the ID for a position.X track. You would go to the object's attributes. And in the Coord. tab, Left mouse click on the text "P.X" and drag the mouse into the python console.
    That's how you can find a lot of the ID's.

    Originally posted by xxxxxxxx

    So, these IDs are nothing more than a description to get a certain value from a resource file ?

    In many cases yes.
    Sometimes the description is very easy to get at. So the code will be very short like this: op[c4d.ID_BASEOBJECT_XRAY]=True

    Other times. The descrition of what you want to edit is nested inside of another group.
    So the code is bit longer like this:
    tr=c4d.CTrack(op, c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_POSITION, c4d.DTYPE_VECTOR, 0), c4d.DescLevel(c4d.VECTOR_X, c4d.DTYPE_REAL. 0)))

    And still other times. You will need to find the ID of the attribute you want to edit. So you can apply it later on like this:
    id1 = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA), c4d.DescLevel(1)) # The first UserData entry
    op.SetKeyframeSelection(id1, 1) #Use that id to tell the SetKeyframeSelection function what attribute to apply it to.

    Here they are next to each other for easy comparison:
    -op[c4d.ID_BASEOBJECT_XRAY]=True
    -tr=c4d.CTrack(op, c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_POSITION, c4d.DTYPE_VECTOR, 0), c4d.DescLevel(c4d.VECTOR_X, c4d.DTYPE_REAL. 0)))
    -id1 = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA), c4d.DescLevel(1))# The first UserData entry

    There's probably a few more way to create and use these descriptions. But these are the most common ones.
    This can be very confusing stuff until you use them a few times.
    I'm personally going through similar pains with trying to learn all the various ways to write and use SetParameter() and GeData functions in C++.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/06/2011 at 12:28, xxxxxxxx wrote:

    Thank you ScottA for the explanation about the IDs. I think it is clear now.

    I guess the reason for not getting a c4d.ID_BASEOBJECT_ROTATION is, that it is an old symbol. That was also the reason, why I was confused about the flag and how to find the possible values.

    Now I understand how the res. files work. Great !

    Cheers,
    maxx


Log in to reply