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-02-03 16:04:51 +0400
committergaiaclary <gaia.clary@machinimatrix.org>2014-02-03 16:04:51 +0400
commit89a846df51224ff829b8683dad93024e0b230319 (patch)
treea402b644ac5f373dd6e23bc4430316cd01d3ef61 /source/blender/collada/AnimationImporter.cpp
parent4bd6423b7efdb3a4d1c18d15af3cdc9d7f2e41b7 (diff)
Add compatibility for older Collada files
The Fix in 273 creates a backward incompatibility: Collada files that have been created with an older Blender version will contain the spotlight_size in Radians where Collada wants this value to be in DEGREE. This fix adds a check for the Blender Version that was used to create the Collada file. If the Collada file was made by an older version of Blender then the importer will assume that spotlight_size is specified in RADIANS. Reviewers: campbellbarton, sauraedron Reviewed By: sauraedron CC: jesterking Differential Revision: https://developer.blender.org/D279
Diffstat (limited to 'source/blender/collada/AnimationImporter.cpp')
-rw-r--r--source/blender/collada/AnimationImporter.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 66312f7299f..d27795b0ab2 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -648,12 +648,17 @@ 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 */
+ /* All anim_types whose values are to be converted from Degree to Radians can be ORed here */
+ if (strcmp("spot_size", anim_type)==0) {
+ /* NOTE: Do NOT convert if imported file was made by blender <= 2.69.10
+ * Reason: old blender versions stored spot_size in radians (was a bug)
+ */
+ if (this->import_from_version == "" || BLI_natstrcmp(this->import_from_version.c_str(), "2.69.10") != -1) {
fcurve_deg_to_rad(fcu);
+ }
}
+ /** XXX What About animtype "rotation" ? */
+
BLI_addtail(AnimCurves, fcu);
}
}
@@ -2011,3 +2016,7 @@ void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value)
calchandles_fcurve(fcu);
}
+void AnimationImporter::set_import_from_version(std::string import_from_version)
+{
+ this->import_from_version = import_from_version;
+}