diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-10-16 00:15:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-10-16 00:15:45 +0400 |
commit | e7f1e1aed1a9a83763baaccc26498ad5aa1b5757 (patch) | |
tree | 084946867904c80add5ee7ba16df2206af747bd1 /source/blender | |
parent | ac602142d3a50157f91d9106dfbf2b39814ac648 (diff) |
edits to r60777 - move ED_object_hook_reset_do into BKE object (if RNA needs to call ED_* functions its a hint they might be better in BKE).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 22 | ||||
-rw-r--r-- | source/blender/editors/include/ED_object.h | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_hook.c | 24 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 5 |
5 files changed, 28 insertions, 29 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index e99eb2a64f2..434175624b7 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -48,6 +48,7 @@ struct rctf; struct MovieClip; struct Main; struct RigidBodyWorld; +struct HookModifierData; void BKE_object_workob_clear(struct Object *workob); void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob); @@ -66,6 +67,8 @@ void BKE_object_update_base_layer(struct Scene *scene, struct Object *ob); void BKE_object_free(struct Object *ob); void BKE_object_free_derived_caches(struct Object *ob); +void BKE_object_modifier_hook_reset(struct Object *ob, struct HookModifierData *hmd); + bool BKE_object_support_modifier_type_check(struct Object *ob, int modifier_type); void BKE_object_link_modifiers(struct Object *ob, struct Object *from); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 8c2475369de..94744866a17 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -194,6 +194,28 @@ void BKE_object_free_modifiers(Object *ob) BKE_object_free_softbody(ob); } +void BKE_object_modifier_hook_reset(Object *ob, HookModifierData *hmd) +{ + /* reset functionality */ + if (hmd->object) { + bPoseChannel *pchan = BKE_pose_channel_find_name(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 */ + mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat); + + invert_m4_m4(imat, mat); + mul_m4_m4m4(hmd->parentinv, imat, ob->obmat); + } + else { + invert_m4_m4(hmd->object->imat, hmd->object->obmat); + mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->obmat); + } + } +} + bool BKE_object_support_modifier_type_check(Object *ob, int modifier_type) { ModifierTypeInfo *mti; diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 13fdbf374bb..0d11108d81f 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -219,9 +219,6 @@ struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( int *free, const unsigned int selection_mask); -/* object_hook.c */ -void ED_object_hook_reset_do(struct Object *ob, struct HookModifierData *hmd); - #ifdef __cplusplus } #endif diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index d6f3bf0c262..7f97aa0b4c1 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -690,28 +690,6 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot) ot->prop = prop; } -void ED_object_hook_reset_do(Object *ob, HookModifierData *hmd) -{ - /* reset functionality */ - if (hmd->object) { - bPoseChannel *pchan = BKE_pose_channel_find_name(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 */ - mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat); - - invert_m4_m4(imat, mat); - mul_m4_m4m4(hmd->parentinv, imat, ob->obmat); - } - else { - invert_m4_m4(hmd->object->imat, hmd->object->obmat); - 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); @@ -725,7 +703,7 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - ED_object_hook_reset_do(ob, hmd); + BKE_object_modifier_hook_reset(ob, hmd); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index ca3ebff5455..57eeba61a73 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -118,10 +118,9 @@ EnumPropertyItem modifier_type_items[] = { #include "BKE_depsgraph.h" #include "BKE_library.h" #include "BKE_modifier.h" +#include "BKE_object.h" #include "BKE_particle.h" -#include "ED_object.h" - static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { UVProjectModifierData *uvp = (UVProjectModifierData *)ptr->data; @@ -543,7 +542,7 @@ 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); + BKE_object_modifier_hook_reset((Object *)ptr->id.data, hmd); } static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRNA value) |