Polygon selection tag to vertex (weight) map

On 15/10/2017 at 08:36, xxxxxxxx wrote:

Hi all!

Been trying to get my script ready that simple makes a vertex map tag based on a polygon selection.
Inside c4d you do this with the Set vertex map command. But inside python it works a little different I think??

Setting the vertex map is with:
vertexmaptag.SetAllHighlevelData(selection tag values here)

But how do I set the selection tag to be the value to make to weight tag?
After that I also like to do an smooth weight command. Tips on that are also welcome!

All help is appreciated!:slightly_smiling_face:


On 15/10/2017 at 08:53, xxxxxxxx wrote:

As the name vertexMap is per vertex and not per polygon.

Anyway here is an exemple I made for set/read weight data in python

On 15/10/2017 at 09:47, xxxxxxxx wrote:

Thanks for the example script!:)
Still a question (No expert I have to admit:blush:)

How do I read in my selection tag to be the value of the weight map?

On 16/10/2017 at 02:28, xxxxxxxx wrote:


assuming you have a polygon selection stored in a SelectionTag, get the BaseSelect from the SelectionTag (GetBaseSelect()). This BaseSelect stores the selection state per index (of points, polygons,...), see for example IsSelected().

In case the selection is not stored in a SelectionTag, but is only an active selection on a PolygonObject, then you can get the BaseSelect via GetPolygonS().

Now, as gr4ph0s already pointed out, when having a polygon selection, you will need to find out the points/vertices belonging to a selected polygon. Via PolygonObject.GetAllPolygons() (or GetPolygonR() or directly via GetPolygon()) you get the CPolygon structure of a polygon, which stores the point indeces you are looking for.