diff options
author | Matt Ebb <matt@mke3.net> | 2010-01-25 09:24:05 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-01-25 09:24:05 +0300 |
commit | 0c5998e7998cba70d1dceacc5ed8109a5bba9e23 (patch) | |
tree | f9e250055d9de1647b283e7c493902bc51f0a9a5 /source/blender/editors/animation/keyframing.c | |
parent | c94f385fce14fa5beb8637590ad4d4662cd733c6 (diff) |
Radians -> Degrees (in UI)
Rotations are now stored internally as radians, while exposing degrees in the UI -
in the graph editor and UI controls. This is done in two areas:
1) Using the unit system to convert RNA data to display as degrees in the UI controls
2) FCurves now use degrees for rotation, so you can edit in the graph editor what
you see in the UI.
All rotation data is consistently accessible in DNA and RNA as radians, degrees are only
used for the UI controls and graph editor.
This commit includes conversions will convert old files (stored data and also fcurve data)
to the new units, hopefully everything should go smoothly!
Part of this also changes a few properties that were hard-coded as degrees before (such
as IK pole angle and brush texture rotation) to also use the same consistent system of
radians (dna/rna) and degrees (ui).
Thanks to Joshua for hints and review here too.
Diffstat (limited to 'source/blender/editors/animation/keyframing.c')
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index e042d2731fd..b88592fc66f 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -783,6 +783,11 @@ short insert_keyframe_direct (PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, fl curval= setting_get_rna_value(&ptr, prop, fcu->array_index); } + /* convert to degrees */ + if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) { + curval *= 180.0/M_PI; + } + /* only insert keyframes where they are needed */ if (flag & INSERTKEY_NEEDED) { short insert_mode; @@ -895,6 +900,10 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_ } } + /* mark the curve if it's a new rotation curve */ + if ((fcu->totvert == 0) && (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION)) + fcu->flag |= FCURVE_ROTATION_DEGREES; + /* insert keyframe */ ret += insert_keyframe_direct(ptr, prop, fcu, cfra, flag); } |