Enable Tag upon selected?



  • 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?



  • 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



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


Log in to reply