new envelope vgroups from obs script

This script lets you assign vgroups from envelope meshes.
advantages over the existing script in teh animation menu

  • Dosnt require ApplySizeRot is done before working properly.
  • use a group to define the objects you want to use as an envelope. no messing with selection or special names.
  • does a proper point-in-mesh look-up so you can have complex envelopes, will work fine as lone as there watertight. (this has bounding tests so its not so slow)
  • Can use any object type Mesh/Surface/Metaball/Text etc as an envelope
  • Uses new Mesh API

Id like to include in Blender 2.43 but need some review first.

REMOVED- USE CVS FOR CURRENT SCRIPT

bump :confused:
does anyone use the existing script?

  • I dont want to replace it of theres somthing Im missing that the script can do, and it also isnt nice to replace scripts that the develepor may want to improve…

If not Id appreciate it if sombody could review this script.

Having some probs to make it work, but surely as… I dont know the workflow of it…

I tried this as I thought it would work but failed. Any docs available anywhere ? in the code there are no hints as how to use it.

Regards

malefico

malefico, added a modified version to the CVS, can you test it?
I should write some docs as always,.

Basicly the default operation is to update the active group only with the object of the same name.

You can initialize vgroup weights from a group of objects too as an option.

Looking forward to trying this out this is needed… I was just thinking about this morning.

Hey Cambo, I tested it. Seems to work OK now. Finally I understood how it works, so I’ll comment for other people (you can correct me if I misunderstood):

This script assigns weight paint (100%) to the active vertex group, using an external object (with same name as original vgroup) to determine vertex group extension and limits. This external object should belong to a Group.

For instance, you want to set 1.0 to the sternum vertex group in mancandy, and you want that vertex group to include all vertices in a rectangular area in the chest. You need to create a Cube, shape it to cover the whole area you are interested in, name it “sternum” and make it part of a group, let’s say a group named “envelope”.
Then, in weight paint mode, select the sternum vgroup, and run the script from the header’s “Paint” menu. Fill in “envelope” in GR box, and press the Update Active button.

Voilá, weight paint has been applied to all vertices inside the envelope for the sternum vertex group.

Feedback:
1- AFAIK, it can’t do several groups all together. For instance if I use several objects, with several vgroup names in a Group, only the active vgroup is affected. This is bad because one possible use is to apply same envelope to similarly shaped characters, but there you want something more automated than this.

2- You can’t control the weight paint value you are assigning. I did several tries to set it up before applying the script but failed.

3- It can’t make any blend in weight paint, this would be nice to have.

4- It doesn’t respect weight paint options, so for instance mirror painting is not possible

5- It doesn’t create new vertex groups. You need to create them first even if you don’t assign any weight at first.

Anyway, I can think of many uses for this script, Cambo let me know if you are planning to add any of the above :slight_smile:

Thank you malefico for figuring it out. From the sounds of it its not really ready for heavy use.

A dream setup for it might look like two things.
Between each mesh envelope a sudo bones setup could exsit much like The auto weighted bones we have now. So settiing up sudo smart Any shape form shape character form coulb be very quickly tested.

Easy to see hard to explain. Example. I made an entire muscle mesh once. It had nearly every single group, but it got realllly heavy… Anyway no one came through a way to use it hell no one tested it. But it’s goal was ment for this kinda setup.

This way things do not have to be named immediately just see and visualize what goes where.

Hi malefico,
you raise some interesting issues and Im glad sombody’s tested who could realy but a tool like this to use.

  1. you can but that overwrites all vgroup weights with the envalope objects from the group you select.
    2 & 3 ) No, see below…

  2. Im not sure youd want to support mirror options. depends on how you expect mirror to work… is it locational based… X only - could be messy if added but not well defined?

  3. it can make new vertex groups - but overwrites.


Assigning the weight of a group:
How could this be done? - could each envelope have an weight property, even in the name?
someVGroup(60) # for 60%? - a bit messy… :confused:
or use the average vertex color - white is 100, black is 0% weight (more visual but odd too, also infers that modulating the vcol in 1 envalope mesh could modulate the vgroup weight. intersection code wouldent support that well)

