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:
authorBastien Montagne <montagne29@wanadoo.fr>2013-10-15 18:54:12 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-10-15 18:54:12 +0400
commit22c019a96261a37ef2af439cdab60ae4cd210882 (patch)
tree1b92ca3187baf5d6aaef09c2f886dcc975d4ecc7 /source/blender/editors/object/object_hook.c
parentef60ab19f792c6d9a328e1eca8ad4c8d20940377 (diff)
Fix [#37085] Hook modifier work when created with Ctrl+H, but not when created via modifier panel
"transform matrix" of the hook was not inited (reset) when assinging and object to it, now use same code for both OBJECT_OT_hook_reset operator and RNA object assignement. Reviewed by Brecht, thanks.
Diffstat (limited to 'source/blender/editors/object/object_hook.c')
-rw-r--r--source/blender/editors/object/object_hook.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 37656f82b25..d6f3bf0c262 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -65,6 +65,7 @@
#include "ED_curve.h"
#include "ED_mesh.h"
#include "ED_screen.h"
+#include "ED_object.h"
#include "WM_types.h"
#include "WM_api.h"
@@ -689,19 +690,8 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot)
ot->prop = prop;
}
-static int object_hook_reset_exec(bContext *C, wmOperator *op)
+void ED_object_hook_reset_do(Object *ob, HookModifierData *hmd)
{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num = RNA_enum_get(op->ptr, "modifier");
- Object *ob = NULL;
- HookModifierData *hmd = NULL;
-
- object_hook_from_context(C, &ptr, num, &ob, &hmd);
- if (hmd == NULL) {
- BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
- return OPERATOR_CANCELLED;
- }
-
/* reset functionality */
if (hmd->object) {
bPoseChannel *pchan = BKE_pose_channel_find_name(hmd->object->pose, hmd->subtarget);
@@ -720,7 +710,23 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->obmat);
}
}
-
+}
+
+static int object_hook_reset_exec(bContext *C, wmOperator *op)
+{
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
+
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
+ return OPERATOR_CANCELLED;
+ }
+
+ ED_object_hook_reset_do(ob, hmd);
+
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);