Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/collada/collada_utils.cpp
| Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||
| bool bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) | bool bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| int partype = PAR_OBJECT; | int partype = PAR_OBJECT; | ||||
| const bool xmirror = false; | const bool xmirror = false; | ||||
| const bool keep_transform = false; | const bool keep_transform = false; | ||||
| if (par && is_parent_space) { | if (par && is_parent_space) { | ||||
| mul_m4_m4m4(ob->obmat, par->obmat, ob->obmat); | mul_m4_m4m4(ob->object_to_world, par->object_to_world, ob->object_to_world); | ||||
| } | } | ||||
| bool ok = ED_object_parent_set( | bool ok = ED_object_parent_set( | ||||
| nullptr, C, scene, ob, par, partype, xmirror, keep_transform, nullptr); | nullptr, C, scene, ob, par, partype, xmirror, keep_transform, nullptr); | ||||
| return ok; | return ok; | ||||
| } | } | ||||
| std::vector<bAction *> bc_getSceneActions(const bContext *C, Object *ob, bool all_actions) | std::vector<bAction *> bc_getSceneActions(const bContext *C, Object *ob, bool all_actions) | ||||
| ▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | while ((pos = data.find(pattern, pos)) != std::string::npos) { | ||||
| pos += replacement.length(); | pos += replacement.length(); | ||||
| } | } | ||||
| return data; | return data; | ||||
| } | } | ||||
| void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene) | void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene) | ||||
| { | { | ||||
| if (scale_to_scene) { | if (scale_to_scene) { | ||||
| mul_m4_m4m4(ob->obmat, bc_unit.get_scale(), ob->obmat); | mul_m4_m4m4(ob->object_to_world, bc_unit.get_scale(), ob->object_to_world); | ||||
| } | } | ||||
| mul_m4_m4m4(ob->obmat, bc_unit.get_rotation(), ob->obmat); | mul_m4_m4m4(ob->object_to_world, bc_unit.get_rotation(), ob->object_to_world); | ||||
| BKE_object_apply_mat4(ob, ob->obmat, false, false); | BKE_object_apply_mat4(ob, ob->object_to_world, false, false); | ||||
| } | } | ||||
| void bc_match_scale(std::vector<Object *> *objects_done, | void bc_match_scale(std::vector<Object *> *objects_done, | ||||
| UnitConverter &bc_unit, | UnitConverter &bc_unit, | ||||
| bool scale_to_scene) | bool scale_to_scene) | ||||
| { | { | ||||
| for (Object *ob : *objects_done) { | for (Object *ob : *objects_done) { | ||||
| if (ob->parent == nullptr) { | if (ob->parent == nullptr) { | ||||
| ▲ Show 20 Lines • Show All 1,026 Lines • Show Last 20 Lines | |||||