creating models from files.

You two should really work on your english to not sound so offensive.

No that code does not help in any way in setting individual vertex weights, sorry. Seems like Blender has what’s called a “vertex group weight”. That’s another thing, that’s a single value for all vertices of that group. That can’t be used for “soft-skinning”.
Blender does support individual vertex weights: go to weight paint, add random weights to random vertices, go to object mode. How many vertex groups you have? Still 1. But the vertices inside it have different weights.
Unsurprising, because just about any decent 3d format for rigged meshes and any 3d program these days use what’s called a “vertex weight”. I would be very surprised if you wouldn’t be able to access them with Python, as Blender claims that everything is scriptable with Python.

Anyway, you guys have been a great help in the other areas of Blender, but if you have never worked with vertex weights, maybe you should stop assuming now that I’m asking for something which doesn’t exist. Thanks for everything else, but now if you can’t help, don’t reply please.

Jees you are full of it. Unsurprising… do you make any attempt to work these things out for yourself? If you actually ran the code I posted you would see that it only removes verts with a weight less than TOL for every vertex group they are assigned to… perhaps that in itself might show that I am aware that they have differing weights. Below is a script that sets the weight… pretty dang similar… “the code does not help in anyway” shows pretty much where you’re at.

The code below is designed to run on an active mesh object. Don’t go running it on an armature and posting back the error message.


import bpy

#create a vertex group

ob = bpy.context.object
vg = ob.vertex_groups.new()
vg.name = "whatever"


#make a list of the the verts you want to assign to vg "whatever" 
# one single vert vert.index = 0

verts = [0]
#has to be in object mode

bpy.ops.object.mode_set(mode='OBJECT')
vg.add(verts,weight=0.34,type="ADD")

Now you have one vertex in the vertex group “whatever” with weight 0.34.

Get off your high horse sunshine.

Your old script checks vertgroup.weight for each vertex. So as I couldnt find VertexGroup in the new API docs, I assumed it’s checking the same value. However, I found the class in the docs now and weight() is a function, not a field, which takes a vertex index, however you old script didn’t do that.
Although now that I found the class, I see the add() function does exactly what I need. And your new script shows add() so I’m not saying your new example isn’t helpful.

Still though, nothing gave you the right to go offensive and this was very childish of you. I don’t want to be thought something this way.
And I was explaining why it’s unlikely that vertices don’t have weights in Blender to PKHG, not you.

I tried to be nice with you, seeing as you are willing to help. Clearly, you treat this as some kind of argument and go all personal. I can’t take anyone who edits his post for the reason “more offensive” seriously. You are an obvious troll and I’m not going to feed you. Off you go sunshine. :slight_smile:

Yep you didn’t run it.


for vert in mesh.vertices :
    <b>for vertgroup in vert.groups:</b>
        verts_toremove = []
        if vertgroup.weight &lt; TOL:

Take a closer look precious you might learn something. Enough from me on this too.

One possible work around for the vertex color alpha is to create a vertex color layer specifically for it. The import would take the singular alpha value and make it the red, green and blue values for the alpha layer-- thus displaying as a shade of gray. Ideally during editing it would remain a shade of gray. In any event, the export procedure would find the average of the three values to generate the singular alpha value.