Blend weights

  • An interesting issue, 2 possible solutions, maybe use both.
    3a) - have a “Blur Iterations” number button that sets the number of weight blur passes to run after assigning weights. - fairly easy to do.

3b) - Allow more then 1 object to make up a group, eg:
myFoot, myFoot.001, myFoot.002
Object names like this would all add to the myFoot group, and verts that were inside all objects would have 100% weight, where 4 objects were used. verts inside 1 object would have 25% the weight applied.

All these things are possible but need to be added with care. Mirror could be a postprocess also. even look at the envalope modifiers and work out what to mirror from that,

Yeah I was thinking about this myself. The vertex colour could work, in fact, opening the door to material colours could also give the options of using textures for weight painting. This would let you apply complex gradients UV mapped.
I know of other packages of being able to store weight paint images, maybe something like this could be useful for this envelope meshes.
The weight coded in the name is a more restricted option. Another option is to use the currently selected weight paint which would be as restrictive as the name thing in the sense that only one value is allowed for the whole vgroup.

Maybe once a nice method to assign weight is implemented there might be no need of any fancy blend options.
About the mirror I was thinking about how the X-Mirror option works for regular weight painting. Is it possible to access that from python ?

When I pointed out you can assign several envelope objects at same time, I was thinking what if you run this from object mode let’s say, and it goes iterating every envelope in the group, assigning the weight to the right vgroup ?

Glad you are interested in feedback ! :slight_smile:

Regards

malefico

Hey Cambo, trying on a mesh without any vertex group, using three objects in a group, I got this error message:

Compiled with Python version 2.4.
Checking for installed Python… got it!
/home/malefico/.blender/icons: No such file or directory
Traceback (most recent call last):
File “<string>”, line 240, in ?
File “<string>”, line 235, in main
File “<string>”, line 154, in env_from_group
File “<string>”, line 80, in intersection_data
File “/media/data/blender-limpio/install/linux2/.blender/scripts/bpymodules/BPyMesh.py”, line 397, in getMeshFromObject
type = ob.type
AttributeError: ‘list’ object has no attribute ‘type’

Second run, without “Update Active” worked perfectly creating all vgroups as you pointed out. So I think it was my mistake :slight_smile:

Regards

malefico

bug fixed in the cvs

One W AWesome! Wish you fixed the bug yesterday !
Testing more now, but it looks really good.

Ok silly missed question, how do I asign a bone to that vertex group now ? Never did it this way before

just make sure the bones have the same name as the vgroup.

Youngbatcat: You should create an armature and use same vertex group names for bones.

I tested the fixed version, seems to work OK. I suggest changing the “Update Active” button to “Update Active VGroup”, as it’s just now I realized that’s what it means (doh !) :slight_smile:

Regards

malefico

Ah!, hmm so useing the mesh envelopes is a bit faster then… Would there be anyway to automate the naming of the bones contray to the groups near them?

Thats where that bit I commented above would go, in between each mesh group would exsit a bone joint point. So the bones would be created as well during the envelope creation.

Ooooor Version two of Blenders envelopes, would auto create their own mesh envelope.

Also to solve the issue with weights ammount; the density of the mesh faces in reverse would be the ammount of weight to put on or remove from the vertex group.

For example. to get a weight of .2 the end of the envelope would be rather dense with loops or simply a subdivided face, and a large area of just one loop of faces would be pure 1.0. It’s in reverse so as not to punish a simple quick setup test rig.

Is this script still available? I can’t seem to find it, nor the original from 2.37, I think, that Ideasman42 made. Doesn’t help that download.blender.org seems to be down at the moment. (as is cvs.blender.org, but that server might have been killed after the SVN one came up FAIK)

the script is now in the Paint menu when weight painting.
Envelopevia Object Groups, its been in blender for a few releases.

Ahh-cha, just found it, thanks a bunch! =3

Small question tho: Let’s say I have a multi-object model with a bunch of envelope meshes. Do I have to run the script for each model, and for each vertex group in that model?

operations on multiple models at once are too undefined. so yes, you have to run every time.

  • if theres a way to define it well Id not be against it