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

    [Solved]PointTag / EdgeTag and PolygonTag

    Scheduled Pinned Locked Moved PYTHON Development
    8 Posts 0 Posters 770 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 10/03/2017 at 06:18, xxxxxxxx wrote:

      I was scrtipting a script for removing all tag from obj.
      But I discover some hidden tag. So what the goal of them?
      Since that complettly broke mesh with ngon, is there other hidden tag wich is preferable to don't delete?

          keep_tag_id = [5600, 5672, 5604]
          
          objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER | c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
          doc.StartUndo()
          for obj in objs:
              tags = obj.GetTags()
              for tag in reversed(tags) :
                  if tag.GetType() not in keep_tag_id:
                      print tag
                      doc.AddUndo(c4d.UNDOTYPE_DELETE, tag)
                      tag.Remove()
                  
          c4d.EventAdd()
          doc.EndUndo()
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 13/03/2017 at 02:31, xxxxxxxx wrote:

        Hi,

        I'd say, usually tags are hidden, so the user doesn't mess with them. We recommend, instead of checking for certain Tag IDs, rather check the TAG_VISIBLE flag (GetInfo(), sorry, other links to C++ docs: TAG_VISIBLE, BaseTag manual) and if it's not set, don't delete the tag. And on top of that, you could then have an exception table for hidden tags, you know you want to delete.

        Edit: Added link to GetInfo for future readers

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

          On 13/03/2017 at 03:36, xxxxxxxx wrote:

          Thanks you but how to check the tag visibility in python?
          Cause the GetInfo only return an int.
          Does my following code is correct?

          tag_inf = doc.GetFirstObject().GetTags()[0].GetInfo()
          if tag_inf >= c4d.TAG_VISIBLE:
            print 'visible'
          else:
            print 'not visible'
          
          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 13/03/2017 at 06:40, xxxxxxxx wrote:

            Hi,

            the returned integer is supposed to be interpreted as a bit mask.

            Usually you do this with a bit-wise boolean operation (&, |,... not to be confused with logical boolean operations (and, or,...)), like for example with bit-wise boolean And (&) :

            if tag.GetInfo() & c4d.TAG_VISIBLE:
                print "visible"
            

            More on this for example in the Python docs.

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

              On 13/03/2017 at 07:00, xxxxxxxx wrote:

              Thanks you Andreas ! 🙂

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

                On 14/03/2017 at 03:22, xxxxxxxx wrote:

                Don't know if it's the good place for speaking about that. But what is the exact goal of all VariableTag?
                Is it only for faster read access? When does it need to be written?
                What consequence of rewriting VariableTag?

                When they are managed into the caching pipline?

                Btw it's just for my curiosity and the love to udnerstand how c4d work, Since I don't really understand the advantage of theses tags instead using regular functions. For exemple for point => GetPointR can also be aviable through the PointTag.

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

                  On 14/03/2017 at 03:58, xxxxxxxx wrote:

                  One of those questions, that would well deserve its own thread...

                  A Variable Tag is just a means to store a varying amount of data. So it's "variable" in the sense of "capable of being changed", not in the sense of a variable (i.E. a place to store data) which again of course comes from being variable...
                  Take for example a Polygon Object. It needs to store a number of Vectors describing point positions. And it needs to store information about polygons (basically an array of point indexes). While this information could of cause be stored in members of the Polygon Object implementation, one would need to take care of reading/writing/copying this data. Instead one can simply make use of Variable Tags (Point tag and Polygon tag in this case), they'll take care of the contained data in these cases.
                  In regards to caching and scene execution pipeline, Variable tags don't do much, as they are only data containers in most cases. So in the above example it's rather the Polygon Object doing something with the data stored in its Variable Tags.

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

                    On 14/03/2017 at 06:15, xxxxxxxx wrote:

                    Thanks you Andreas.

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