diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-10-15 18:54:12 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-10-15 18:54:12 +0400 |
commit | 22c019a96261a37ef2af439cdab60ae4cd210882 (patch) | |
tree | 1b92ca3187baf5d6aaef09c2f886dcc975d4ecc7 /source/blender/makesrna | |
parent | ef60ab19f792c6d9a328e1eca8ad4c8d20940377 (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/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 34f138cd7c5..ca3ebff5455 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -120,6 +120,8 @@ EnumPropertyItem modifier_type_items[] = { #include "BKE_modifier.h" #include "BKE_particle.h" +#include "ED_object.h" + static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { UVProjectModifierData *uvp = (UVProjectModifierData *)ptr->data; @@ -536,6 +538,14 @@ static int rna_MultiresModifier_filepath_length(PointerRNA *ptr) return strlen((external) ? external->filename : ""); } +static void rna_HookModifier_object_set(PointerRNA *ptr, PointerRNA value) +{ + HookModifierData *hmd = ptr->data; + + hmd->object = (Object *)value.data; + ED_object_hook_reset_do((Object *)ptr->id.data, hmd); +} + static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRNA value) { Object *ob = value.data; @@ -1434,6 +1444,7 @@ static void rna_def_modifier_hook(BlenderRNA *brna) prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Object", "Parent Object for hook, also recalculates and clears offset"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); + RNA_def_property_pointer_funcs(prop, NULL, "rna_HookModifier_object_set", NULL, NULL); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); |