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
    • Recent
    • Tags
    • Users
    • Login

    kill only one tag / not all [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 424 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

      On 12/05/2015 at 15:42, xxxxxxxx wrote:

      Hello,

      t try to kill a tag.
      Not all tags of a selected type.

      I' allready have found the Tag

        
          for tag in taglist:   
              if sel_name != tag[c4d.TEXTURETAG_RESTRICTION]:   
                  print "delete"   
                  print tag[c4d.TEXTURETAG_RESTRICTION]   
                  obj.KillTag(c4d.Ttexture)   
      

      But obj.KillTag(c4d.Ttexture) delets all Texture-Tags.
      I only whant to delete the tag whitch does not match to the sel_name.

      Does anybody has an Idea how to delete only one Tag?

      Thanks

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

        On 13/05/2015 at 01:38, xxxxxxxx wrote:

        Does nobody has an idea???
        Maybe it is so f**king easy that nobudy will give me an advice???

        Ronald

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

          On 13/05/2015 at 02:04, xxxxxxxx wrote:

          Hi,

          actually it should be enough to simply call tag.Remove().

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

            On 13/05/2015 at 02:09, xxxxxxxx wrote:

            I'm too, prefer remove

            Kissling post more code  - i'm lazy to add more 😉

            a few mods:

            Not all tags of a selected type.

            import c4d  
            from c4d import gui  
            #Welcome to the world of Python  
              
            def main() :  
              taglist = doc.GetActiveTags()  
              sel_name = "Polygon Selection.1"  
              for tag in taglist:  
                  if sel_name != tag[c4d.TEXTURETAG_RESTRICTION] and tag.GetType() == c4d.Ttexture:  
                      print "delete"  
                      print tag[c4d.TEXTURETAG_RESTRICTION]  
                      tag.Remove()  
              c4d.EventAdd()  
              
            if __name__=='__main__':  
              main()
            

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

              On 13/05/2015 at 03:03, xxxxxxxx wrote:

              Oh my good

              So easy !!!!
              Thanks a lot
              Ronald

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