[Bf-blender-cvs] [25949123923] collada: Refactor Collada: simplified API
Gaia Clary
noreply at git.blender.org
Fri Mar 30 18:40:47 CEST 2018
Commit: 25949123923430f66c51ba38129de8d914284ed1
Author: Gaia Clary
Date: Fri Mar 30 17:35:32 2018 +0200
Branches: collada
https://developer.blender.org/rB25949123923430f66c51ba38129de8d914284ed1
Refactor Collada: simplified API
replaced methods from BCAnimationCurveContainer:
BCSample &add(Object *ob, Matrix &mat);
BCSample &add(Object *ob, Bone *bone, Matrix &mat);
BCSample &add(Object *ob, Matrix &mat, int frame_index);
BCSample &add(Object *ob, Bone *bone, Matrix &mat, int frame_index);
by much simpler methods:
BCSample &add(Object *ob);
BCSample &add(Object *ob, int frame_index);
===================================================================
M source/blender/collada/BCAnimationCurveContainer.cpp
M source/blender/collada/BCAnimationCurveContainer.h
===================================================================
diff --git a/source/blender/collada/BCAnimationCurveContainer.cpp b/source/blender/collada/BCAnimationCurveContainer.cpp
index 935a2c4900f..05ee5d97e18 100644
--- a/source/blender/collada/BCAnimationCurveContainer.cpp
+++ b/source/blender/collada/BCAnimationCurveContainer.cpp
@@ -143,17 +143,15 @@ void BCAnimationSampler::sample_scene(
needs_update = false;
}
- Matrix mat;
- BKE_object_matrix_local_get(ob, mat);
- BCSample &ob_sample = sample_data.add(ob, mat, 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;
- if (bone_matrix_local_get(ob, bone, mat, for_opensim)) {
- ob_sample.set_bone(bone, mat);
- //sample_data.add(ob, bone, mat, frame_index);
+ Matrix bmat;
+ if (bone_matrix_local_get(ob, bone, bmat, for_opensim)) {
+ ob_sample.set_bone(bone, bmat);
}
}
}
@@ -607,21 +605,13 @@ bool BCAnimationSampler::has_animations(Scene *sce, LinkNode *export_set)
}
/* ==================================================================== */
-BCSample &BCSampleFrame::add(Object *ob, Matrix &mat)
+BCSample &BCSampleFrame::add(Object *ob)
{
BCSample *sample = new BCSample(ob);
sampleMap[ob] = sample;
return *sample;
}
-/* Add a new Bone to this map with the given Matrix*/
-BCSample &BCSampleFrame::add(Object *ob, Bone *bone, Matrix &mat)
-{
- BCSample *sample = sampleMap[ob];
- sample->set_bone(bone, mat);
- return *sample;
-}
-
/* Get the matrix for the given key, returns Unity when the key does not exist */
const BCSample *BCSampleFrame::get_sample(Object *ob) const
{
@@ -676,21 +666,13 @@ const BCSampleKeysMap &BCSampleFrame::get_samples() const
/* ==================================================================== */
-/* Add object for frame. Creates a new BCSampleFrame if it does not yet exist */
-BCSample &BCSampleFrames::add(Object *ob, Matrix &mat, int frame_index)
+BCSample &BCSampleFrames::add(Object *ob, int frame_index)
{
BCSampleFrame &frame = sample_frames[frame_index];
- return frame.add(ob, mat);
+ return frame.add(ob);
}
-/* Add object+bone for frame. Creates a new BCSampleFrame if it does not yet exist */
-BCSample &BCSampleFrames::add(Object *ob, Bone *bone, Matrix &mat, int frame_index)
-{
- BCSampleFrame &frame = sample_frames[frame_index];
- return frame.add(ob, bone, mat);
-}
-
/* ====================================================== */
/* Below are the getters which we need to export the data */
/* ====================================================== */
@@ -758,7 +740,6 @@ const int BCSampleFrames::get_matrices(Object *ob, BCMatrixSampleMap &samples) c
{
samples.clear(); // safety;
BCSampleFrameMap::const_iterator it;
- float *qref = nullptr; // needed only when decomposing
for (it = sample_frames.begin(); it != sample_frames.end(); ++it) {
const BCSampleFrame &frame = it->second;
const BCMatrix *matrix = frame.get_sample_matrix(ob);
diff --git a/source/blender/collada/BCAnimationCurveContainer.h b/source/blender/collada/BCAnimationCurveContainer.h
index 942f17ae8fc..1b417206379 100644
--- a/source/blender/collada/BCAnimationCurveContainer.h
+++ b/source/blender/collada/BCAnimationCurveContainer.h
@@ -80,8 +80,7 @@ public:
/* Add a new Object to this map with the given Matrix*/
/* Add a new Bone to this map with the given Matrix*/
/* Add a new Material to this map with the given Matrix*/
- BCSample &add(Object *ob, Matrix &mat);
- BCSample &add(Object *ob, Bone *bone, Matrix &mat);
+ BCSample &add(Object *ob);
/* Get the matrix for the given key, returns Unity when the key does not exist */
/* Get the matrix for the given Object, returns Unity when the Objewct is not sampled */
@@ -147,8 +146,7 @@ public:
/* Add object for frame. Creates a new BCSampleFrame if it does not yet exist */
/* Add object+bone for frame. Creates a new BCSampleFrame if it does not yet exist */
- BCSample &add(Object *ob, Matrix &mat, int frame_index);
- BCSample &add(Object *ob, Bone *bone, Matrix &mat, int frame_index);
+ BCSample &add(Object *ob, int frame_index);
/* ====================================================== */
/* Below are the getters which we need to export the data */
More information about the Bf-blender-cvs
mailing list