[Bf-blender-cvs] [e441aaa0d75] collada: Refactor: Renamed classes, updated comments for better reading
Gaia Clary
noreply at git.blender.org
Tue Apr 17 22:38:16 CEST 2018
Commit: e441aaa0d7563bf708bbc9d9d614018eb420b9d1
Author: Gaia Clary
Date: Tue Apr 17 13:35:09 2018 +0200
Branches: collada
https://developer.blender.org/rBe441aaa0d7563bf708bbc9d9d614018eb420b9d1
Refactor: Renamed classes, updated comments for better reading
===================================================================
M source/blender/collada/AnimationExporter.cpp
M source/blender/collada/BCAnimationCurve.cpp
M source/blender/collada/BCAnimationCurve.h
M source/blender/collada/BCAnimationSampler.cpp
M source/blender/collada/BCAnimationSampler.h
M source/blender/collada/BCSampleData.h
===================================================================
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 9b9d56329fa..4f1a1e653b1 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -271,14 +271,14 @@ BCAnimationCurve *AnimationExporter::get_modified_export_curve(Object *ob, BCAni
/* Create an xfov curve */
- CurveKey key(BC_ANIMATION_TYPE_CAMERA, "xfov", 0);
+ BCCurveKey key(BC_ANIMATION_TYPE_CAMERA, "xfov", 0);
mcurve = new BCAnimationCurve(ob, key);
// now tricky part: transform the fcurve
const BCValueMap &lens_values = curve.get_value_map();
BCAnimationCurve *sensor_curve = NULL;
- CurveKey sensor_key(BC_ANIMATION_TYPE_CAMERA, "sensor_width", 0);
+ BCCurveKey sensor_key(BC_ANIMATION_TYPE_CAMERA, "sensor_width", 0);
BCAnimationCurveMap::iterator cit = curves.find(sensor_key);
if (cit != curves.end()) {
sensor_curve = cit->second;
diff --git a/source/blender/collada/BCAnimationCurve.cpp b/source/blender/collada/BCAnimationCurve.cpp
index f16ce25e44a..9b46c72c8fa 100644
--- a/source/blender/collada/BCAnimationCurve.cpp
+++ b/source/blender/collada/BCAnimationCurve.cpp
@@ -47,7 +47,7 @@ BCAnimationCurve::BCAnimationCurve(const BCAnimationCurve &other)
get_edit_fcurve();
}
-BCAnimationCurve::BCAnimationCurve(Object *ob, const CurveKey &key)
+BCAnimationCurve::BCAnimationCurve(Object *ob, const BCCurveKey &key)
{
this->curve_key = key;
this->fcurve = NULL;
@@ -573,7 +573,7 @@ inline bool operator< (const BCAnimationCurve& lhs, const BCAnimationCurve& rhs)
return lhtgt < rhtgt;
}
-CurveKey::CurveKey()
+BCCurveKey::BCCurveKey()
{
this->key_type = BC_ANIMATION_TYPE_OBJECT;
this->rna_path = "";
@@ -581,7 +581,7 @@ CurveKey::CurveKey()
this->curve_subindex = -1;
}
-CurveKey::CurveKey(const BC_animation_type type, const std::string path, const int array_index, const int subindex)
+BCCurveKey::BCCurveKey(const BC_animation_type type, const std::string path, const int array_index, const int subindex)
{
this->key_type = type;
this->rna_path = path;
@@ -589,7 +589,7 @@ CurveKey::CurveKey(const BC_animation_type type, const std::string path, const i
this->curve_subindex = subindex;
}
-void CurveKey::operator=(const CurveKey &other)
+void BCCurveKey::operator=(const BCCurveKey &other)
{
this->key_type = other.key_type;
this->rna_path = other.rna_path;
@@ -597,37 +597,37 @@ void CurveKey::operator=(const CurveKey &other)
this->curve_subindex = other.curve_subindex;
}
-const std::string CurveKey::get_full_path() const
+const std::string BCCurveKey::get_full_path() const
{
return this->rna_path + '[' + std::to_string(this->curve_array_index) + ']';
}
-const std::string CurveKey::get_path() const
+const std::string BCCurveKey::get_path() const
{
return this->rna_path;
}
-const int CurveKey::get_array_index() const
+const int BCCurveKey::get_array_index() const
{
return this->curve_array_index;
}
-const int CurveKey::get_subindex() const
+const int BCCurveKey::get_subindex() const
{
return this->curve_subindex;
}
-void CurveKey::set_object_type(BC_animation_type object_type)
+void BCCurveKey::set_object_type(BC_animation_type object_type)
{
this->key_type = object_type;
}
-const BC_animation_type CurveKey::get_animation_type() const
+const BC_animation_type BCCurveKey::get_animation_type() const
{
return this->key_type;
}
-const bool CurveKey::operator<(const CurveKey &other) const
+const bool BCCurveKey::operator<(const BCCurveKey &other) const
{
/* needed for using this class as key in maps and sets */
if (this->key_type != other.key_type)
diff --git a/source/blender/collada/BCAnimationCurve.h b/source/blender/collada/BCAnimationCurve.h
index 1b83c9c7c92..f1ca48a1b38 100644
--- a/source/blender/collada/BCAnimationCurve.h
+++ b/source/blender/collada/BCAnimationCurve.h
@@ -56,7 +56,7 @@ typedef enum BC_animation_type {
BC_ANIMATION_TYPE_LIGHT
} BC_animation_type;
-class CurveKey {
+class BCCurveKey {
private:
BC_animation_type key_type;
std::string rna_path;
@@ -65,16 +65,16 @@ private:
public:
- CurveKey();
- CurveKey(const BC_animation_type type, const std::string path, const int array_index, const int subindex = -1);
- void operator=(const CurveKey &other);
+ BCCurveKey();
+ BCCurveKey(const BC_animation_type type, const std::string path, const int array_index, const int subindex = -1);
+ void operator=(const BCCurveKey &other);
const std::string get_full_path() const;
const std::string get_path() const;
const int get_array_index() const;
const int get_subindex() const;
void set_object_type(BC_animation_type object_type);
const BC_animation_type get_animation_type() const;
- const bool operator<(const CurveKey &other) const;
+ const bool operator<(const BCCurveKey &other) const;
};
@@ -95,7 +95,7 @@ public:
class BCAnimationCurve {
private:
- CurveKey curve_key;
+ BCCurveKey curve_key;
BCValueMap samples;
float min = 0;
float max = 0;
@@ -111,7 +111,7 @@ private:
public:
BCAnimationCurve();
BCAnimationCurve(const BCAnimationCurve &other);
- BCAnimationCurve(Object *ob, const CurveKey &key);
+ BCAnimationCurve(Object *ob, const BCCurveKey &key);
~BCAnimationCurve();
const bool is_of_animation_type(BC_animation_type type) const;
@@ -150,6 +150,6 @@ public:
};
-typedef std::map<CurveKey, BCAnimationCurve *> BCAnimationCurveMap;
+typedef std::map<BCCurveKey, BCAnimationCurve *> BCAnimationCurveMap;
#endif
\ No newline at end of file
diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp
index fe72780b883..4cee7a7b1eb 100644
--- a/source/blender/collada/BCAnimationSampler.cpp
+++ b/source/blender/collada/BCAnimationSampler.cpp
@@ -139,7 +139,7 @@ void BCAnimationSampler::check_property_is_animated(BCAnimation &animation, floa
{
for (int array_index =0; array_index < length; ++array_index) {
if (!bc_in_range(ref[length], val[length], 0.00001)) {
- CurveKey key(BC_ANIMATION_TYPE_OBJECT, data_path, array_index);
+ BCCurveKey key(BC_ANIMATION_TYPE_OBJECT, data_path, array_index);
BCAnimationCurveMap::iterator it = animation.curve_map.find(key);
if (it == animation.curve_map.end()) {
animation.curve_map[key] = new BCAnimationCurve(animation.reference, key);
@@ -156,7 +156,7 @@ void BCAnimationSampler::update_animation_curves(BCAnimation &animation, Object
BCAnimationCurveMap::iterator it;
for (it = animation.curve_map.begin(); it != animation.curve_map.end(); ++it) {
- const CurveKey &key = it->first;
+ const BCCurveKey &key = it->first;
BCAnimationCurve *curve = it->second;
if (curve->is_transform_curve()) {
curve->add_value_from_matrix(sample, frame);
@@ -396,7 +396,7 @@ void BCAnimationSampler::add_value_set(
void BCAnimationSampler::generate_transform(
Object *ob,
- const CurveKey &key,
+ const BCCurveKey &key,
BCAnimationCurveMap &curves)
{
BCAnimationCurveMap::const_iterator it = curves.find(key);
@@ -411,15 +411,15 @@ void BCAnimationSampler::generate_transforms(
const BC_animation_type type,
BCAnimationCurveMap &curves)
{
- generate_transform(ob, CurveKey(type, prep+"location", 0), curves);
- generate_transform(ob, CurveKey(type, prep+"location", 1), curves);
- generate_transform(ob, CurveKey(type, prep+"location", 2), curves);
- generate_transform(ob, CurveKey(type, prep+"rotation_euler", 0), curves);
- generate_transform(ob, CurveKey(type, prep+"rotation_euler", 1), curves);
- generate_transform(ob, CurveKey(type, prep+"rotation_euler", 2), curves);
- generate_transform(ob, CurveKey(type, prep+"scale", 0), curves);
- generate_transform(ob, CurveKey(type, prep+"scale", 1), curves);
- generate_transform(ob, CurveKey(type, prep+"scale", 2), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"location", 0), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"location", 1), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"location", 2), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"rotation_euler", 0), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"rotation_euler", 1), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"rotation_euler", 2), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"scale", 0), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"scale", 1), curves);
+ generate_transform(ob, BCCurveKey(type, prep+"scale", 2), curves);
}
void BCAnimationSampler::generate_transforms(Object *ob, Bone *bone, BCAnimationCurveMap &curves)
@@ -467,7 +467,7 @@ void BCAnimationSampler::initialize_curves(BCAnimationCurveMap &curves, Object *
}
/* Adding action curves on object */
- CurveKey key(object_type, fcu->rna_path, fcu->array_index);
+ BCCurveKey key(object_type, fcu->rna_path, fcu->array_index);
curves[key] = new BCAnimationCurve(ob, key);
}
}
@@ -496,7 +496,7 @@ void BCAnimationSampler::initialize_curves(BCAnimationCurveMap &curves, Object *
/* Add lamp action or Camera action */
FCurve *fcu = (FCurve *)action->curves.first;
for (; fcu; fcu = fcu->next) {
- CurveKey key(object_type, fcu->rna_path, fcu->array_index);
+ BCCurveKey key(object_type, fcu->rna_path, fcu->array_index);
curves[key] = new BCAnimationCurve(ob, key);
}
}
@@ -512,7 +512,7 @@ void BCAnimationSampler::initialize_curves(BCAnimationCurveMap &curves, Object *
/* isMatAnim = true; */
FCurve *fcu = (FCurve *)action->curves.first;
for (; fcu; fcu = fcu->next) {
- CurveKey key(object_type, fcu->rna_path, fcu->array_index, a);
+ BCCurveKey key(object_type, fcu->rna_path, fcu->array_index, a);
curves[key] = new BCAnimationCurve(ob, key);
}
}
@@ -568,7 +568,7 @@ BCSample &BCSampleFrame::add(Object *ob)
/* Get the matrix for the given key, returns Unity when the key does not exist */
const BCSample *BCSampleFrame::get_sample(Object *ob) const
{
- BCSampleKeysMap::const_iterator it = sampleMap.find(ob);
+ BCSampleMap::const_iterator it = sampleMap.find(ob);
if (it == sampleMap.end()) {
return NULL;
}
@@ -577,7 +577,7 @@ const BCSample *BCSampleFrame::get_sample(Object *ob) const
const BCMa
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list