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

    Enable Tag upon selected?

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 307 Views
    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.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 15/10/2012 at 07:05, xxxxxxxx wrote:

      Is there a way to enable the python tag only, when the object that the tag sits on, is selected?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 15/10/2012 at 07:40, xxxxxxxx wrote:

        Hi hypoly,

        in the Tags' code, you can just check if the object is selected. And if it is, you can execute the rest of the code.

        import c4d  
          
        def main() :  
          og = op.GetOrigin()  
          if not og.GetBit(c4d.BIT_ACTIVE) :  
              return  
          
          # Rest of the code
        

        Note that the rest of the code is also evaluated if the object is one of multiple selected objects. If you want to ensure it is the only active object, you can do:

        import c4d  
          
        def main() :  
          og = op.GetOrigin()  
          if og != doc.GetActiveObject() :  
              return  
          
          # Rest of the code
        

        Cheers,
        Niklas

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 15/10/2012 at 07:49, xxxxxxxx wrote:

          Thats great, thanks Niklas!

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