Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Attribute Manager not updating with Tag Selection

    Cinema 4D SDK
    python
    3
    5
    1.0k
    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.
    • M
      Motion4D
      last edited by r_gigante

      I am selecting tags on an object with python and once the selection is set the attribute manager doesn't update with the tag's attributes. It will if you only have any tag selected before the selection but if an object is selected or nothing is selected the attribute manager won't display anything when the tag is selected:/

      Any idea how to get the tag's properties to show up without manually selecting it?

      Here is simplified code to illustrate the issue. If you just make a cube primitive and select it this code will select the phong tag. But again the properties of the phong tag dont show up.

      import c4d
      from c4d import gui
      
      def main():
          obj = doc.GetActiveObject()
          tags = obj.GetTags()
          doc.SetSelection(tags[0])
          c4d.EventAdd()
          
      # Execute main()
      if __name__=='__main__':
          main()
      
      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @Motion4D
        last edited by

        Hi,

        you can do this:

        import c4d
        
        def main():
            # op is perdefined as the currently selected node
            if not isinstance(op, c4d.BaseObject):
                return
            # get the tags of op
            tags = op.GetTags()
            if not tags:
                return
        
            # start a new selection with the first tag
            doc.SetActiveTag(tags[0], c4d.SELECTION_NEW)
            # add the other tags to the selection
            for tag in tags[1:]:
                doc.SetActiveTag(tag, c4d.SELECTION_ADD)
            # Update Cinema
            c4d.EventAdd()
        
        # Execute main()
        if __name__=='__main__':
            main()
        

        Cheers
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 1
        • M
          Motion4D
          last edited by

          Thank you!
          doc.SetActiveTag() was the key.
          doc.SetSelection() was not switching it over to tag mode.

          1 Reply Last reply Reply Quote 0
          • C4DSC
            C4DS
            last edited by

            you can also make use of

            c4d.gui.ActiveObjectManager_SetObject
            

            to let the Attribute Manager (= ActiveObjectManager) show to content of the 'object'. Where 'object' can be anything from mesh object to tag, material, shader, ...

            M 1 Reply Last reply Reply Quote 0
            • M
              Motion4D @C4DS
              last edited by

              @C4DS Thank your reply! I had to come back to this because I had problems with switching back to object context and this solved that!

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