diff options
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 9 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 40 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 2 |
3 files changed, 27 insertions, 24 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 6da2c94fab8..1cb163a4de7 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -5657,7 +5657,7 @@ static void hookModifier_deformVerts( { HookModifierData *hmd = (HookModifierData*) md; bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget); - float vec[3], mat[4][4], dmat[4][4], imat[4][4]; + float vec[3], mat[4][4], dmat[4][4]; int i; DerivedMesh *dm = derivedData; @@ -5670,8 +5670,8 @@ static void hookModifier_deformVerts( /* just object target */ Mat4CpyMat4(dmat, hmd->object->obmat); } - Mat4Invert(imat, dmat); - Mat4MulSerie(mat, imat, dmat, hmd->parentinv, + Mat4Invert(ob->imat, ob->obmat); + Mat4MulSerie(mat, ob->imat, dmat, hmd->parentinv, NULL, NULL, NULL, NULL, NULL); /* vertex indices? */ @@ -5728,7 +5728,8 @@ static void hookModifier_deformVerts( } } } - } else { /* vertex group hook */ + } + else if(hmd->name[0]) { /* vertex group hook */ bDeformGroup *curdef; Mesh *me = ob->data; int index = 0; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 8ac12a5e3a4..3d2ddba3757 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1384,9 +1384,11 @@ void add_hook(Scene *scene, View3D *v3d, int mode) modifier_free(md); } else if(mode==5) { /* select */ + // FIXME: this is now OBJECT_OT_hook_select object_hook_select(obedit, hmd); } else if(mode==6) { /* clear offset */ + // FIXME: this is now OBJECT_OT_hook_reset operator where_is_object(scene, ob); /* ob is hook->parent */ Mat4Invert(ob->imat, ob->obmat); @@ -1398,25 +1400,6 @@ void add_hook(Scene *scene, View3D *v3d, int mode) DAG_scene_sort(scene); } - -/* use this when the loc/size/rot of the parent has changed but the children should stay in the same place - * apply-size-rot or object center for eg */ -static void ignore_parent_tx(Scene *scene, Object *ob ) -{ - Object workob; - Object *ob_child; - - /* a change was made, adjust the children to compensate */ - for (ob_child=G.main->object.first; ob_child; ob_child=ob_child->id.next) { - if (ob_child->parent == ob) { - ED_object_apply_obmat(ob_child); - what_does_parent(scene, ob_child, &workob); - Mat4Invert(ob_child->parentinv, workob.obmat); - } - } -} - - void add_hook_menu(Scene *scene, View3D *v3d) { Object *obedit= scene->obedit; // XXX get from context @@ -1435,6 +1418,25 @@ void add_hook_menu(Scene *scene, View3D *v3d) add_hook(scene, v3d, mode); } + + +/* use this when the loc/size/rot of the parent has changed but the children should stay in the same place + * apply-size-rot or object center for eg */ +static void ignore_parent_tx(Scene *scene, Object *ob ) +{ + Object workob; + Object *ob_child; + + /* a change was made, adjust the children to compensate */ + for (ob_child=G.main->object.first; ob_child; ob_child=ob_child->id.next) { + if (ob_child->parent == ob) { + ED_object_apply_obmat(ob_child); + what_does_parent(scene, ob_child, &workob); + Mat4Invert(ob_child->parentinv, workob.obmat); + } + } +} + /* ******************** clear parent operator ******************* */ static EnumPropertyItem prop_clear_parent_types[] = { diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 1b20f90360a..ec46cea8e84 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -865,7 +865,7 @@ static int hook_reset_exec(bContext *C, wmOperator *op) Mat4MulMat4(mat, pchan->pose_mat, hmd->object->obmat); Mat4Invert(imat, mat); - Mat4MulSerie(hmd->parentinv, imat, mat, NULL, NULL, NULL, NULL, NULL, NULL); + Mat4MulSerie(hmd->parentinv, imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL); } else { Mat4Invert(hmd->object->imat, hmd->object->obmat); |