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
path: root/source
diff options
context:
space:
mode:
authorAndre Susano Pinto <andresusanopinto@gmail.com>2008-08-15 04:51:44 +0400
committerAndre Susano Pinto <andresusanopinto@gmail.com>2008-08-15 04:51:44 +0400
commita88eb64f70750de50fe153c147382261867ae1be (patch)
treea5a707b7ca179eca7e06833c1d40001d10619a62 /source
parentc37923c7a386f8cdb8ad61e475821253e793da95 (diff)
Simpledeform origin is no longer attache to parent by default
That was due to a current limitation on dag system.. that leads to cyclic dependencies. So now you can attach the origin of a simpledeform to an empty and mark whether its affected by the relative position of empty or the global one. brecht found a workarround to solve the cyclic dependency by using a parent of both the mesh and the control empty: empty_parent | |-> empty controlling simpledeform |-> mesh with simpledeform modifier
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/simple_deform.c23
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h7
-rw-r--r--source/blender/src/buttons_editing.c45
3 files changed, 27 insertions, 48 deletions
diff --git a/source/blender/blenkernel/intern/simple_deform.c b/source/blender/blenkernel/intern/simple_deform.c
index 20cba28ab5a..2984b8fe9d8 100644
--- a/source/blender/blenkernel/intern/simple_deform.c
+++ b/source/blender/blenkernel/intern/simple_deform.c
@@ -153,13 +153,24 @@ void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, s
if(smd->origin)
{
//inverse is outdated
- Mat4Invert(smd->origin->imat, smd->origin->obmat);
- Mat4Invert(ob->imat, ob->obmat);
- ob2mod = tmp_matrix[0];
- mod2ob = tmp_matrix[1];
- Mat4MulSerie(ob2mod, smd->origin->imat, ob->obmat, 0, 0, 0, 0, 0, 0);
- Mat4Invert(mod2ob, ob2mod);
+ if(smd->originOpts & MOD_SIMPLEDEFORM_ORIGIN_LOCAL)
+ {
+ Mat4Invert(smd->origin->imat, smd->origin->obmat);
+ Mat4Invert(ob->imat, ob->obmat);
+
+ ob2mod = tmp_matrix[0];
+ mod2ob = tmp_matrix[1];
+ Mat4MulSerie(ob2mod, smd->origin->imat, ob->obmat, 0, 0, 0, 0, 0, 0);
+ Mat4Invert(mod2ob, ob2mod);
+ }
+ else
+ {
+ Mat4Invert(smd->origin->imat, smd->origin->obmat);
+ ob2mod = smd->origin->obmat;
+ mod2ob = smd->origin->imat;
+ }
+
}
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 30bec07f5fc..9ce04c1c272 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -544,7 +544,8 @@ typedef struct SimpleDeformModifierData {
char mode; /* deform function */
char axis; /* lock axis (for taper and strech) */
- char pad[2];
+ char originOpts; /* originOptions */
+ char pad;
} SimpleDeformModifierData;
@@ -556,4 +557,8 @@ typedef struct SimpleDeformModifierData {
#define MOD_SIMPLEDEFORM_LOCK_AXIS_X (1<<0)
#define MOD_SIMPLEDEFORM_LOCK_AXIS_Y (1<<1)
+/* indicates whether simple deform should use the local
+ coordinates or global coordinates of origin */
+#define MOD_SIMPLEDEFORM_ORIGIN_LOCAL (1<<0)
+
#endif
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 8ea6a6c191a..63303467856 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -1711,32 +1711,6 @@ static int modifier_is_fluid_particles(ModifierData *md) {
return 0;
}
-static void modifier_link_new_empty(void *pp_empty, void *p_parent)
-{
- Object **empty = (Object**)pp_empty;
- Object *parent = (Object*) p_parent;
-
- /* Add object but witouth chaing layers and or changing active object */
- Base *base= BASACT, *newbase;
-
- (*empty) = add_object(OB_EMPTY);
-
- newbase= BASACT;
- newbase->lay= base->lay;
- (*empty)->lay= newbase->lay;
-
- /* restore, add_object sets active */
- BASACT= base;
-
- /* Makes parent relation and positions empty on center of object */
- (*empty)->partype= PAROBJECT;
- (*empty)->parent = parent;
- Mat4CpyMat4( (*empty)->obmat, parent->obmat );
- Mat4Invert( (*empty)->parentinv, parent->obmat);
- apply_obmat( (*empty) );
- DAG_scene_sort(G.scene);
-}
-
static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco, int *yco, int index, int cageIndex, int lastCageIndex)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -1912,9 +1886,8 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
} else if (md->type==eModifierType_SimpleDeform) {
SimpleDeformModifierData *smd = (SimpleDeformModifierData*) md;
-
height += 19*4;
-
+ if(smd->origin != NULL) height += 19;
if(smd->mode == MOD_SIMPLEDEFORM_MODE_STRETCH
|| smd->mode == MOD_SIMPLEDEFORM_MODE_TAPER )
height += 19;
@@ -2589,20 +2562,10 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &smd->vgroup_name, 0, 31, 0, 0, "Vertex Group name");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth-17,19, &smd->origin, "Origin of modifier space coordinates");
+ uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &smd->origin, "Origin of modifier space coordinates");
+ if(smd->origin != NULL)
+ uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_ORIGIN_LOCAL, B_MODIFIER_RECALC, "Relative",lx,(cy-=19),buttonWidth,19, &smd->originOpts, 0, 0, 0, 0, "Sets the origin of deform space to be relative to the object");
- if(smd->origin)
- {
- uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_VIEW, REDRAWALL, ICON_RESTRICT_VIEW_OFF,
- lx + buttonWidth-17, cy, 17, 19,
- &(smd->origin->restrictflag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
- }
- else
- {
- uiBut *bt;
- bt= uiDefIconBut(block, BUT, B_CHANGEDEP, ICON_ZOOMIN, lx+buttonWidth-17, cy, 17, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Creates a new empty");
- uiButSetFunc(bt, modifier_link_new_empty, &smd->origin, ob);
- }
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Factor:", lx,(cy-=19),buttonWidth,19, &smd->factor, -10.0f, 10.0f, 0.5f, 0, "Deform Factor");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Upper Limit:", lx,(cy-=19),buttonWidth,19, &smd->limit[1], -1000.0f, 1000.0f, 5.0f, 0, "Upper Limit Bend on X");