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:
authorJoshua Leung <aligorith@gmail.com>2009-08-21 14:47:27 +0400
committerJoshua Leung <aligorith@gmail.com>2009-08-21 14:47:27 +0400
commit9125fe55fbe18d0fafdf388ce69f9bd29657da2f (patch)
tree7285e1bc92447c03be5e9029e7d68bae43f42326 /source/blender/editors/object
parent46fb2d37e347b6ecbd0097aa662cd2fdc4b65f33 (diff)
Hook Modifier - Bone Targets
Made Hook Modifier be able to use bone targets. However, I haven't been able to verify that everything will work perfectly, since just creating a new Hook Modifier and assigning targets doesn't set hmd->indexar correctly.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_edit.c4
-rw-r--r--source/blender/editors/object/object_modifier.c19
2 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 2fb9835f833..e1b8858937c 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -979,6 +979,9 @@ static void select_editmesh_hook(Object *ob, HookModifierData *hmd)
EditVert *eve;
int index=0, nr=0;
+ if (hmd->indexar == NULL)
+ return;
+
for(eve= em->verts.first; eve; eve= eve->next, nr++) {
if(nr==hmd->indexar[index]) {
eve->f |= SELECT;
@@ -1361,6 +1364,7 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
hmd->totindex= tot;
BLI_strncpy(hmd->name, name, 32);
+ // TODO: need to take into account bone targets here too now...
if(mode==1 || mode==2) {
/* matrix calculus */
/* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 32a1297aaf4..3785e17f67c 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -31,6 +31,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_action_types.h"
#include "DNA_curve_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -42,6 +43,7 @@
#include "BLI_arithb.h"
#include "BLI_listbase.h"
+#include "BKE_action.h"
#include "BKE_curve.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -853,8 +855,21 @@ static int hook_reset_exec(bContext *C, wmOperator *op)
HookModifierData *hmd= ptr.data;
if(hmd->object) {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
+
+ if(hmd->subtarget[0] && pchan) {
+ float imat[4][4], mat[4][4];
+
+ /* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
+ Mat4MulMat4(mat, pchan->pose_mat, hmd->object->obmat);
+
+ Mat4Invert(imat, mat);
+ Mat4MulSerie(hmd->parentinv, imat, mat, NULL, NULL, NULL, NULL, NULL, NULL);
+ }
+ else {
+ Mat4Invert(hmd->object->imat, hmd->object->obmat);
+ Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ }
}
DAG_object_flush_update(scene, ob, OB_RECALC_DATA);