diff options
Diffstat (limited to 'source/blender/collada')
-rw-r--r-- | source/blender/collada/AnimationExporter.h | 1 | ||||
-rw-r--r-- | source/blender/collada/ControllerExporter.cpp | 13 | ||||
-rw-r--r-- | source/blender/collada/DocumentExporter.cpp | 2 | ||||
-rw-r--r-- | source/blender/collada/GeometryExporter.cpp | 10 | ||||
-rw-r--r-- | source/blender/collada/SceneExporter.h | 1 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 22 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.h | 3 |
7 files changed, 23 insertions, 29 deletions
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 67468458f81..04cd78af830 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -42,7 +42,6 @@ extern "C" #include "BLI_listbase.h" #include "BLI_utildefines.h" -#include "BKE_DerivedMesh.h" #include "BKE_fcurve.h" #include "BKE_animsys.h" #include "BKE_scene.h" diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index 6cb1e58db6e..1a58bc9d1b8 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -199,8 +199,11 @@ 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, @@ -208,8 +211,6 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) 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); @@ -293,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(); @@ -305,7 +306,6 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key) Mesh *me; me = bc_get_mesh_copy( - m_bmain, depsgraph, scene, ob, @@ -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 diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 541f84f96f5..cc4ecd5649b 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -85,11 +85,11 @@ extern "C" #include "BLI_listbase.h" #include "BLI_utildefines.h" -#include "BKE_DerivedMesh.h" #include "BKE_action.h" // pose functions #include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_blender_version.h" +#include "BKE_customdata.h" #include "BKE_fcurve.h" #include "BKE_global.h" #include "BKE_image.h" diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index f59be97b545..fae1fc048c8 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -40,7 +40,6 @@ extern "C" { #include "BLI_utildefines.h" - #include "BKE_DerivedMesh.h" #include "BKE_main.h" #include "BKE_global.h" #include "BKE_library.h" @@ -72,14 +71,8 @@ void GeometryExporter::exportGeom(Main *bmain, struct Depsgraph *depsgraph, Scen void GeometryExporter::operator()(Object *ob) { - // XXX don't use DerivedMesh, Mesh instead? -#if 0 - DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH); -#endif - bool use_instantiation = this->export_settings->use_object_instantiation; Mesh *me = bc_get_mesh_copy( - m_bmain, mDepsgraph, mScene, ob, @@ -170,8 +163,7 @@ void GeometryExporter::operator()(Object *ob) } } - BKE_libblock_free_us(m_bmain, me); - + BKE_id_free(NULL, me); } void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb) diff --git a/source/blender/collada/SceneExporter.h b/source/blender/collada/SceneExporter.h index 91f98063020..f7d56701961 100644 --- a/source/blender/collada/SceneExporter.h +++ b/source/blender/collada/SceneExporter.h @@ -48,7 +48,6 @@ extern "C" { #include "DNA_modifier_types.h" #include "DNA_userdef_types.h" -#include "BKE_DerivedMesh.h" #include "BKE_fcurve.h" #include "BKE_animsys.h" #include "BLI_path_util.h" diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 22ddeb4edb7..86824800378 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -51,8 +51,8 @@ extern "C" { #include "BKE_global.h" #include "BKE_layer.h" #include "BKE_mesh.h" +#include "BKE_mesh_runtime.h" #include "BKE_scene.h" -#include "BKE_DerivedMesh.h" #include "BKE_main.h" #include "ED_armature.h" @@ -160,13 +160,13 @@ Object *bc_add_object(Main *bmain, Scene *scene, ViewLayer *view_layer, int type } Mesh *bc_get_mesh_copy( - Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate) + Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate) { - Mesh *tmpmesh; CustomDataMask mask = CD_MASK_MESH; Mesh *mesh = (Mesh *)ob->data; - DerivedMesh *dm = NULL; + Mesh *tmpmesh = NULL; if (apply_modifiers) { +#if 0 /* Not supported by new system currently... */ switch (export_mesh_type) { case BC_MESH_TYPE_VIEW: { @@ -179,14 +179,20 @@ Mesh *bc_get_mesh_copy( break; } } +#else + tmpmesh = mesh_get_eval_final(depsgraph, scene, ob, mask); +#endif } else { - dm = mesh_create_derived((Mesh *)ob->data, NULL); + tmpmesh = mesh; } - tmpmesh = BKE_mesh_add(bmain, "ColladaMesh"); // name is not important here - DM_to_mesh(dm, tmpmesh, ob, CD_MASK_MESH, true); - tmpmesh->flag = mesh->flag; + BKE_id_copy_ex(NULL, &tmpmesh->id, (ID **)&tmpmesh, + LIB_ID_CREATE_NO_MAIN | + LIB_ID_CREATE_NO_USER_REFCOUNT | + LIB_ID_CREATE_NO_DEG_TAG | + LIB_ID_COPY_NO_PREVIEW, + false); if (triangulate) { bc_triangulate_mesh(tmpmesh); diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index de9167efb07..89a5379d3c7 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -51,7 +51,6 @@ extern "C" { #include "BKE_context.h" #include "BKE_object.h" -#include "BKE_DerivedMesh.h" #include "BKE_scene.h" #include "BKE_idprop.h" } @@ -73,7 +72,7 @@ extern int bc_test_parent_loop(Object *par, Object *ob); extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space = true); extern Object *bc_add_object(Main *bmain, Scene *scene, ViewLayer *view_layer, int type, const char *name); extern Mesh *bc_get_mesh_copy( - Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate); + Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate); extern Object *bc_get_assigned_armature(Object *ob); extern Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob); |