[Bf-blender-cvs] [d4f4c2e5ba2] collada: Refactor Collada: moved Object sampling code into its own private method
Gaia Clary
noreply at git.blender.org
Tue Apr 17 22:38:19 CEST 2018
Commit: d4f4c2e5ba2e3bf8ae1e1ce0fabb1e5669e14e56
Author: Gaia Clary
Date: Tue Apr 17 17:29:18 2018 +0200
Branches: collada
https://developer.blender.org/rBd4f4c2e5ba2e3bf8ae1e1ce0fabb1e5669e14e56
Refactor Collada: moved Object sampling code into its own private method
===================================================================
M source/blender/collada/BCAnimationSampler.cpp
M source/blender/collada/BCAnimationSampler.h
===================================================================
diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp
index bf6c118631c..63195f1c753 100644
--- a/source/blender/collada/BCAnimationSampler.cpp
+++ b/source/blender/collada/BCAnimationSampler.cpp
@@ -148,12 +148,8 @@ void BCAnimationSampler::check_property_is_animated(BCAnimation &animation, floa
}
}
-void BCAnimationSampler::update_animation_curves(BCAnimation &animation, Object *ob, int frame)
+void BCAnimationSampler::update_animation_curves(BCAnimation &animation, BCSample &sample, Object *ob, int frame)
{
- check_property_is_animated(animation, animation.reference->col, ob->col, "color", 4);
-
- BCSample sample(ob);
-
BCAnimationCurveMap::iterator it;
for (it = animation.curve_map.begin(); it != animation.curve_map.end(); ++it) {
const BCCurveKey &key = it->first;
@@ -167,6 +163,23 @@ void BCAnimationSampler::update_animation_curves(BCAnimation &animation, Object
}
}
+BCSample &BCAnimationSampler::sample_object(Object *ob, int frame_index, bool for_opensim)
+{
+ BCSample &ob_sample = sample_data.add(ob, frame_index);
+
+ if (ob->type == OB_ARMATURE) {
+ bPoseChannel *pchan;
+ for (pchan = (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ Bone *bone = pchan->bone;
+ Matrix bmat;
+ if (bc_bone_matrix_local_get(ob, bone, bmat, for_opensim)) {
+ ob_sample.add_bone_matrix(bone, bmat);
+ }
+ }
+ }
+ return ob_sample;
+}
+
void BCAnimationSampler::sample_scene(
Scene *scene,
int sampling_rate,
@@ -209,19 +222,8 @@ void BCAnimationSampler::sample_scene(
needs_update = false;
}
- update_animation_curves(animation, ob, frame_index);
- BCSample &ob_sample = sample_data.add(ob, frame_index);
-
- if (ob->type == OB_ARMATURE) {
- bPoseChannel *pchan;
- for (pchan = (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- Bone *bone = pchan->bone;
- Matrix bmat;
- if (bc_bone_matrix_local_get(ob, bone, bmat, for_opensim)) {
- ob_sample.add_bone_matrix(bone, bmat);
- }
- }
- }
+ BCSample &sample = sample_object(ob, frame_index, for_opensim);
+ update_animation_curves(animation, sample, ob, frame_index);
}
}
}
diff --git a/source/blender/collada/BCAnimationSampler.h b/source/blender/collada/BCAnimationSampler.h
index 2794bb7721c..abf34c65931 100644
--- a/source/blender/collada/BCAnimationSampler.h
+++ b/source/blender/collada/BCAnimationSampler.h
@@ -150,8 +150,8 @@ private:
void initialize_curves(BCAnimationCurveMap &curves, Object *ob);
void initialize_keyframes(BCFrameSet &frameset, Object *ob);
-
- void update_animation_curves(BCAnimation &animation, Object *ob, int frame_index);
+ BCSample &sample_object(Object *ob, int frame_index, bool for_opensim);
+ void update_animation_curves(BCAnimation &animation, BCSample &sample, Object *ob, int frame_index);
void check_property_is_animated(BCAnimation &animation, float *ref, float *val, std::string data_path, int length);
public:
More information about the Bf-blender-cvs
mailing list