Merge branch 'master' into blender2.8
[blender.git] / source / blender / collada / ControllerExporter.cpp
index 122094e33a6739c05c5754dd6aee1cbb040068c8..6cb1e58db6ed70beaae9eacd2583b418e09f10bb 100644 (file)
@@ -104,9 +104,10 @@ bool ControllerExporter::add_instance_controller(Object *ob)
        return true;
 }
 
-void ControllerExporter::export_controllers(struct Depsgraph *depsgraph, Scene *sce)
+void ControllerExporter::export_controllers(Main *bmain, Depsgraph *depsgraph, Scene *sce)
 {
        this->depsgraph = depsgraph;
+       m_bmain = bmain;
        scene = sce;
 
        openLibrary();
@@ -198,7 +199,10 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
        bool use_instantiation = this->export_settings->use_object_instantiation;
        Mesh *me;
 
-       me = bc_get_mesh_copy(depsgraph, scene,
+       me = bc_get_mesh_copy(
+                               m_bmain,
+                               depsgraph,
+                               scene,
                                ob,
                                this->export_settings->export_mesh_type,
                                this->export_settings->apply_modifiers,
@@ -289,7 +293,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
        add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id);
        add_vertex_weights_element(weights_source_id, joints_source_id, vcounts, joints);
 
-       BKE_libblock_free_us(G.main, me);
+       BKE_libblock_free_us(m_bmain, me);
 
        closeSkin();
        closeController();
@@ -300,7 +304,10 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
        bool use_instantiation = this->export_settings->use_object_instantiation;
        Mesh *me;
 
-       me = bc_get_mesh_copy(depsgraph, scene,
+       me = bc_get_mesh_copy(
+                               m_bmain,
+                               depsgraph,
+                               scene,
                                ob,
                                this->export_settings->export_mesh_type,
                                this->export_settings->apply_modifiers,
@@ -325,7 +332,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
                                         COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, morph_weights_id)));
        targets.add();
 
-       BKE_libblock_free_us(G.main, me);
+       BKE_libblock_free_us(m_bmain, me);
 
 
        //support for animations