Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_time/space_time.c
| Show All 29 Lines | |||||
| #include <string.h> | #include <string.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include "DNA_cachefile_types.h" | #include "DNA_cachefile_types.h" | ||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "DNA_brush_types.h" | |||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_dlrbTree.h" | #include "BLI_dlrbTree.h" | ||||
| ▲ Show 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | |||||
| /* helper for time_draw_keyframes() */ | /* helper for time_draw_keyframes() */ | ||||
| static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel, const unsigned char color[3]) | static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel, const unsigned char color[3]) | ||||
| { | { | ||||
| bDopeSheet ads = {NULL}; | bDopeSheet ads = {NULL}; | ||||
| DLRBT_Tree keys; | DLRBT_Tree keys; | ||||
| ActKeyColumn *ak; | ActKeyColumn *ak; | ||||
| float fac1 = (GS(id->name) == ID_GD) ? 0.8f : 0.6f; /* draw GPencil keys taller, to help distinguish them */ | float fac1; | ||||
| switch (GS(id->name)) { | |||||
| case ID_GD: | |||||
| fac1 = 0.8f; /* draw GPencil keys taller, to help distinguish them */ | |||||
| break; | |||||
| case ID_PAL: | |||||
| fac1 = 0.4f; /* draw palettes shorter, to help distinguish them */ | |||||
| break; | |||||
| default: | |||||
| fac1 = 0.6f; /* default size */ | |||||
| break; | |||||
| } | |||||
| float fac2 = 1.0f - fac1; | float fac2 = 1.0f - fac1; | ||||
| float ymin = v2d->tot.ymin; | float ymin = v2d->tot.ymin; | ||||
| float ymax = v2d->tot.ymax * fac1 + ymin * fac2; | float ymax = v2d->tot.ymax * fac1 + ymin * fac2; | ||||
| /* init binarytree-list for getting keyframes */ | /* init binarytree-list for getting keyframes */ | ||||
| BLI_dlrbTree_init(&keys); | BLI_dlrbTree_init(&keys); | ||||
| /* init dopesheet settings */ | /* init dopesheet settings */ | ||||
| if (onlysel) | if (onlysel) | ||||
| ads.filterflag |= ADS_FILTER_ONLYSEL; | ads.filterflag |= ADS_FILTER_ONLYSEL; | ||||
| /* populate tree with keyframe nodes */ | /* populate tree with keyframe nodes */ | ||||
| switch (GS(id->name)) { | switch (GS(id->name)) { | ||||
| case ID_SCE: | case ID_SCE: | ||||
| scene_to_keylist(&ads, (Scene *)id, &keys, NULL); | scene_to_keylist(&ads, (Scene *)id, &keys, NULL); | ||||
| break; | break; | ||||
| case ID_OB: | case ID_OB: | ||||
| ob_to_keylist(&ads, (Object *)id, &keys, NULL); | ob_to_keylist(&ads, (Object *)id, &keys, NULL); | ||||
| break; | break; | ||||
| case ID_GD: | case ID_GD: | ||||
| gpencil_to_keylist(&ads, (bGPdata *)id, &keys); | gpencil_to_keylist(&ads, (bGPdata *)id, &keys); | ||||
| break; | break; | ||||
| case ID_PAL: | |||||
| palette_to_keylist(&ads, (Palette *)id, &keys, NULL); | |||||
| break; | |||||
| case ID_CF: | case ID_CF: | ||||
| cachefile_to_keylist(&ads, (CacheFile *)id, &keys, NULL); | cachefile_to_keylist(&ads, (CacheFile *)id, &keys, NULL); | ||||
| break; | break; | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| /* build linked-list for searching */ | /* build linked-list for searching */ | ||||
| ▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | static void time_draw_keyframes(const bContext *C, ARegion *ar) | ||||
| UI_GetThemeColor3ubv(TH_TIME_GP_KEYFRAME, color); | UI_GetThemeColor3ubv(TH_TIME_GP_KEYFRAME, color); | ||||
| if (scene->gpd) { | if (scene->gpd) { | ||||
| time_draw_idblock_keyframes(v2d, (ID *)scene->gpd, onlysel, color); | time_draw_idblock_keyframes(v2d, (ID *)scene->gpd, onlysel, color); | ||||
| } | } | ||||
| if (ob && ob->gpd) { | if (ob && ob->gpd) { | ||||
| time_draw_idblock_keyframes(v2d, (ID *)ob->gpd, onlysel, color); | time_draw_idblock_keyframes(v2d, (ID *)ob->gpd, onlysel, color); | ||||
| } | } | ||||
| /* draw keyframes for all palettes */ | |||||
| CTX_DATA_BEGIN(C, Palette *, palette, available_palettes) | |||||
| { | |||||
| time_draw_idblock_keyframes(v2d, (ID *)palette, onlysel, color); | |||||
| } | |||||
| CTX_DATA_END; | |||||
| /* draw scene keyframes first | /* draw scene keyframes first | ||||
| * - don't try to do this when only drawing active/selected data keyframes, | * - don't try to do this when only drawing active/selected data keyframes, | ||||
| * since this can become quite slow | * since this can become quite slow | ||||
| */ | */ | ||||
| if (onlysel == 0) { | if (onlysel == 0) { | ||||
| /* set draw color */ | /* set draw color */ | ||||
| UI_GetThemeColorShade3ubv(TH_TIME_KEYFRAME, -50, color); | UI_GetThemeColorShade3ubv(TH_TIME_KEYFRAME, -50, color); | ||||
| time_draw_idblock_keyframes(v2d, (ID *)scene, onlysel, color); | time_draw_idblock_keyframes(v2d, (ID *)scene, onlysel, color); | ||||
| ▲ Show 20 Lines • Show All 383 Lines • Show Last 20 Lines | |||||