Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/AnimationExporter.h1
-rw-r--r--source/blender/collada/ArmatureImporter.cpp4
-rw-r--r--source/blender/collada/ControllerExporter.cpp13
-rw-r--r--source/blender/collada/DocumentExporter.cpp2
-rw-r--r--source/blender/collada/DocumentImporter.cpp13
-rw-r--r--source/blender/collada/GeometryExporter.cpp10
-rw-r--r--source/blender/collada/SceneExporter.h1
-rw-r--r--source/blender/collada/SkinInfo.cpp3
-rw-r--r--source/blender/collada/collada_utils.cpp28
-rw-r--r--source/blender/collada/collada_utils.h3
10 files changed, 30 insertions, 48 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/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 2f5c3237bf6..d3370172f60 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -882,7 +882,7 @@ void ArmatureImporter::make_shape_keys(bContext *C)
//insert basis key
kb = BKE_keyblock_add_ctime(key, "Basis", false);
- BKE_keyblock_convert_from_mesh(source_me, kb);
+ BKE_keyblock_convert_from_mesh(source_me, key, kb);
//insert other shape keys
for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
@@ -896,7 +896,7 @@ void ArmatureImporter::make_shape_keys(bContext *C)
std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), false);
- BKE_keyblock_convert_from_mesh(me, kb);
+ BKE_keyblock_convert_from_mesh(me, key, kb);
//apply weights
weight = morphWeights.getFloatValues()->getData()[i];
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/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index c6ba3b8f4ac..a382b7cca9c 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -232,11 +232,6 @@ void DocumentImporter::finish()
objects_to_scale->insert(objects_to_scale->end(), objects_done->begin(), objects_done->end());
delete objects_done;
}
-
- // update scene
- DEG_relations_tag_update(bmain);
- WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
-
}
@@ -245,7 +240,6 @@ void DocumentImporter::finish()
armature_importer.set_tags_map(this->uid_tags_map);
armature_importer.make_armatures(mContext, *objects_to_scale);
armature_importer.make_shape_keys(mContext);
- DEG_relations_tag_update(bmain);
#if 0
armature_importer.fix_animation();
@@ -269,13 +263,16 @@ void DocumentImporter::finish()
BKE_scene_collections_object_remove(bmain, sce, ob, true);
}
libnode_ob.clear();
-
- DEG_relations_tag_update(bmain);
}
bc_match_scale(objects_to_scale, unit_converter, !this->import_settings->import_units);
delete objects_to_scale;
+
+ // update scene
+ DEG_id_tag_update(&sce->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
}
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/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
index b07c6518050..8046efd2335 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -242,9 +242,6 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique
invert_m4_m4(ob->parentinv, workob.obmat);
DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA);
-
- DEG_relations_tag_update(bmain);
- WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
#endif
copy_m4_m4(ob->obmat, bind_shape_matrix);
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 4ded9bd2d86..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"
@@ -128,12 +128,6 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
DEG_id_tag_update(&par->id, OB_RECALC_OB);
- /** done once after import */
-#if 0
- DEG_relations_tag_update(bmain);
- WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
-#endif
-
return true;
}
@@ -166,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:
{
@@ -185,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);