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-16 15:21:03 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2012-05-16 15:21:03 +0400
commit2c051903746735de7e94e7fd2784ffc58a92a203 (patch)
tree0c0c41480e85935ba6a2370390d7762bbef529ed /source/blender/collada/GeometryExporter.cpp
parentb68673f37cbe3732f895d05391a91bea498b8286 (diff)
fix [#31320] Collada now supports import/export of loose edges (edges not attached to faces)
Diffstat (limited to 'source/blender/collada/GeometryExporter.cpp')
-rw-r--r--source/blender/collada/GeometryExporter.cpp61
1 files changed, 60 insertions, 1 deletions
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index ba41e603a29..f92ee1a2b79 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -127,6 +127,7 @@ void GeometryExporter::operator()(Object *ob)
createVertexColorSource(geom_id, me);
// <vertices>
+
COLLADASW::Vertices verts(mSW);
verts.setId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::VERTEX));
COLLADASW::InputList &input_list = verts.getInputList();
@@ -134,6 +135,8 @@ void GeometryExporter::operator()(Object *ob)
input_list.push_back(input);
verts.add();
+ createLooseEdgeList(ob, me, geom_id, norind);
+
// XXX slow
if (ob->totcol) {
for (int a = 0; a < ob->totcol; a++) {
@@ -149,7 +152,7 @@ void GeometryExporter::operator()(Object *ob)
if (me->flag & ME_TWOSIDED) {
mSW->appendTextBlock("<extra><technique profile=\"MAYA\"><double_sided>1</double_sided></technique></extra>");
}
-
+
closeGeometry();
if (this->export_settings->apply_modifiers)
@@ -157,11 +160,65 @@ void GeometryExporter::operator()(Object *ob)
BKE_libblock_free_us(&(G.main->mesh), me);
}
+
#if 0
dm->release(dm);
#endif
}
+
+void GeometryExporter::createLooseEdgeList(Object *ob,
+ Mesh *me,
+ std::string& geom_id,
+ std::vector<Face>& norind)
+{
+
+ MEdge *medges = me->medge;
+ int totedges = me->totedge;
+ int edges_in_linelist = 0;
+ std::vector<unsigned int> edge_list;
+ int index;
+
+ // Find all loose edges in Mesh
+ // and save vertex indices in edge_list
+ for (index = 0; index < totedges; index++)
+ {
+ MEdge *edge = &medges[index];
+
+ if (edge->flag & ME_LOOSEEDGE)
+ {
+ edges_in_linelist += 1;
+ edge_list.push_back(edge->v1);
+ edge_list.push_back(edge->v2);
+ }
+ }
+
+ if (edges_in_linelist > 0)
+ {
+ // Create the list of loose edges
+ COLLADASW::Lines lines(mSW);
+
+ lines.setCount(edges_in_linelist);
+
+
+ COLLADASW::InputList &til = lines.getInputList();
+
+ // creates <input> in <lines> for vertices
+ COLLADASW::Input input1(COLLADASW::InputSemantic::VERTEX, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::VERTEX), 0);
+ til.push_back(input1);
+
+ lines.prepareToAppendValues();
+
+ for (index = 0; index < edges_in_linelist; index++)
+ {
+ lines.appendValues(edge_list[2*index+1]);
+ lines.appendValues(edge_list[2*index]);
+ }
+ lines.finish();
+ }
+
+}
+
// powerful because it handles both cases when there is material and when there's not
void GeometryExporter::createPolylist(short material_index,
bool has_uvs,
@@ -247,6 +304,8 @@ void GeometryExporter::createPolylist(short material_index,
// performs the actual writing
polylist.prepareToAppendValues();
+
+
// <p>
int texindex = 0;