Revision: 16125 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16125 Author: jaguarandi Date: 2008-08-15 02:51:44 +0200 (Fri, 15 Aug 2008)
Log Message: ----------- 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 Modified Paths: -------------- branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/simple_deform.c branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_modifier_types.h branches/soc-2008-jaguarandi/source/blender/src/buttons_editing.c Modified: branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/simple_deform.c =================================================================== --- branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/simple_deform.c 2008-08-15 00:00:27 UTC (rev 16124) +++ branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/simple_deform.c 2008-08-15 00:51:44 UTC (rev 16125) @@ -153,13 +153,24 @@ 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; + } + } Modified: branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_modifier_types.h =================================================================== --- branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_modifier_types.h 2008-08-15 00:00:27 UTC (rev 16124) +++ branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_modifier_types.h 2008-08-15 00:51:44 UTC (rev 16125) @@ -544,7 +544,8 @@ 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 @@ #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 Modified: branches/soc-2008-jaguarandi/source/blender/src/buttons_editing.c =================================================================== --- branches/soc-2008-jaguarandi/source/blender/src/buttons_editing.c 2008-08-15 00:00:27 UTC (rev 16124) +++ branches/soc-2008-jaguarandi/source/blender/src/buttons_editing.c 2008-08-15 00:51:44 UTC (rev 16125) @@ -1711,32 +1711,6 @@ 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 @@ } 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 @@ 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"); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs