Commit: 54f9cd52835bdd96cdd01cf643cfccf8a229c04b Author: Bastien Montagne Date: Wed Jun 6 15:50:24 2018 +0200 Branches: master https://developer.blender.org/rB54f9cd52835bdd96cdd01cf643cfccf8a229c04b
Cleanup: Nuke moar G.main usages... =================================================================== M source/blender/collada/ArmatureExporter.cpp M source/blender/collada/ArmatureExporter.h M source/blender/collada/ArmatureImporter.cpp M source/blender/collada/ArmatureImporter.h M source/blender/collada/DocumentExporter.cpp M source/blender/collada/DocumentExporter.h M source/blender/collada/SceneExporter.cpp M source/blender/collada/SceneExporter.h M source/blender/collada/collada.cpp M source/blender/collada/collada.h M source/blender/editors/armature/armature_edit.c M source/blender/editors/armature/armature_relations.c M source/blender/editors/armature/armature_utils.c M source/blender/editors/armature/editarmature_retarget.c M source/blender/editors/armature/pose_transform.c M source/blender/editors/curve/editcurve.c M source/blender/editors/include/ED_armature.h M source/blender/editors/include/ED_curve.h M source/blender/editors/include/ED_object.h M source/blender/editors/include/ED_screen.h M source/blender/editors/io/io_collada.c M source/blender/editors/object/object_constraint.c M source/blender/editors/object/object_edit.c M source/blender/editors/object/object_hook.c M source/blender/editors/object/object_modifier.c M source/blender/editors/object/object_transform.c M source/blender/editors/screen/screen_edit.c M source/blender/editors/screen/screen_ops.c M source/blender/editors/space_file/filelist.c M source/blender/makesrna/intern/rna_armature.c M source/blender/makesrna/intern/rna_object.c M source/blender/windowmanager/intern/wm.c M source/blender/windowmanager/intern/wm_files.c M source/blender/windowmanager/intern/wm_window.c M source/blenderplayer/bad_level_call_stubs/stubs.c =================================================================== diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 92ec8b470a8..9afe4662f74 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -62,10 +62,11 @@ ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSett } // write bone nodes -void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce, +void ArmatureExporter::add_armature_bones(bContext *C, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects) { + Main *bmain = CTX_data_main(C); // write bone nodes bArmature * armature = (bArmature *)ob_arm->data; @@ -77,11 +78,11 @@ void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce, for (Bone *bone = (Bone *)armature->bonebase.first; bone; bone = bone->next) { // start from root bones if (!bone->parent) - add_bone_node(bone, ob_arm, sce, se, child_objects); + add_bone_node(C, bone, ob_arm, sce, se, child_objects); } if (!is_edited) { - ED_armature_from_edit(armature); + ED_armature_from_edit(bmain, armature); ED_armature_edit_free(armature); } } @@ -160,7 +161,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O #endif // parent_mat is armature-space -void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce, +void ArmatureExporter::add_bone_node(bContext *C, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects) { @@ -234,7 +235,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce, mul_m4_m4m4((*i)->parentinv, temp, (*i)->parentinv); } - se->writeNodes(*i, sce); + se->writeNodes(C, *i, sce); copy_m4_m4((*i)->parentinv, backup_parinv); child_objects.erase(i++); @@ -243,13 +244,13 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce, } for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { - add_bone_node(child, ob_arm, sce, se, child_objects); + add_bone_node(C, child, ob_arm, sce, se, child_objects); } node.end(); } else { for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { - add_bone_node(child, ob_arm, sce, se, child_objects); + add_bone_node(C, child, ob_arm, sce, se, child_objects); } } } diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h index d271b505aa9..3199703cb20 100644 --- a/source/blender/collada/ArmatureExporter.h +++ b/source/blender/collada/ArmatureExporter.h @@ -60,7 +60,7 @@ public: ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings); // write bone nodes - void add_armature_bones(Object *ob_arm, Scene *sce, SceneExporter *se, + void add_armature_bones(bContext *C, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects); bool add_instance_controller(Object *ob); @@ -85,7 +85,7 @@ private: // Scene, SceneExporter and the list of child_objects // are required for writing bone parented objects - void add_bone_node(Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, + void add_bone_node(bContext *C, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects); void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node); diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index c32a2a7034e..964f1f6b9e4 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -446,7 +446,7 @@ ArmatureJoints& ArmatureImporter::get_armature_joints(Object *ob_arm) return armature_joints.back(); } #endif -void ArmatureImporter::create_armature_bones(std::vector<Object *> &ob_arms) +void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *> &ob_arms) { std::vector<COLLADAFW::Node *>::iterator ri; std::vector<std::string> layer_labels; @@ -479,7 +479,7 @@ void ArmatureImporter::create_armature_bones(std::vector<Object *> &ob_arms) } /* exit armature edit mode to populate the Armature object */ - ED_armature_from_edit(armature); + ED_armature_from_edit(bmain, armature); ED_armature_edit_free(armature); ED_armature_to_edit(armature); @@ -487,7 +487,7 @@ void ArmatureImporter::create_armature_bones(std::vector<Object *> &ob_arms) fix_leaf_bone_hierarchy(armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation); unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm; - ED_armature_from_edit(armature); + ED_armature_from_edit(bmain, armature); ED_armature_edit_free(armature); int index = std::find(ob_arms.begin(), ob_arms.end(), ob_arm) - ob_arms.begin(); @@ -499,7 +499,7 @@ void ArmatureImporter::create_armature_bones(std::vector<Object *> &ob_arms) } } -Object *ArmatureImporter::create_armature_bones(SkinInfo& skin) +Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo& skin) { // just do like so: // - get armature @@ -617,7 +617,7 @@ Object *ArmatureImporter::create_armature_bones(SkinInfo& skin) } /* exit armature edit mode to populate the Armature object */ - ED_armature_from_edit(armature); + ED_armature_from_edit(bmain, armature); ED_armature_edit_free(armature); ED_armature_to_edit(armature); @@ -625,7 +625,7 @@ Object *ArmatureImporter::create_armature_bones(SkinInfo& skin) connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX); } fix_leaf_bone_hierarchy(armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation); - ED_armature_from_edit(armature); + ED_armature_from_edit(bmain, armature); ED_armature_edit_free(armature); DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA); @@ -707,6 +707,7 @@ void ArmatureImporter::add_root_joint(COLLADAFW::Node *node) // here we add bones to armatures, having armatures previously created in write_controller void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &objects_to_scale) { + Main *bmain = CTX_data_main(C); std::vector<Object *> ob_arms; std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it; @@ -716,7 +717,7 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object SkinInfo& skin = it->second; - Object *ob_arm = create_armature_bones(skin); + Object *ob_arm = create_armature_bones(bmain, skin); // link armature with a mesh object const COLLADAFW::UniqueId &uid = skin.get_controller_uid(); @@ -757,7 +758,7 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object } //for bones without skins - create_armature_bones(ob_arms); + create_armature_bones(bmain, ob_arms); // Fix bone relations std::vector<Object *>::iterator ob_arm_it; @@ -771,7 +772,7 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object fix_parent_connect(armature, (Bone *)armature->bonebase.first); - ED_armature_from_edit(armature); + ED_armature_from_edit(bmain, armature); ED_armature_edit_free(armature); } } diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index 17173f157e5..fbce14f1b05 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -129,8 +129,8 @@ private: ArmatureJoints& get_armature_joints(Object *ob_arm); #endif - Object *create_armature_bones(SkinInfo& skin); - void create_armature_bones(std::vector<Object *> &arm_objs); + Object *create_armature_bones(Main *bmain, SkinInfo& skin); + void create_armature_bones(Main *bmain, std::vector<Object *> &arm_objs); /** TagsMap typedef for uid_tags_map. */ typedef std::map<std::string, ExtraTags*> TagsMap; diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index d4eb6b477db..472bd326205 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -181,7 +181,7 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char * // COLLADA allows this through multiple <channel>s in <animation>. // For this to work, we need to know objects that use a certain action. -int DocumentExporter::exportCurrentScene(const EvaluationContext *eval_ctx, Scene *sce) +int DocumentExporter::exportCurrentScene(bContext *C, const EvaluationContext *eval_ctx, Scene *sce) { PointerRNA sceneptr, unit_settings; PropertyRNA *system; /* unused , *scale; */ @@ -307,7 +307,7 @@ int DocumentExporter::exportCurrentScene(const EvaluationContext *eval_ctx, Scen AnimationExporter ae(writer, this->export_settings); ae.exportAnimations(sce); } - se.exportScene(sce); + se.exportScene(C, sce); // <scene> std::string scene_name(translate_id(id_name(sce))); diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h index 60e5deb0e31..817df3735da 100644 --- a/source/blender/collada/DocumentExporter.h +++ b/source/blender/collada/DocumentExporter.h @@ -40,7 +40,7 @@ class DocumentExporter { public: DocumentExporter(const ExportSettings *export_settings); - int exportCurrentScene(const EvaluationContext *eval_ctx, Scene *sce); + int exportCurrentScene(bContext *C, const EvaluationContext *eval_ctx, Scene *sce); void exportScenes(const char *filename); private: const ExportSettings *export_settings; diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index 5a0badf8d3a..c195ecb4725 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -38,17 +38,17 @@ SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, { } -void SceneExporter::exportScene(Scene *sce) +void SceneExporter::expo @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs