[Solved]PointTag / EdgeTag and PolygonTag

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]
    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)

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


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

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'
  print 'not visible'

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


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.

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

Thanks you Andreas ! :)

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.

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.

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

Thanks you Andreas.