diff options
Diffstat (limited to 'source/blender/collada/ControllerExporter.cpp')
-rw-r--r-- | source/blender/collada/ControllerExporter.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index 5673d33fcbf..1a58bc9d1b8 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -98,17 +98,15 @@ bool ControllerExporter::add_instance_controller(Object *ob) write_bone_URLs(ins, ob_arm, bone); } - InstanceWriter::add_material_bindings(ins.getBindMaterial(), - ob, - this->export_settings->active_uv_only, - this->export_settings->export_texture_type); + InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob, this->export_settings->active_uv_only); ins.add(); return true; } -void ControllerExporter::export_controllers(Main *bmain, Scene *sce) +void ControllerExporter::export_controllers(Main *bmain, Depsgraph *depsgraph, Scene *sce) { + this->depsgraph = depsgraph; m_bmain = bmain; scene = sce; @@ -201,16 +199,18 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) bool use_instantiation = this->export_settings->use_object_instantiation; Mesh *me; + if (((Mesh *)ob->data)->dvert == NULL) { + return; + } + me = bc_get_mesh_copy( - m_bmain, + depsgraph, scene, ob, this->export_settings->export_mesh_type, this->export_settings->apply_modifiers, this->export_settings->triangulate); - if (!me->dvert) return; - std::string controller_name = id_name(ob_arm); std::string controller_id = get_controller_id(ob_arm, ob); @@ -294,7 +294,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(m_bmain, me); + BKE_id_free(NULL, me); closeSkin(); closeController(); @@ -306,7 +306,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key) Mesh *me; me = bc_get_mesh_copy( - m_bmain, + depsgraph, scene, ob, this->export_settings->export_mesh_type, @@ -332,8 +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(m_bmain, me); - + BKE_id_free(NULL, me); //support for animations //can also try the base element and param alternative @@ -502,7 +501,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas // put armature in rest position if (!(arm->flag & ARM_RESTPOS)) { arm->flag |= ARM_RESTPOS; - BKE_pose_where_is(scene, ob_arm); + BKE_pose_where_is(depsgraph, scene, ob_arm); } for (bDeformGroup *def = (bDeformGroup *)defbase->first; def; def = def->next) { @@ -550,7 +549,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas // back from rest positon if (!(flag & ARM_RESTPOS)) { arm->flag = flag; - BKE_pose_where_is(scene, ob_arm); + BKE_pose_where_is(depsgraph, scene, ob_arm); } source.finish(); |