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>2019-05-23 13:17:17 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2019-05-23 13:29:20 +0300
commit6be9d19951ed460829d379aa90953b14a9f281f2 (patch)
tree45fe275c232ff0b4fb0e4e7205d53c8fdd6f8e9a /source/blender/collada/GeometryExporter.cpp
parente9cf9e0a397f9589e00d980f0c0489641e7ed57e (diff)
Collada exporter update
Added new feature: Collada: global axis rotation upon export (UI) The new feature allows to specify the target rest coordinate system upon export. This allows for example to export a character that is in Blender orientation (Y forward) to match the Secondlife orientation where (-X forward) - Refactor:Added new utility methods to collada_utils Made BCMatrix class more powerfull moved Blender related structures into new BlenderContext class added class wrapper to encapsulate ExportSettings structure Added blender context getters to ExportSettings added access methods to BlenderContext into ExportSettings class Moved class BCMatrix into BlenderContext moved utility functions from collada_util into BlenderContext replace own function for parenting by a call to ED_object_parent_set() - Cleanup: removed obsolete parameters from methods renamed parameters for better understanding cleanup whitespace and indentation removed obsolete comments
Diffstat (limited to 'source/blender/collada/GeometryExporter.cpp')
-rw-r--r--source/blender/collada/GeometryExporter.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index bda6fec70a8..5125a9a0562 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -48,19 +48,20 @@ void GeometryExporter::exportGeom()
openLibrary();
GeometryFunctor gf;
- gf.forEachMeshObjectInExportSet<GeometryExporter>(sce, *this, this->export_settings->export_set);
+ gf.forEachMeshObjectInExportSet<GeometryExporter>(
+ sce, *this, this->export_settings.get_export_set());
closeLibrary();
}
void GeometryExporter::operator()(Object *ob)
{
- bool use_instantiation = this->export_settings->use_object_instantiation;
+ bool use_instantiation = this->export_settings.get_use_object_instantiation();
Mesh *me = bc_get_mesh_copy(blender_context,
ob,
- this->export_settings->export_mesh_type,
- this->export_settings->apply_modifiers,
- this->export_settings->triangulate);
+ this->export_settings.get_export_mesh_type(),
+ this->export_settings.get_apply_modifiers(),
+ this->export_settings.get_triangulate());
std::string geom_id = get_geometry_id(ob, use_instantiation);
std::vector<Normal> nor;
@@ -128,7 +129,7 @@ void GeometryExporter::operator()(Object *ob)
closeGeometry();
- if (this->export_settings->include_shapekeys) {
+ if (this->export_settings.get_include_shapekeys()) {
Key *key = BKE_key_from_object(ob);
if (key) {
KeyBlock *kb = (KeyBlock *)key->block.first;
@@ -380,14 +381,14 @@ void GeometryExporter::create_mesh_primitive_list(short material_index,
int active_uv_index = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV);
for (int i = 0; i < num_layers; i++) {
int layer_index = CustomData_get_layer_index_n(&me->ldata, CD_MLOOPUV, i);
- if (!this->export_settings->active_uv_only || layer_index == active_uv_index) {
+ if (!this->export_settings.get_active_uv_only() || layer_index == active_uv_index) {
// char *name = CustomData_get_layer_name(&me->ldata, CD_MLOOPUV, i);
COLLADASW::Input texcoord_input(
COLLADASW::InputSemantic::TEXCOORD,
- makeUrl(makeTexcoordSourceId(geom_id, i, this->export_settings->active_uv_only)),
+ makeUrl(makeTexcoordSourceId(geom_id, i, this->export_settings.get_active_uv_only())),
2, // this is only until we have optimized UV sets
- (this->export_settings->active_uv_only) ? 0 : layer_index - 1 /* set (0,1,2,...) */
+ (this->export_settings.get_active_uv_only()) ? 0 : layer_index - 1 /* set (0,1,2,...) */
);
til.push_back(texcoord_input);
}
@@ -466,7 +467,14 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
/* appends data to <float_array> */
int i = 0;
for (i = 0; i < totverts; i++) {
- source.appendValues(verts[i].co[0], verts[i].co[1], verts[i].co[2]);
+ Vector co;
+ if (export_settings.get_apply_global_orientation()) {
+ bc_add_global_transform(co, verts[i].co, export_settings.get_global_transform());
+ }
+ else {
+ copy_v3_v3(co, verts[i].co);
+ }
+ source.appendValues(co[0], co[1], co[2]);
}
source.finish();
@@ -547,12 +555,12 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
int active_uv_index = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV);
for (int a = 0; a < num_layers; a++) {
int layer_index = CustomData_get_layer_index_n(&me->ldata, CD_MLOOPUV, a);
- if (!this->export_settings->active_uv_only || layer_index == active_uv_index) {
+ if (!this->export_settings.get_active_uv_only() || layer_index == active_uv_index) {
MLoopUV *mloops = (MLoopUV *)CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, a);
COLLADASW::FloatSourceF source(mSW);
std::string layer_id = makeTexcoordSourceId(
- geom_id, a, this->export_settings->active_uv_only);
+ geom_id, a, this->export_settings.get_active_uv_only());
source.setId(layer_id);
source.setArrayId(layer_id + ARRAY_ID_SUFFIX);
@@ -606,7 +614,12 @@ void GeometryExporter::createNormalsSource(std::string geom_id, Mesh *me, std::v
std::vector<Normal>::iterator it;
for (it = nor.begin(); it != nor.end(); it++) {
Normal &n = *it;
- source.appendValues(n.x, n.y, n.z);
+
+ Vector no{n.x, n.y, n.z};
+ if (export_settings.get_apply_global_orientation()) {
+ bc_add_global_transform(no, export_settings.get_global_transform());
+ }
+ source.appendValues(no[0], no[1], no[2]);
}
source.finish();