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:
authorNathan Letwory <nathan@letworyinteractive.com>2010-11-17 01:27:31 +0300
committerNathan Letwory <nathan@letworyinteractive.com>2010-11-17 01:27:31 +0300
commite2b3ff502417df4fb7237e0090dcd2f5564e35da (patch)
tree442e7ff27befddfc7cb50aa0fd31a98cee8f0a28 /source/blender/collada
parentb1b02b7a5ef8d4fca6f257d5057bb5993bcf7182 (diff)
Apply patch [#24722] COLLADA exporter: handle instancing
Submitted by Wenzel Jakob Patch adds handling of linked meshes: instead of generating separate geometry objects, use instances.
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/GeometryExporter.cpp5
-rw-r--r--source/blender/collada/GeometryExporter.h3
-rw-r--r--source/blender/collada/collada_internal.cpp2
3 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 1aef6e6489a..7b5b5397955 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -63,6 +63,11 @@ void GeometryExporter::operator()(Object *ob)
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())
+ return;
+ exportedGeometry.insert(geom_id);
+
bool has_color = (bool)CustomData_has_layer(&me->fdata, CD_MCOL);
create_normals(nor, norind, me);
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
index 7a78b676f49..27c837418b1 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -28,6 +28,7 @@
#include <string>
#include <vector>
+#include <set>
#include "COLLADASWStreamWriter.h"
#include "COLLADASWLibraryGeometries.h"
@@ -89,6 +90,8 @@ public:
COLLADASW::URI makeUrl(std::string id);
/* int getTriCount(MFace *faces, int totface);*/
+private:
+ std::set<std::string> exportedGeometry;
};
struct GeometryFunctor {
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index 6f401c1856f..4943aa96546 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -247,7 +247,7 @@ std::string id_name(void *id)
std::string get_geometry_id(Object *ob)
{
- return translate_id(id_name(ob)) + "-mesh";
+ return translate_id(id_name(ob->data)) + "-mesh";
}
std::string get_light_id(Object *ob)