Can I get a vertex group using python?

Is there a way to get an object’s vertex group by using python? Can I change the colors of vertex groups from within the game?


This cannot be done. Can I get the verts that are assigned to a bone?

I do not think you get this. But you can use multiple meshes as skins.

yes ,a -workaround- is duplicate the mesh,so keep the vertex usefull (with identical origin ) ,name it as vertex group ,parent this piece to the original mesh and use it as vertexgroup … (unfortunely this method add a bit of annoyng obj…)

i think can exist also workaround more easy , what other attibute can be read from a vertex?
position , color(but this cannot be used as reference in this case) … no other?

May I ask why you want to get the vertices?

maybe is not a question to me, but can there many way to use vertex group.

for example, you have a big scenario with a lot of “resource” (stone , iron , , or trees)
now you have to use a ton of empty , that due a bit of mess (all time that you choose for example the target of “trackTo” you see 1000 empty in the list)
while with vertex group you can use it as container of data.

one other thing is to attach contraints to one softbody .

for v in vertexGroup["softbody"]:

this last anyway is not hard to make also now with dummy mesh, but still a workaround…and anyway even too easy since the softbody change its origin after you press P

Monster, I am rebooting AE and making the characters chibi. I was looking through my clean images of anthro characters and I saw a white fox with blue tips. The individual vertex colors can be changed, so I was going to use a monochrome texture and let the player change the color (Also possible). If I could get vertex groups I could allow the player to change the colors of different body parts, thus allowing even more customization.

Too bad an object cannot have different meshes, even though it is in list format.

Marco, I could colorize the different verts and preset the groups that way. I would need to generate vertex lists, but that is a good idea until I find something better.

Before anyone asks, changing textures within the game engine is not feasible. All copies of the same object share materials (I hope they do not share vertex colours).

All copies of an object share mesh data. Materials, shapekeys, and vertex colours. They do NOT share object size, ipo? curves, skeleton animations, object colours, or physics. I wish object copies used different meshes and materials, but I can work with this.

I am not using separate objects for the main body, just clothes and hair.

Currently there’s a bug where you can’t change the UV values or the vertex colors for armatured meshes (if I’m correct). I believe I made a bug report about it on the tracker, but I don’t think there’s been a fix as of currently. As a side note, you could use LibNew to make a new copy of the player’s mesh and allow that to change.

With bpy yes, but this not working in game engine.

That is interesting. Can you give an example, I am currently busy trying to setup shop (I’m going to sell my games myself, using a payment manager).

Here is some background, I am going to (again) have five races. I’ll have one player/npc setup using states and change the mesh to reflect the race. The skeleton will have an age animation and the bounds will animate the size (but I may use shapekeys if I can dupe the mesh). The texture will be a monochrome detail image and the player will change the colours via a menu, settings will be saved (probably database). NPC’s will be randomly generated (with colours, races, age, and clothes). Clothing, hair, and marrage collars will be separate objects (parented to bones). Guns and held items will auto-parent to an object in the hand. Graphics will be a cross between Animal Crossing and Pokemon B/W.

Terribly complex, but it will be a combination of dynamic and static gameplay.

Thank you for the suggestions.

As SolarLune wrote LibNew creates you a new mesh which can be used via replaceMesh.

I suggest to look for the realtime texture paint (resource forum). I think this is what you really need).

Additional you can apply multiple skin/cloth objects to one armature :smiley:

As another sidenote, Moguri mentioned in the bug report that it had something to do with display lists, so if you turn those off, then it might work (it didn’t for me when I filed the bug, but maybe something changed between then and now).

Libnew has one major flaw. Because the mesh is not native to the scene, you cannot use skele animations or shapekey animations on it. Thanks anyway.

Really? That sounds a bit odd. So making a LibNew version of a mesh that is already animated by an armature won’t work?

Nope, unfortunately. I’ll post a blend later.


That read oddly

test.blend (560 KB)

Here is the blend file from my “folder”. Press “P” and use the spacebar for the skele anim (but it won’t play). IPO? curves (are we still calling them that) will work ant the show is psychedelic, but the output is depressing.

ReplaceMesh() new mesh is not used in an object from the current scene, you will get incorrect behavior.

Blast my cannons.

Bump, I guess nevryone checks unless they get an e-mail.