diff options
Diffstat (limited to 'source/blender/editors/space_time')
-rw-r--r-- | source/blender/editors/space_time/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/editors/space_time/SConscript | 5 | ||||
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 37 | ||||
-rw-r--r-- | source/blender/editors/space_time/time_intern.h | 1 |
4 files changed, 35 insertions, 12 deletions
diff --git a/source/blender/editors/space_time/CMakeLists.txt b/source/blender/editors/space_time/CMakeLists.txt index b42ae3ab725..90af405eaa8 100644 --- a/source/blender/editors/space_time/CMakeLists.txt +++ b/source/blender/editors/space_time/CMakeLists.txt @@ -22,10 +22,12 @@ set(INC ../include ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -39,4 +41,6 @@ set(SRC time_intern.h ) +add_definitions(${GL_DEFINITIONS}) + blender_add_lib(bf_editor_space_time "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_time/SConscript b/source/blender/editors/space_time/SConscript index bf1b918f4f1..86437b9c258 100644 --- a/source/blender/editors/space_time/SConscript +++ b/source/blender/editors/space_time/SConscript @@ -31,15 +31,18 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../../blenkernel', '../../blenlib', + '../../gpu', '../../makesdna', '../../makesrna', '../../windowmanager', ] defs = [] +defs += env['BF_GL_DEFINITIONS'] env.BlenderLib('bf_editors_space_time', sources, incs, defs, libtype=['core'], priority=[65]) diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 88c57d45b79..9ecea7462ff 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -32,6 +32,7 @@ #include <string.h> #include <stdio.h> +#include "DNA_gpencil_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -57,6 +58,7 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "UI_interface.h" #include "ED_space_api.h" #include "ED_markers.h" @@ -89,13 +91,12 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d) fdrawline((float)PEFRA, v2d->cur.ymin, (float)PEFRA, v2d->cur.ymax); } -#define CACHE_DRAW_HEIGHT 3.0f - static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) { PTCacheID *pid; ListBase pidlist; SpaceTimeCache *stc = stime->caches.first; + const float cache_draw_height = (4.0f * UI_DPI_FAC * U.pixelsize); float yoffs = 0.f; if (!(stime->cache_display & TIME_CACHE_DISPLAY) || (!ob)) @@ -171,7 +172,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) glPushMatrix(); glTranslatef(0.0, (float)V2D_SCROLL_HEIGHT + yoffs, 0.0); - glScalef(1.0, CACHE_DRAW_HEIGHT, 0.0); + glScalef(1.0, cache_draw_height, 0.0); switch (pid->type) { case PTCACHE_TYPE_SOFTBODY: @@ -229,7 +230,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) glPopMatrix(); - yoffs += CACHE_DRAW_HEIGHT; + yoffs += cache_draw_height; stc = stc->next; } @@ -295,13 +296,19 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel) DLRBT_Tree keys; ActKeyColumn *ak; + float fac1 = (GS(id->name) == ID_GD) ? 0.8f : 0.6f; /* draw GPencil keys taller, to help distinguish them */ + float fac2 = 1.0f - fac1; + + float ymin = v2d->tot.ymin; + float ymax = v2d->tot.ymax * fac1 + ymin * fac2; + /* init binarytree-list for getting keyframes */ BLI_dlrbTree_init(&keys); /* init dopesheet settings */ if (onlysel) ads.filterflag |= ADS_FILTER_ONLYSEL; - + /* populate tree with keyframe nodes */ switch (GS(id->name)) { case ID_SCE: @@ -310,6 +317,9 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel) case ID_OB: ob_to_keylist(&ads, (Object *)id, &keys, NULL); break; + case ID_GD: + gpencil_to_keylist(&ads, (bGPdata *)id, &keys); + break; } /* build linked-list for searching */ @@ -325,8 +335,8 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel) (ak) && (ak->cfra <= v2d->cur.xmax); ak = ak->next) { - glVertex2f(ak->cfra, v2d->tot.ymin); - glVertex2f(ak->cfra, v2d->tot.ymax); + glVertex2f(ak->cfra, ymin); + glVertex2f(ak->cfra, ymax); } glEnd(); // GL_LINES @@ -339,16 +349,23 @@ static void time_draw_keyframes(const bContext *C, ARegion *ar) { Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); + bGPdata *gpd = CTX_data_gpencil_data(C); View2D *v2d = &ar->v2d; bool onlysel = ((scene->flag & SCE_KEYS_NO_SELONLY) == 0); + /* draw grease pencil keyframes (if available) */ + if (gpd) { + UI_ThemeColor(TH_TIME_GP_KEYFRAME); + time_draw_idblock_keyframes(v2d, (ID *)gpd, onlysel); + } + /* draw scene keyframes first * - don't try to do this when only drawing active/selected data keyframes, * since this can become quite slow */ if (onlysel == 0) { /* set draw color */ - glColor3ub(0xDD, 0xA7, 0x00); + UI_ThemeColorShade(TH_TIME_KEYFRAME, -50); time_draw_idblock_keyframes(v2d, (ID *)scene, onlysel); } @@ -357,7 +374,7 @@ static void time_draw_keyframes(const bContext *C, ARegion *ar) * OR the onlysel flag was set, which means that only active object's keyframes should * be considered */ - glColor3ub(0xDD, 0xD7, 0x00); + UI_ThemeColor(TH_TIME_KEYFRAME); if (ob && ((ob->mode == OB_MODE_POSE) || onlysel)) { /* draw keyframes for active object only */ @@ -520,7 +537,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) /* markers */ UI_view2d_view_orthoSpecial(ar, v2d, 1); - draw_markers_time(C, 0); + ED_markers_draw(C, 0); /* caches */ time_draw_cache(stime, obact, scene); diff --git a/source/blender/editors/space_time/time_intern.h b/source/blender/editors/space_time/time_intern.h index ce52cbbd65e..ced36b2ac2d 100644 --- a/source/blender/editors/space_time/time_intern.h +++ b/source/blender/editors/space_time/time_intern.h @@ -34,7 +34,6 @@ /* internal exports only */ -struct wmWindowManager; /* time_ops.c */ void time_operatortypes(void); |