Retrieve tags that have only "logical" Priority Data?



  • Hi,

    I'm currently troubleshooting a rig with priority problems. I'm trying to print out tags that have "logical" priority data such as constraint, IK and IK-spline. However, it seems like all tags have priority data such as phong tag despite the fact that the priority data is not available for editing (i.e. visible) for such tags.

    Is there a way to list tags with logical priority data?

    Thank you for

    Here is the code so far

    import c4d
    doc = c4d.documents.GetActiveDocument()
    
    # Recurses a hierarchy, starting from op
    def recurse_hierarchy(op):
        while op:
            for tag in op.GetTags():
                if tag[c4d.EXPRESSION_PRIORITY]:
                    print tag.GetName() 
                    
            recurse_hierarchy(op.GetDown())
            op = op.GetNext()
            
    
    if doc:
        # Iterate all objects in the document
        recurse_hierarchy(doc.GetFirstObject())
    

    P.S. There seems to be typo in the documentation (https://developers.maxon.net/?p=26)
    Under the python usage, it says
    doc = c4d.GetActiveDocument()
    It gives me an error.

    I think it should be.
    doc = c4d.documents.GetActiveDocument()



  • hello,

    you can check in the description if the parameter does have a name

        descTag = tag.GetDescription(c4d.DESCFLAGS_DESC_NONE)
        bc = descTag.GetParameter(c4d.EXPRESSION_PRIORITY)
        if bc[c4d.DESC_NAME]  is not None:
            print tag
        
    

    If the tag doesn't have any priority list, the basecontainer will be empty but not "None"

    Cheers
    Manuel



  • @m_magalhaes said in Retrieve tags that have only "logical" Priority Data?:

    descTag = tag.GetDescription(c4d.DESCFLAGS_DESC_NONE)
    bc = descTag.GetParameter(c4d.EXPRESSION_PRIORITY)
    if bc[c4d.DESC_NAME]  is not None:
        print tag
    

    Thanks @m_magalhaes. Works as expected!
    Just a little change from c4d.DESCFLAGS_DESC_NONE to c4d.DESCFLAGS_DESC_0

    Thanks again. Have a great day ahead!


Log in to reply