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:
authorgaiaclary <gaia.clary@machinimatrix.org>2014-01-31 12:35:00 +0400
committergaiaclary <gaia.clary@machinimatrix.org>2014-01-31 12:35:00 +0400
commitd291d15c193e98ad9fbc05832587bc17a191aa9e (patch)
treedf9b78e0d108015e6bacb759d6364635e5d1aee8 /source/blender/collada
parenta7b1349ce48b9f6a05ec8958f8096a0da2c89f25 (diff)
Fix for T32843
Exported angles for spot size animation is in radians , however Collada expects it to be in degrees. This patch is for fixing import and export, and also renaming a variable Reviewers: gaiaclary Reviewed By: gaiaclary Differential Revision: https://developer.blender.org/D273
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/AnimationExporter.cpp18
-rw-r--r--source/blender/collada/AnimationExporter.h2
-rw-r--r--source/blender/collada/AnimationImporter.cpp6
3 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 7e90f05b519..61a675d4c8f 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -705,7 +705,7 @@ void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNa
}
}
-void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool is_rotation, float *values, int *length)
+void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool is_angle, float *values, int *length)
{
switch (semantic) {
case COLLADASW::InputSemantic::INPUT:
@@ -714,7 +714,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
break;
case COLLADASW::InputSemantic::OUTPUT:
*length = 1;
- if (is_rotation) {
+ if (is_angle) {
values[0] = RAD2DEGF(bezt->vec[1][1]);
}
else {
@@ -730,7 +730,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
values[0] = 0;
values[1] = 0;
}
- else if (is_rotation) {
+ else if (is_angle) {
values[1] = RAD2DEGF(bezt->vec[0][1]);
}
else {
@@ -746,7 +746,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
values[0] = 0;
values[1] = 0;
}
- else if (is_rotation) {
+ else if (is_angle) {
values[1] = RAD2DEGF(bezt->vec[2][1]);
}
else {
@@ -763,10 +763,10 @@ std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemanti
{
std::string source_id = anim_id + get_semantic_suffix(semantic);
- //bool is_rotation = !strcmp(fcu->rna_path, "rotation");
+ //bool is_angle = !strcmp(fcu->rna_path, "rotation");
bool is_angle = false;
- if (strstr(fcu->rna_path, "rotation")) is_angle = true;
+ if (strstr(fcu->rna_path, "rotation") || strstr(fcu->rna_path,"spot_size")) is_angle = true;
COLLADASW::FloatSourceF source(mSW);
source.setId(source_id);
@@ -1196,7 +1196,7 @@ std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type,
std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
{
std::string tm_name;
- bool is_rotation = false;
+ bool is_angle = false;
// when given rna_path, determine tm_type from it
if (rna_path) {
char *name = extract_transform_name(rna_path);
@@ -1228,7 +1228,7 @@ std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, co
case 0:
case 1:
tm_name = "rotation";
- is_rotation = true;
+ is_angle = true;
break;
case 2:
tm_name = "scale";
@@ -1258,7 +1258,7 @@ std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, co
}
if (tm_name.size()) {
- if (is_rotation)
+ if (is_angle)
return tm_name + std::string(axis_name) + ".ANGLE";
else
if (axis_name[0])
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 6c844cf54e6..5e7338aef61 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -140,7 +140,7 @@ protected:
void add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform);
- void get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool is_rotation, float *values, int *length);
+ void get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool is_angle, float *values, int *length);
float* get_eul_source_for_quat(Object *ob );
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 445199dbdef..66312f7299f 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -648,6 +648,12 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
//Add the curves of the current animation to the object
for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
FCurve *fcu = *iter;
+ /* All anim_types whose values are to be converted from Degree to Radians can be ORed here
+ *XXX What About " rotation " ? */
+ if (BLI_strcaseeq("spot_size", anim_type)) {
+ /* Convert current values to Radians */
+ fcurve_deg_to_rad(fcu);
+ }
BLI_addtail(AnimCurves, fcu);
}
}