diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-05-23 13:17:17 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-05-23 13:29:20 +0300 |
commit | 6be9d19951ed460829d379aa90953b14a9f281f2 (patch) | |
tree | 45fe275c232ff0b4fb0e4e7205d53c8fdd6f8e9a /source/blender/collada/BCAnimationSampler.cpp | |
parent | e9cf9e0a397f9589e00d980f0c0489641e7ed57e (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/BCAnimationSampler.cpp')
-rw-r--r-- | source/blender/collada/BCAnimationSampler.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp index ee574e2968b..7b0c6c41a01 100644 --- a/source/blender/collada/BCAnimationSampler.cpp +++ b/source/blender/collada/BCAnimationSampler.cpp @@ -44,8 +44,8 @@ extern "C" { static std::string EMPTY_STRING; static BCAnimationCurveMap BCEmptyAnimationCurves; -BCAnimationSampler::BCAnimationSampler(BlenderContext &blender_context, BCObjectSet &object_set) - : blender_context(blender_context) +BCAnimationSampler::BCAnimationSampler(BCExportSettings &export_settings, BCObjectSet &object_set) + : export_settings(export_settings) { BCObjectSet::iterator it; for (it = object_set.begin(); it != object_set.end(); ++it) { @@ -65,6 +65,7 @@ BCAnimationSampler::~BCAnimationSampler() void BCAnimationSampler::add_object(Object *ob) { + BlenderContext blender_context = export_settings.get_blender_context(); BCAnimation *animation = new BCAnimation(blender_context.get_context(), ob); objects[ob] = animation; @@ -156,6 +157,10 @@ void BCAnimationSampler::update_animation_curves(BCAnimation &animation, BCSample &BCAnimationSampler::sample_object(Object *ob, int frame_index, bool for_opensim) { BCSample &ob_sample = sample_data.add(ob, frame_index); + //if (export_settings.get_apply_global_orientation()) { + // const BCMatrix &global_transform = export_settings.get_global_transform(); + // ob_sample.get_matrix(global_transform); + //} if (ob->type == OB_ARMATURE) { bPoseChannel *pchan; @@ -163,6 +168,7 @@ BCSample &BCAnimationSampler::sample_object(Object *ob, int frame_index, bool fo Bone *bone = pchan->bone; Matrix bmat; if (bc_bone_matrix_local_get(ob, bone, bmat, for_opensim)) { + ob_sample.add_bone_matrix(bone, bmat); } } @@ -170,12 +176,14 @@ BCSample &BCAnimationSampler::sample_object(Object *ob, int frame_index, bool fo return ob_sample; } -void BCAnimationSampler::sample_scene(int sampling_rate, - int keyframe_at_end, - bool for_opensim, - bool keep_keyframes, - BC_export_animation_type export_animation_type) +void BCAnimationSampler::sample_scene(BCExportSettings &export_settings, bool keyframe_at_end) { + BlenderContext blender_context = export_settings.get_blender_context(); + int sampling_rate = export_settings.get_sampling_rate(); + bool for_opensim = export_settings.get_open_sim(); + bool keep_keyframes = export_settings.get_keep_keyframes(); + BC_export_animation_type export_animation_type = export_settings.get_export_animation_type(); + Scene *scene = blender_context.get_scene(); BCFrameSet scene_sample_frames; get_sample_frames(scene_sample_frames, sampling_rate, keyframe_at_end, scene); |