diff options
author | Ton Roosendaal <ton@blender.org> | 2005-10-20 20:31:46 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-10-20 20:31:46 +0400 |
commit | 9409eaf92e1c41913528a7329be69c49463713d2 (patch) | |
tree | c4ca5964d4a55cf61df8c31213ed4f78be719d33 /source/blender | |
parent | 1f1eb8393d30a3ec996b77606f9f2d01646a96e3 (diff) |
Another option for more Armature deform control;
The "Use VGroup" or "Use Envelope" options now are in Modifier Panel
for Armature deform.
If Modifiers are in use, they override the Armature settings for it.
(Cannot get rid of the Armature panel options yet, since Blender still
allows parenting to be deforming too, which is displayed as a Virtual
modifier now)
This now allows to - for example - make a Envelope deform on a Lattice,
and have same Armature use vertexgroups on Mesh.
Next; vertexgroup option for Lattice & Curve deform
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_lattice.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 10 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 8 |
6 files changed, 39 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index 073810fd37b..c9606ea7efa 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -54,7 +54,7 @@ int object_deform_mball(struct Object *ob); void outside_lattice(struct Lattice *lt); void curve_deform_verts(struct Object *cuOb, struct Object *target, float (*vertexCos)[3], int numVerts); void lattice_deform_verts(struct Object *laOb, struct Object *target, float (*vertexCos)[3], int numVerts); -void armature_deform_verts(struct Object *armOb, struct Object *target, float (*vertexCos)[3], int numVerts); +void armature_deform_verts(struct Object *armOb, struct Object *target, float (*vertexCos)[3], int numVerts, int deformflag); float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3]; void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]); void lattice_calc_modifiers(struct Object *ob); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 5b73505c7f6..4d5c1c82bf2 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -660,13 +660,12 @@ static void pchan_bone_deform(bPoseChannel *pchan, float weight, float *vec, flo (*contrib)+=weight; } -void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts) +void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts, int deformflag) { - bArmature *arm= armOb->data; bPoseChannel *pchan, **defnrToPC = NULL; MDeformVert *dverts= NULL; float obinv[4][4], premat[4][4], postmat[4][4]; - int use_envelope= arm->deformflag & ARM_DEF_ENVELOPE; + int use_envelope= deformflag & ARM_DEF_ENVELOPE; int numGroups= 0; /* safety for vertexgroup index overflow too */ int i; @@ -686,7 +685,7 @@ void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], } /* get a vertex-deform-index to posechannel array */ - if(arm->deformflag & ARM_DEF_VGROUP) { + if(deformflag & ARM_DEF_VGROUP) { if (target->type==OB_MESH){ bDeformGroup *dg; diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index bb21343e039..e69f0946bc5 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -8,13 +8,15 @@ #include "MEM_guardedalloc.h" +#include "DNA_armature_types.h" +#include "DNA_effect_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_object_force.h" -#include "DNA_effect_types.h" #include "DNA_scene_types.h" + #include "BLI_editVert.h" #include "BKE_bad_level_calls.h" @@ -972,6 +974,7 @@ static void armatureModifier_copyData(ModifierData *md, ModifierData *target) ArmatureModifierData *tamd = (ArmatureModifierData*) target; tamd->object = amd->object; + tamd->deformflag = amd->deformflag; } static int armatureModifier_isDisabled(ModifierData *md) @@ -1003,14 +1006,14 @@ static void armatureModifier_deformVerts(ModifierData *md, Object *ob, void *der { ArmatureModifierData *amd = (ArmatureModifierData*) md; - armature_deform_verts(amd->object, ob, vertexCos, numVerts); + armature_deform_verts(amd->object, ob, vertexCos, numVerts, amd->deformflag); } static void armatureModifier_deformVertsEM(ModifierData *md, Object *ob, void *editData, void *derivedData, float (*vertexCos)[3], int numVerts) { ArmatureModifierData *amd = (ArmatureModifierData*) md; - armature_deform_verts(amd->object, ob, vertexCos, numVerts); + armature_deform_verts(amd->object, ob, vertexCos, numVerts, amd->deformflag); } /* Hook */ @@ -1535,6 +1538,7 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob) if(ob->parent->type==OB_ARMATURE && ob->partype==PARSKEL) { amd.object = ob->parent; amd.modifier.next = ob->modifiers.first; + amd.deformflag= ((bArmature *)(ob->parent->data))->deformflag; return &amd.modifier; } else if(ob->parent->type==OB_CURVE && ob->partype==PARSKEL) { cmd.object = ob->parent; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d294fac91dc..154161e6a7d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4985,6 +4985,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + if(main->versionfile <= 239) { + Object *ob; + + /* deformflag is local in modifier now */ + for(ob=main->object.first; ob; ob= ob->id.next) { + ModifierData *md; + + for (md=ob->modifiers.first; md; md=md->next) { + if (md->type==eModifierType_Armature) { + ArmatureModifierData *amd = (ArmatureModifierData*) md; + if(amd->object && amd->deformflag==0) { + Object *oba= newlibadr(fd, lib, amd->object); + bArmature *arm= newlibadr(fd, lib, oba->data); + amd->deformflag= arm->deformflag; + } + } + } + } + } + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 065af972dd4..8f28eaee4bd 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -105,6 +105,8 @@ typedef struct WaveModifierData { typedef struct ArmatureModifierData { ModifierData modifier; + short deformflag, pad1; /* deformflag replaces armature->deformflag */ + int pad2; struct Object *object; } ArmatureModifierData; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 9f23d15570a..cf52059e019 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -1310,6 +1310,10 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco } else if (md->type==eModifierType_Armature) { ArmatureModifierData *amd = (ArmatureModifierData*) md; uiDefIDPoinBut(block, modifier_testArmatureObj, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &amd->object, "Armature object to deform with"); + + uiDefButBitS(block, TOG, ARM_DEF_VGROUP, B_ARM_RECALCDATA, "Vert.Groups", lx,cy-=19,buttonWidth/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable VertexGroups defining deform"); + uiDefButBitS(block, TOG, ARM_DEF_ENVELOPE, B_ARM_RECALCDATA, "Envelopes", lx+buttonWidth/2,cy,buttonWidth/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable Bone Envelopes defining deform"); + } else if (md->type==eModifierType_Hook) { HookModifierData *hmd = (HookModifierData*) md; uiDefButF(block, NUM, B_MODIFIER_RECALC, "Falloff: ", lx, (cy-=19), buttonWidth,19, &hmd->falloff, 0.0, 100.0, 100, 0, "If not zero, the distance from hook where influence ends"); @@ -2653,8 +2657,8 @@ static void editing_panel_armature_type(Object *ob, bArmature *arm) uiDefBut(block, LABEL, 0, "Deform Options", 10,80,150,20, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, ARM_DEF_VGROUP, B_ARM_RECALCDATA, "Vertex Groups", 10, 60,150,20, &arm->deformflag, 0, 0, 0, 0, "Enable VertexGroups defining deform"); - uiDefButBitI(block, TOG, ARM_DEF_ENVELOPE, B_ARM_RECALCDATA, "Envelopes", 160,60,150,20, &arm->deformflag, 0, 0, 0, 0, "Enable Bone Envelopes defining deform"); + uiDefButBitI(block, TOG, ARM_DEF_VGROUP, B_ARM_RECALCDATA, "Vertex Groups", 10, 60,150,20, &arm->deformflag, 0, 0, 0, 0, "Enable VertexGroups defining deform (not for Modifiers)"); + uiDefButBitI(block, TOG, ARM_DEF_ENVELOPE, B_ARM_RECALCDATA, "Envelopes", 160,60,150,20, &arm->deformflag, 0, 0, 0, 0, "Enable Bone Envelopes defining deform (not for Modifiers)"); uiDefButBitI(block, TOG, ARM_RESTPOS, B_ARM_RECALCDATA,"Rest Position", 10,40,150,20, &arm->flag, 0, 0, 0, 0, "Show armature rest position, no posing possible"); uiDefButBitI(block, TOG, ARM_DELAYDEFORM, REDRAWVIEW3D, "Delay Deform", 160,40,150,20, &arm->flag, 0, 0, 0, 0, "Don't deform children when manipulating bones in pose mode"); |