Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-09-03 16:16:14 +0400
committerTon Roosendaal <ton@blender.org>2006-09-03 16:16:14 +0400
commit4603f452c23f0711e18fb7f652abad529f94c203 (patch)
tree17d42fe5337adb1e269f3d8eaa26237511383760 /source/blender/blenkernel/intern/lattice.c
parent7970da34edbfba8b317fff23fb276e78bf67e460 (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/blenkernel/intern/lattice.c')
-rw-r--r--source/blender/blenkernel/intern/lattice.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 768fedd86ea..fe28d0f3150 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -65,6 +65,7 @@
#include "BKE_lattice.h"
#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_screen.h"
@@ -106,6 +107,12 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
float fu, fv, fw, uc, vc, wc, du=0.0, dv=0.0, dw=0.0;
float *co, (*vertexCos)[3] = NULL;
+ /* vertex weight groups are just freed all for now */
+ if(lt->dvert) {
+ free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
+ lt->dvert= NULL;
+ }
+
while(uNew*vNew*wNew > 32000) {
if( uNew>=vNew && uNew>=wNew) uNew--;
else if( vNew>=uNew && vNew>=wNew) vNew--;
@@ -222,12 +229,19 @@ Lattice *copy_lattice(Lattice *lt)
ltn->key= copy_key(ltn->key);
if(ltn->key) ltn->key->from= (ID *)ltn;
+ if(lt->dvert) {
+ int tot= lt->pntsu*lt->pntsv*lt->pntsw;
+ ltn->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
+ copy_dverts(ltn->dvert, lt->dvert, tot);
+ }
+
return ltn;
}
void free_lattice(Lattice *lt)
{
if(lt->def) MEM_freeN(lt->def);
+ if(lt->dvert) free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
}