Tag GetInfo() help



  • A common friend was looking into a way to copy tags from one object to another using Python,
    It appears that we have invisible tags, tags that can't have more than one of the same type e.t.c.
    As far as I was told, we can use GetInfo() to get some of this information from the tag. The problem is that searching for "GetInfo()" won't return a result in either the Python or C++ documentation, and I can't find a list of what the info returns.
    Is there somewhere I can look?

    Thanks
    Thanassis



  • So, I did a bit more research after searching broader in the forum and here's a script that prints out the GetInfo() about the tag:

    import c4d
    def main():
    
        tags    = op.GetTags()
    
        for tag in tags:
            if not tag: continue
            print tag
            if tag.GetInfo() & c4d.TAG_VISIBLE:
                print "visible"
                
            if tag.GetInfo() & c4d.TAG_HIERARCHICAL:
                print "hierarchical"        
            
            if tag.GetInfo() & c4d.TAG_EXPRESSION:
                print "expression"
                
            if tag.GetInfo() & c4d.TAG_TEMPORARY:
                print "temporary"
                
            if tag.GetInfo() & c4d.TAG_MODIFYOBJECT:
                print "modifyObject"
    
            if tag.GetInfo() & c4d.TAG_ADDTOTAKEGROUP:
                print "add to take group"
          
        c4d.EventAdd()
    
    if __name__=='__main__':
        main()
    


  • Hi Thanassis, as you may know, or not, almost all components, users are used to use in Cinema 4D can be considered as a plugin such as objects (generator, modifier, spline), tags, shaders, materials, etc...

    When the developer register this plugin, it has to define some behaviors. For an object its a bit more explicit than for a tag so I take an object as an example.
    So for an object, (meaning something that can be displayed and stored in the Object Manager), when the developer register this particular Object plugin it should define some behaviors, is it a generator, is it a modifier, does it need other object to generate data?
    This information of these flags can be retrieved from any instance of this plugin with the function GetInfo, which contains all this information under a bitfield.
    So all possibles values of GetInfo depend on the plugin type you are currently retrieving the information.
    To know the type (if it's a tag, or an object, or a shader, etc...) you can use GetClassification

    Note: All possible flags for each plugin type are listed under the register method of this plugin type in the Python Documentation.

    I hope this answers your question.
    Cheers,
    Maxime.



  • @m_adam Great info. Thanks Maxime!


Log in to reply