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:
authorGaia Clary <gaia.clary@machinimatrix.org>2012-05-27 02:46:28 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2012-05-27 02:46:28 +0400
commit822362189badefd6c0014f608d36d98e8ab57282 (patch)
tree3f1a8a574aa311b11bbefe5f4191149e659a9f7f /source/blender/collada
parent54b64cfd612922054f014460f1c08ec4b0374a3d (diff)
[#31607] Collada: (Exporter) Implementation of 'use Object Instantiation' Option
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/ArmatureExporter.cpp3
-rw-r--r--source/blender/collada/ExportSettings.h1
-rw-r--r--source/blender/collada/GeometryExporter.cpp10
-rw-r--r--source/blender/collada/SceneExporter.cpp2
-rw-r--r--source/blender/collada/collada.cpp2
-rw-r--r--source/blender/collada/collada.h1
-rw-r--r--source/blender/collada/collada_internal.cpp7
-rw-r--r--source/blender/collada/collada_internal.h2
8 files changed, 22 insertions, 6 deletions
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 38a5e9b5df4..9d59be39f33 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -324,6 +324,7 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
} MDeformWeight;
*/
+ bool use_instantiation = this->export_settings->use_object_instantiation;
Mesh *me = (Mesh*)ob->data;
if (!me->dvert) return;
@@ -331,7 +332,7 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
std::string controller_id = get_controller_id(ob_arm, ob);
openSkin(controller_id, controller_name,
- COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob)));
+ COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, use_instantiation)));
add_bind_shape_mat(ob);
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index b875282ac33..f0d3f810831 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -33,6 +33,7 @@ struct ExportSettings
bool selected;
bool apply_modifiers;
bool include_bone_children;
+ bool use_object_instantiation;
bool second_life;
char *filepath;
};
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index f92ee1a2b79..6df16165e4b 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -92,16 +92,20 @@ void GeometryExporter::operator()(Object *ob)
DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH);
#endif
+ bool use_instantiation = this->export_settings->use_object_instantiation;
Mesh *me = get_mesh(ob, this->export_settings->apply_modifiers);
- std::string geom_id = get_geometry_id(ob);
- std::string geom_name = id_name(ob->data);
+ std::string geom_id = get_geometry_id(ob, use_instantiation);
std::vector<Normal> nor;
std::vector<Face> norind;
// Skip if linked geometry was already exported from another reference
- if (exportedGeometry.find(geom_id) != exportedGeometry.end())
+ if (use_instantiation &&
+ exportedGeometry.find(geom_id) != exportedGeometry.end())
return;
+
+ std::string geom_name = (use_instantiation) ? id_name(ob->data) : id_name(ob);
+
exportedGeometry.insert(geom_id);
bool has_color = (bool)CustomData_has_layer(&me->fdata, CD_MCOL);
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index f79ae2b52a9..83ac496db0e 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -117,7 +117,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
}
else {
COLLADASW::InstanceGeometry instGeom(mSW);
- instGeom.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob)));
+ instGeom.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, this->export_settings->use_object_instantiation)));
InstanceWriter::add_material_bindings(instGeom.getBindMaterial(), ob);
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index c947144412a..951fecec049 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -55,6 +55,7 @@ extern "C"
int selected,
int apply_modifiers,
int include_bone_children,
+ int use_object_instantiation,
int second_life)
{
ExportSettings export_settings;
@@ -63,6 +64,7 @@ extern "C"
export_settings.apply_modifiers = apply_modifiers != 0;
export_settings.include_bone_children = include_bone_children != 0;
export_settings.second_life = second_life != 0;
+ export_settings.use_object_instantiation = use_object_instantiation != 0;
export_settings.filepath = (char *)filepath;
/* annoying, collada crashes if file cant be created! [#27162] */
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index d5c26bb402c..67aaf1ff6c7 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -43,6 +43,7 @@ extern "C" {
int selected,
int apply_modifiers,
int include_bone_children,
+ int use_object_instantiation,
int second_life);
#ifdef __cplusplus
}
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index fa99d460184..81e5f88a3f8 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -251,6 +251,13 @@ std::string get_geometry_id(Object *ob)
return translate_id(id_name(ob->data)) + "-mesh";
}
+std::string get_geometry_id(Object *ob, bool use_instantiation)
+{
+ std::string geom_name = (use_instantiation) ? id_name(ob->data) : id_name(ob);
+
+ return translate_id(geom_name) + "-mesh";
+}
+
std::string get_light_id(Object *ob)
{
return translate_id(id_name(ob)) + "-light";
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index 4f555acb882..d00af791a1f 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -86,7 +86,7 @@ extern std::string translate_id(const std::string &id);
extern std::string id_name(void *id);
-extern std::string get_geometry_id(Object *ob);
+extern std::string get_geometry_id(Object *ob, bool use_instantiation);
extern std::string get_light_id(Object *ob);