Fancy procedural icons for Keyframe Types
The new "default keyframe type" dropdown on the timeline header (and also the "Keyframe Type" operator/properties in other places) now has procedurally generated icons which reflect what that keyframe type will look like when rendered in the Dope Sheet. This was achieved using the ancient "VICON" (vector icon) stuff that's lurking around in the dark parts of UI code. From memory, the only other things that use (or used to use) this stuff included some of the triangle icons for some dropdown buttons, or something like that. Notes: * Theme colour changes are reflected immediately by these icons. This is possible because they are all drawn procedurally * These icons scale with the DPI setting. I manually guessed the size of these icons. They can be adjusted further if needed. * I've documented the steps for adding voodoo icons like this on the wiki (http://wiki.blender.org/index.php/Dev:2.7/Source/Checklists/Vector_Icon) * It's true that the rendering of these keyframes doesn't quite fit the rest of the icons in the UI. However, since we're just leveraging the standard keyframe drawing methods (to avoid discreptancies between the two), we'll leave it as such for now. Maybe later we can consider blending in a bit of the glossy keyframe icons in the Icon Sheet?
This commit is contained in:
parent
81e7f6b8a0
commit
6bf9aa3f8e
|
@ -87,7 +87,7 @@ class TIME_HT_header(Header):
|
|||
subsub = row.row(align=True)
|
||||
subsub.prop(toolsettings, "use_record_with_nla", toggle=True)
|
||||
|
||||
layout.prop(toolsettings, "keyframe_type", icon='SPACE2', text="") # xxx: icon...
|
||||
layout.prop(toolsettings, "keyframe_type", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop_search(scene.keying_sets_all, "active", scene, "keying_sets_all", text="")
|
||||
|
|
|
@ -1015,3 +1015,8 @@ DEF_VICO(MOVE_UP_VEC)
|
|||
DEF_VICO(MOVE_DOWN_VEC)
|
||||
DEF_VICO(X_VEC)
|
||||
DEF_VICO(SMALL_TRI_RIGHT_VEC)
|
||||
|
||||
DEF_VICO(KEYTYPE_KEYFRAME_VEC)
|
||||
DEF_VICO(KEYTYPE_BREAKDOWN_VEC)
|
||||
DEF_VICO(KEYTYPE_EXTREME_VEC)
|
||||
DEF_VICO(KEYTYPE_JITTER_VEC)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "BLI_fileops_types.h"
|
||||
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_dynamicpaint_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
@ -62,6 +63,7 @@
|
|||
#include "BIF_glutil.h"
|
||||
|
||||
#include "ED_datafiles.h"
|
||||
#include "ED_keyframes_draw.h"
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
@ -461,6 +463,54 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)
|
|||
glDisable(GL_LINE_SMOOTH);
|
||||
}
|
||||
|
||||
static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha, short key_type)
|
||||
{
|
||||
/* init dummy theme state for Action Editor - where these colors are defined
|
||||
* (since we're doing this offscreen, free from any particular space_id)
|
||||
*/
|
||||
struct bThemeState theme_state;
|
||||
int xco, yco;
|
||||
|
||||
UI_Theme_Store(&theme_state);
|
||||
UI_SetTheme(SPACE_ACTION, RGN_TYPE_WINDOW);
|
||||
|
||||
/* the "x" and "y" given are the bottom-left coordinates of the icon,
|
||||
* while the draw_keyframe_shape() function needs the midpoint for
|
||||
* the keyframe
|
||||
*/
|
||||
xco = x + w / 2;
|
||||
yco = y + h / 2;
|
||||
|
||||
/* draw keyframe
|
||||
* - xscale: 1.0 (since there's no timeline scaling to compensate for)
|
||||
* - yscale: 0.3 * h (found out experimentally... dunno why!)
|
||||
* - sel: true (so that "keyframe" state shows the iconic yellow icon)
|
||||
*/
|
||||
draw_keyframe_shape(xco, yco, 1.0f, 0.3f * h, true, key_type, KEYFRAME_SHAPE_BOTH, alpha);
|
||||
|
||||
UI_Theme_Restore(&theme_state);
|
||||
}
|
||||
|
||||
static void vicon_keytype_keyframe_draw(int x, int y, int w, int h, float alpha)
|
||||
{
|
||||
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_KEYFRAME);
|
||||
}
|
||||
|
||||
static void vicon_keytype_breakdown_draw(int x, int y, int w, int h, float alpha)
|
||||
{
|
||||
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_BREAKDOWN);
|
||||
}
|
||||
|
||||
static void vicon_keytype_extreme_draw(int x, int y, int w, int h, float alpha)
|
||||
{
|
||||
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_EXTREME);
|
||||
}
|
||||
|
||||
static void vicon_keytype_jitter_draw(int x, int y, int w, int h, float alpha)
|
||||
{
|
||||
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_JITTER);
|
||||
}
|
||||
|
||||
#ifndef WITH_HEADLESS
|
||||
|
||||
static void init_brush_icons(void)
|
||||
|
@ -686,6 +736,11 @@ static void init_internal_icons(void)
|
|||
def_internal_vicon(VICO_MOVE_DOWN_VEC, vicon_move_down_draw);
|
||||
def_internal_vicon(VICO_X_VEC, vicon_x_draw);
|
||||
def_internal_vicon(VICO_SMALL_TRI_RIGHT_VEC, vicon_small_tri_right_draw);
|
||||
|
||||
def_internal_vicon(VICO_KEYTYPE_KEYFRAME_VEC, vicon_keytype_keyframe_draw);
|
||||
def_internal_vicon(VICO_KEYTYPE_BREAKDOWN_VEC, vicon_keytype_breakdown_draw);
|
||||
def_internal_vicon(VICO_KEYTYPE_EXTREME_VEC, vicon_keytype_extreme_draw);
|
||||
def_internal_vicon(VICO_KEYTYPE_JITTER_VEC, vicon_keytype_jitter_draw);
|
||||
|
||||
IMB_freeImBuf(b16buf);
|
||||
IMB_freeImBuf(b32buf);
|
||||
|
|
|
@ -70,10 +70,10 @@ EnumPropertyItem rna_enum_fmodifier_type_items[] = {
|
|||
};
|
||||
|
||||
EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = {
|
||||
{BEZT_KEYTYPE_KEYFRAME, "KEYFRAME", 0, "Keyframe", "Normal keyframe - e.g. for key poses"},
|
||||
{BEZT_KEYTYPE_BREAKDOWN, "BREAKDOWN", 0, "Breakdown", "A breakdown pose - e.g. for transitions between key poses"},
|
||||
{BEZT_KEYTYPE_EXTREME, "EXTREME", 0, "Extreme", "An 'extreme' pose, or some other purpose as needed"},
|
||||
{BEZT_KEYTYPE_JITTER, "JITTER", 0, "Jitter", "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
|
||||
{BEZT_KEYTYPE_KEYFRAME, "KEYFRAME", VICO_KEYTYPE_KEYFRAME_VEC, "Keyframe", "Normal keyframe - e.g. for key poses"},
|
||||
{BEZT_KEYTYPE_BREAKDOWN, "BREAKDOWN", VICO_KEYTYPE_BREAKDOWN_VEC, "Breakdown", "A breakdown pose - e.g. for transitions between key poses"},
|
||||
{BEZT_KEYTYPE_EXTREME, "EXTREME", VICO_KEYTYPE_EXTREME_VEC, "Extreme", "An 'extreme' pose, or some other purpose as needed"},
|
||||
{BEZT_KEYTYPE_JITTER, "JITTER", VICO_KEYTYPE_JITTER_VEC, "Jitter", "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue