forked from bartvdbraak/blender
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.
This commit is contained in:
parent
b1b02b7a5e
commit
e2b3ff5024
@ -63,6 +63,11 @@ void GeometryExporter::operator()(Object *ob)
|
|||||||
std::vector<Normal> nor;
|
std::vector<Normal> nor;
|
||||||
std::vector<Face> norind;
|
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);
|
bool has_color = (bool)CustomData_has_layer(&me->fdata, CD_MCOL);
|
||||||
|
|
||||||
create_normals(nor, norind, me);
|
create_normals(nor, norind, me);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "COLLADASWStreamWriter.h"
|
#include "COLLADASWStreamWriter.h"
|
||||||
#include "COLLADASWLibraryGeometries.h"
|
#include "COLLADASWLibraryGeometries.h"
|
||||||
@ -89,6 +90,8 @@ public:
|
|||||||
COLLADASW::URI makeUrl(std::string id);
|
COLLADASW::URI makeUrl(std::string id);
|
||||||
|
|
||||||
/* int getTriCount(MFace *faces, int totface);*/
|
/* int getTriCount(MFace *faces, int totface);*/
|
||||||
|
private:
|
||||||
|
std::set<std::string> exportedGeometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GeometryFunctor {
|
struct GeometryFunctor {
|
||||||
|
@ -247,7 +247,7 @@ std::string id_name(void *id)
|
|||||||
|
|
||||||
std::string get_geometry_id(Object *ob)
|
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)
|
std::string get_light_id(Object *ob)
|
||||||
|
Loading…
Reference in New Issue
Block a user