diff options
author | Ton Roosendaal <ton@blender.org> | 2006-09-03 16:16:14 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-09-03 16:16:14 +0400 |
commit | 4603f452c23f0711e18fb7f652abad529f94c203 (patch) | |
tree | 17d42fe5337adb1e269f3d8eaa26237511383760 /source/blender/src/editlattice.c | |
parent | 7970da34edbfba8b317fff23fb276e78bf67e460 (diff) |
Animation department feature request: support for vertex groups in Lattices
In a quick glance: (temp image)
http://www.blender.org/bf/rt.png
Main reason is that Lattices are useful a lot for Armature deformation.
Lattices just provide much more precise and interesting control. However,
with only bone envelopes it's very hard to use.
Working with Lattice vertex groups is nearly identical to Mesh:
- on CTRL+P 'make parent' you can choose the deform option now
- In editmode, the buttons to control vertex groups are available
- In outliner you can select vertexgroups too
- Deforming Lattices with Armatures has all options as for Mesh now.
Note:
- No WeightPaint has been added yet. To compensate, the editmode
drawing for a Lattice with vertex group shows weight values for the active
vertex group.
- Lattice editmode doesn't undo/redo weight editing yet.
- Softbody for Lattice still uses own vertex weights
Implementation notes:
- derivedmesh weight_to_rgb() is now exported to drawobject.c
- been doing cleanups in code (order of includes, var declarations, etc)
- weightpaint button handling now is generic
I've checked on Brecht's proposal for Custom Element data;
http://mediawiki.blender.org/index.php/BlenderDev/CustomElementData
It could have been used, but that would mean the existing code for
vertexgroup handling and armature deform couldn't be re-used. I guess this
is really a later todo.
Diffstat (limited to 'source/blender/src/editlattice.c')
-rw-r--r-- | source/blender/src/editlattice.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/src/editlattice.c b/source/blender/src/editlattice.c index 244b035db15..9aa363a654f 100644 --- a/source/blender/src/editlattice.c +++ b/source/blender/src/editlattice.c @@ -47,6 +47,7 @@ #include "DNA_curve_types.h" #include "DNA_key_types.h" #include "DNA_lattice_types.h" +#include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_view3d_types.h" @@ -55,6 +56,7 @@ #include "BKE_global.h" #include "BKE_key.h" #include "BKE_lattice.h" +#include "BKE_mesh.h" #include "BKE_utildefines.h" #include "BIF_editlattice.h" @@ -80,8 +82,11 @@ void free_editLatt(void) { if(editLatt) { if(editLatt->def) MEM_freeN(editLatt->def); + if(editLatt->dvert) + free_dverts(editLatt->dvert, editLatt->pntsu*editLatt->pntsv*editLatt->pntsw); + MEM_freeN(editLatt); - editLatt= 0; + editLatt= NULL; } } @@ -123,7 +128,12 @@ void make_editLatt(void) editLatt= MEM_dupallocN(lt); editLatt->def= MEM_dupallocN(lt->def); - setflagsLatt(0); + if(lt->dvert) { + int tot= lt->pntsu*lt->pntsv*lt->pntsw; + editLatt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert"); + copy_dverts(editLatt->dvert, lt->dvert, tot); + } + BIF_undo_push("original"); } @@ -171,6 +181,19 @@ void load_editLatt(void) lt->typev= editLatt->typev; lt->typew= editLatt->typew; } + + if(lt->dvert) { + free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw); + lt->dvert= NULL; + } + + if(editLatt->dvert) { + int tot= lt->pntsu*lt->pntsv*lt->pntsw; + + lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert"); + copy_dverts(lt->dvert, editLatt->dvert, tot); + } + } void remake_editLatt(void) |