Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Retrieve tags that have only "logical" Priority Data?

    Cinema 4D SDK
    r20 python
    2
    3
    663
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bentraje
      last edited by bentraje

      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 ([URL-REMOVED]
      Under the python usage, it says
      doc = c4d.GetActiveDocument()
      It gives me an error.

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


      [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by Manuel

        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

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 2
        • B
          bentraje
          last edited by

          @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!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post