forked from bartvdbraak/blender
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).
This commit is contained in:
parent
ac602142d3
commit
e7f1e1aed1
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -233,7 +233,6 @@ void object_test_constraints(struct Object *owner) {STUB_ASSERT(0);}
|
||||
void ED_armature_ebone_to_mat4(struct EditBone *ebone, float mat[4][4]) {STUB_ASSERT(0);}
|
||||
void ED_object_parent(struct Object *ob, struct Object *par, int type, const char *substr) {STUB_ASSERT(0);}
|
||||
void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con) {STUB_ASSERT(0);}
|
||||
void ED_object_hook_reset_do(struct Object *ob, struct HookModifierData *hmd) {STUB_ASSERT(0);}
|
||||
void ED_node_composit_default(struct bContext *C, struct Scene *scene) {STUB_ASSERT(0);}
|
||||
void *ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *custumdata, int type) {STUB_ASSERT(0); return 0;} /* XXX this one looks weird */
|
||||
void *ED_region_draw_cb_customdata(void *handle) {STUB_ASSERT(0); return 0;} /* XXX This one looks wrong also */
|
||||
|
Loading…
Reference in New Issue
Block a user