How to get weights from a Vertex Map tag on an uneditable object

Hi,

I tried to get the weight values from a Vertex Map tag in the documented way.
It workd for editable polygon objects, but not for uneditable obejcts.

The .c4d file:
VertexMapWeightsFromUneditableObjects.c4d

The code:

import c4d

def main():
    tag = op.GetFirstTag()
    weight = tag.GetAllHighlevelData()
    print(weight)

if __name__ == '__main__':
    main()

The result for uneditalble cube:

Traceback (most recent call last):
  File "scriptmanager", line 9, in <module>
  File "scriptmanager", line 5, in main
SystemError: <method 'GetAllHighlevelData' of 'c4d.VariableTag' objects> returned NULL without setting an error

The result for editalble cube:

[0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0]

Is there any way to get the weight values for uneditable objects? Thank you.

@kng_ito said in How to get weights from a Vertex Map tag on an uneditable object:

First tag might be invisible tag.
So you need to specify tag, and check if it's exist, like so:

def main():
    tag = op.GetTag(c4d.Tvertexmap)
    if tag:
        weight = tag.GetAllHighlevelData()
        print(weight)

But most probably generator's weight tag contents would be irrelevant to what you expect to see.

hi,

this topic was discussed in this thread. The answer is the same, you need to retrieve the cache of your generator and search for the vertex tag. With GetOrigin you can compare from witch tag it have been cloned and be sure you are targeting the right one.

This cloned tag contains the data you are looking for.

Hi @Manuel ,
Sorry for asking a question that has already been resolved in another thread.
That thread solved my question. Thank you.

@kng_ito said in How to get weights from a Vertex Map tag on an uneditable object:

Sorry for asking a question that has already been resolved in another thread.

Don't worry, we are glad to help.

Cheers,
Manuel