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

    Select the object on which the plugin Tag is associated

    Cinema 4D SDK
    3
    5
    772
    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.
    • mocolocoM
      mocoloco
      last edited by mocoloco

      Hi there,

      My learning curve is improving, but I'm still a newbie here...
      I wrote my first plugin, but I noticed that when you click on the TAG associated to an object, that does not select the object itself.

      Is there a way to have the object selected when the user select its associated Tag plugin?

      I had a look on several function like doc.SearchObject() or doc.SetActiveObject() but I'm not sure what the best practices are to do so.

      Does this call must be place into the Message() when a flag is raised or should it be placed into the Execute() (from what I understood, I think that is not the right place)?

      If someone have some advices or tips about this it would be more than welcome.

      ferdinandF 1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        From a user perspective: Please, please, please do not do this. You are breaking the established GUI interactions that are needed for other functionalities. If you select the tag's object when the tag is selected, you can no longer select and delete or move the tag individually. It's a huge no-no. Don't.

        1 Reply Last reply Reply Quote 0
        • ferdinandF
          ferdinand @mocoloco
          last edited by ferdinand

          Hello @mocoloco,

          thank you for reaching out to us. This is technically possible, but we would advise against doping it as it would break with interface conventions of Cinema 4D as pointed out by @Cairyn. While the user could still move the tag individually in such setup, he/she could no longer delete your tag without deleting the object it is attached to.

          Nonetheless: To get the object associated with a tag, you can either call BaseTag.GetObject() or the more general purpose BaseList2D.GetMain(). Cinema 4D's scene graph is split into many smaller isolated graphs, e.g., the tag relations are not part of the object relations. GetMain() is the connection handle for (most of) these subgraph connections. So, a tag will return its object with GetMain(), an object its BaseDocument (which is also a GeListNode\BaseList2D, i.e., node, in Cinema) and so on.

          Cheers,
          Ferdinand

          MAXON SDK Specialist
          developers.maxon.net

          1 Reply Last reply Reply Quote 0
          • mocolocoM
            mocoloco
            last edited by

            Hello,

            Thanks for the advices @ferdinand, I think I'm gonna change some parts of my code to avoid this and keep the C4D conventions; I think that I can find a workaround on this.

            Cheers,
            Christophe

            1 Reply Last reply Reply Quote 0
            • mocolocoM
              mocoloco
              last edited by

              I changed my code to use BaseDocument.SearchObject(self, name) and it is working perfectly without compromising anything.

              Thanks again,
              Cheers,

              Christophe

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