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:
Diffstat (limited to 'source/blender/collada/ControllerExporter.cpp')
-rw-r--r--source/blender/collada/ControllerExporter.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index c79a4e1a1f7..adea9fd672a 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -57,7 +57,7 @@ void ControllerExporter::write_bone_URLs(COLLADASW::InstanceController &ins,
Object *ob_arm,
Bone *bone)
{
- if (bc_is_root_bone(bone, this->export_settings->deform_bones_only)) {
+ if (bc_is_root_bone(bone, this->export_settings.get_deform_bones_only())) {
std::string node_id = translate_id(id_name(ob_arm) + "_" + bone->name);
ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, node_id));
}
@@ -89,7 +89,7 @@ bool ControllerExporter::add_instance_controller(Object *ob)
}
InstanceWriter::add_material_bindings(
- ins.getBindMaterial(), ob, this->export_settings->active_uv_only);
+ ins.getBindMaterial(), ob, this->export_settings.get_active_uv_only());
ins.add();
return true;
@@ -102,7 +102,7 @@ void ControllerExporter::export_controllers()
GeometryFunctor gf;
gf.forEachMeshObjectInExportSet<ControllerExporter>(
- sce, *this, this->export_settings->export_set);
+ sce, *this, this->export_settings.get_export_set());
closeLibrary();
}
@@ -115,7 +115,7 @@ void ControllerExporter::operator()(Object *ob)
if (ob_arm) {
export_skin_controller(ob, ob_arm);
}
- if (key && this->export_settings->include_shapekeys) {
+ if (key && this->export_settings.get_include_shapekeys()) {
export_morph_controller(ob, key);
}
}
@@ -189,7 +189,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
} MDeformWeight;
#endif
- bool use_instantiation = this->export_settings->use_object_instantiation;
+ bool use_instantiation = this->export_settings.get_use_object_instantiation();
Mesh *me;
if (((Mesh *)ob->data)->dvert == NULL) {
@@ -198,9 +198,9 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
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 controller_name = id_name(ob_arm);
std::string controller_id = get_controller_id(ob_arm, ob);
@@ -297,14 +297,14 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
void ControllerExporter::export_morph_controller(Object *ob, Key *key)
{
- bool use_instantiation = this->export_settings->use_object_instantiation;
+ bool use_instantiation = this->export_settings.get_use_object_instantiation();
Mesh *me;
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 controller_name = id_name(ob) + "-morph";
std::string controller_id = get_controller_id(key, ob);
@@ -431,9 +431,16 @@ void ControllerExporter::add_bind_shape_mat(Object *ob)
float f_obmat[4][4];
BKE_object_matrix_local_get(ob, f_obmat);
+ if (export_settings.get_apply_global_orientation()) {
+ // do nothing, rotation is going to be applied to the Data
+ }
+ else {
+ bc_add_global_transform(f_obmat, export_settings.get_global_transform());
+ }
+
// UnitConverter::mat4_to_dae_double(bind_mat, ob->obmat);
UnitConverter::mat4_to_dae_double(bind_mat, f_obmat);
- if (this->export_settings->limit_precision)
+ if (this->export_settings.get_limit_precision())
bc_sanitize_mat(bind_mat, LIMITTED_PRECISION);
addBindShapeTransform(bind_mat);
@@ -532,8 +539,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm,
this->export_settings, pchan->bone, bind_mat, pchan->bone->arm_mat, true);
/* SL/OPEN_SIM COMPATIBILITY */
- if (export_settings->open_sim) {
-
+ if (export_settings.get_open_sim()) {
float loc[3];
float rot[3] = {0, 0, 0};
float scale[3];
@@ -547,9 +553,13 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm,
/* make world-space matrix (bind_mat is armature-space) */
mul_m4_m4m4(world, ob_arm->obmat, bind_mat);
+ if (export_settings.get_apply_global_orientation()) {
+ bc_apply_global_transform(world, export_settings.get_global_transform());
+ }
+
invert_m4_m4(mat, world);
UnitConverter::mat4_to_dae(inv_bind_mat, mat);
- if (this->export_settings->limit_precision)
+ if (this->export_settings.get_limit_precision())
bc_sanitize_mat(inv_bind_mat, LIMITTED_PRECISION);
source.appendValues(inv_bind_mat);
}