X-Git-Url: https://git.blender.org/gitweb/gitweb.cgi/blender.git/blobdiff_plain/fab4b907f6ba35f204fa25891024d1a2bdcaeda2..095c8dbe6919857ea322b213a1e240161cd7c843:/source/blender/editors/animation/anim_filter.c diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 0a1a4787eb0..9bd177e1173 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -71,6 +71,7 @@ #include "DNA_world_types.h" #include "DNA_gpencil_types.h" #include "DNA_object_types.h" +#include "DNA_userdef_types.h" #include "MEM_guardedalloc.h" @@ -97,9 +98,30 @@ #include "ED_anim_api.h" #include "ED_markers.h" +#include "UI_resources.h" /* for TH_KEYFRAME_SCALE lookup */ + /* ************************************************************ */ /* Blender Context <-> Animation Context mapping */ +/* ----------- Private Stuff - General -------------------- */ + +/* Get vertical scaling factor (i.e. typically used for keyframe size) */ +static void animedit_get_yscale_factor(bAnimContext *ac) +{ + bTheme *btheme = UI_GetTheme(); + + /* grab scale factor directly from action editor setting + * NOTE: This theme setting doesn't have an ID, as it cannot be accessed normally + * since it is a float, and the theem settings methods can only handle chars. + */ + ac->yscale_fac = btheme->tact.keyframe_scale_fac; + + /* clamp to avoid problems with uninitialised values... */ + if (ac->yscale_fac < 0.1f) + ac->yscale_fac = 1.0f; + //printf("yscale_fac = %f\n", ac->yscale_fac); +} + /* ----------- Private Stuff - Action Editor ------------- */ /* Get shapekey data being edited (for Action Editor -> ShapeKey mode) */ @@ -352,6 +374,9 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) ac->spacetype = (sa) ? sa->spacetype : 0; ac->regiontype = (ar) ? ar->regiontype : 0; + /* initialise default y-scale factor */ + animedit_get_yscale_factor(ac); + /* get data context info */ // XXX: if the below fails, try to grab this info from context instead... (to allow for scripting) return ANIM_animdata_context_getdata(ac);