diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 13 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_userdef.c | 5 | ||||
-rw-r--r-- | source/blender/editors/include/UI_view2d.h | 10 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 72 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d_draw.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_action/space_action.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_nla/space_nla.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 9 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 5 |
14 files changed, 57 insertions, 92 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 62700d0647f..e76e3ed8fe0 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -39,7 +39,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 14 +#define BLENDER_FILE_SUBVERSION 15 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and show a warning if the file diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index fb22a88c28e..95440f78cd2 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -678,6 +678,19 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 300, 15)) { + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype == SPACE_SEQ) { + SpaceSeq *sseq = (SpaceSeq *)sl; + sseq->flag |= SEQ_SHOW_GRID; + } + } + } + } + } + /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 10b24532014..6b54600f915 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -183,7 +183,7 @@ static void blo_update_defaults_screen(bScreen *screen, else if (area->spacetype == SPACE_SEQ) { SpaceSeq *seq = area->spacedata.first; seq->flag |= SEQ_SHOW_MARKERS | SEQ_SHOW_FCURVES | SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | - SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_NAME | SEQ_SHOW_STRIP_DURATION; + SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_NAME | SEQ_SHOW_STRIP_DURATION | SEQ_SHOW_GRID; seq->render_size = SEQ_RENDER_SIZE_PROXY_100; seq->flag |= SEQ_USE_PROXIES; diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 152dcbed6a4..c409f0a71fc 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -286,6 +286,11 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) FROM_DEFAULT_V4_UCHAR(space_spreadsheet.selected_highlight); } + if (!USER_VERSION_ATLEAST(300, 15)) { + copy_v4_uchar(btheme->space_sequencer.grid, 33); + btheme->space_sequencer.grid[3] = 255; + } + /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 8191a9a9062..4ee7df89487 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -143,17 +143,19 @@ void UI_view2d_view_orthoSpecial(struct ARegion *region, struct View2D *v2d, con void UI_view2d_view_restore(const struct bContext *C); /* grid drawing */ -void UI_view2d_constant_grid_draw(const struct View2D *v2d, float step); void UI_view2d_multi_grid_draw( const struct View2D *v2d, int colorid, float step, int level_size, int totlevels); void UI_view2d_draw_lines_y__values(const struct View2D *v2d); void UI_view2d_draw_lines_x__values(const struct View2D *v2d); -void UI_view2d_draw_lines_x__discrete_values(const struct View2D *v2d); -void UI_view2d_draw_lines_x__discrete_time(const struct View2D *v2d, const struct Scene *scene); +void UI_view2d_draw_lines_x__discrete_values(const struct View2D *v2d, bool display_minor_lines); +void UI_view2d_draw_lines_x__discrete_time(const struct View2D *v2d, + const struct Scene *scene, + bool display_minor_lines); void UI_view2d_draw_lines_x__discrete_frames_or_seconds(const struct View2D *v2d, const struct Scene *scene, - bool display_seconds); + bool display_seconds, + bool display_minor_lines); void UI_view2d_draw_lines_x__frames_or_seconds(const struct View2D *v2d, const struct Scene *scene, bool display_seconds); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index db2766f1b19..23c8a0d35bf 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1194,78 +1194,6 @@ void UI_view2d_view_restore(const bContext *C) /** \name Grid-Line Drawing * \{ */ -/* Draw a constant grid in given 2d-region */ -void UI_view2d_constant_grid_draw(const View2D *v2d, float step) -{ - float start_x, start_y; - int count_x, count_y; - - start_x = v2d->cur.xmin; - if (start_x < 0.0) { - start_x += -(float)fmod(v2d->cur.xmin, step); - } - else { - start_x += (step - (float)fmod(v2d->cur.xmin, step)); - } - - if (start_x > v2d->cur.xmax) { - count_x = 0; - } - else { - count_x = (v2d->cur.xmax - start_x) / step + 1; - } - - start_y = v2d->cur.ymin; - if (start_y < 0.0) { - start_y += -(float)fmod(v2d->cur.ymin, step); - } - else { - start_y += (step - (float)fabs(fmod(v2d->cur.ymin, step))); - } - - if (start_y > v2d->cur.ymax) { - count_y = 0; - } - else { - count_y = (v2d->cur.ymax - start_y) / step + 1; - } - - if (count_x > 0 || count_y > 0) { - GPUVertFormat *format = immVertexFormat(); - const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - const uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - float theme_color[3]; - - UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color); - - immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GPU_PRIM_LINES, count_x * 2 + count_y * 2 + 4); - - immAttr3fv(color, theme_color); - for (int i = 0; i < count_x; start_x += step, i++) { - immVertex2f(pos, start_x, v2d->cur.ymin); - immVertex2f(pos, start_x, v2d->cur.ymax); - } - - for (int i = 0; i < count_y; start_y += step, i++) { - immVertex2f(pos, v2d->cur.xmin, start_y); - immVertex2f(pos, v2d->cur.xmax, start_y); - } - - /* X and Y axis */ - UI_GetThemeColorShade3fv(TH_BACK, -18, theme_color); - - immAttr3fv(color, theme_color); - immVertex2f(pos, 0.0f, v2d->cur.ymin); - immVertex2f(pos, 0.0f, v2d->cur.ymax); - immVertex2f(pos, v2d->cur.xmin, 0.0f); - immVertex2f(pos, v2d->cur.xmax, 0.0f); - - immEnd(); - immUnbindProgram(); - } -} - /* Draw a multi-level grid in given 2d-region */ void UI_view2d_multi_grid_draw( const View2D *v2d, int colorid, float step, int level_size, int totlevels) diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c index 37c84b707fd..a9393b3a6e7 100644 --- a/source/blender/editors/interface/view2d_draw.c +++ b/source/blender/editors/interface/view2d_draw.c @@ -480,10 +480,11 @@ float UI_view2d_grid_resolution_y__values(const struct View2D *v2d) /* Line Drawing API **************************************************/ -void UI_view2d_draw_lines_x__discrete_values(const View2D *v2d) +void UI_view2d_draw_lines_x__discrete_values(const View2D *v2d, bool display_minor_lines) { const uint major_line_distance = view2d_major_step_x__discrete(v2d); - view2d_draw_lines(v2d, major_line_distance, major_line_distance > 1, 'v'); + view2d_draw_lines( + v2d, major_line_distance, display_minor_lines && (major_line_distance > 1), 'v'); } void UI_view2d_draw_lines_x__values(const View2D *v2d) @@ -498,21 +499,25 @@ void UI_view2d_draw_lines_y__values(const View2D *v2d) view2d_draw_lines(v2d, major_line_distance, true, 'h'); } -void UI_view2d_draw_lines_x__discrete_time(const View2D *v2d, const Scene *scene) +void UI_view2d_draw_lines_x__discrete_time(const View2D *v2d, + const Scene *scene, + bool display_minor_lines) { const float major_line_distance = view2d_major_step_x__time(v2d, scene); - view2d_draw_lines(v2d, major_line_distance, major_line_distance > 1, 'v'); + view2d_draw_lines( + v2d, major_line_distance, display_minor_lines && (major_line_distance > 1), 'v'); } void UI_view2d_draw_lines_x__discrete_frames_or_seconds(const View2D *v2d, const Scene *scene, - bool display_seconds) + bool display_seconds, + bool display_minor_lines) { if (display_seconds) { - UI_view2d_draw_lines_x__discrete_time(v2d, scene); + UI_view2d_draw_lines_x__discrete_time(v2d, scene, display_minor_lines); } else { - UI_view2d_draw_lines_x__discrete_values(v2d); + UI_view2d_draw_lines_x__discrete_values(v2d, display_minor_lines); } } @@ -521,7 +526,7 @@ void UI_view2d_draw_lines_x__frames_or_seconds(const View2D *v2d, bool display_seconds) { if (display_seconds) { - UI_view2d_draw_lines_x__discrete_time(v2d, scene); + UI_view2d_draw_lines_x__discrete_time(v2d, scene, true); } else { UI_view2d_draw_lines_x__values(v2d); diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 28482faf6e3..5e5143723a6 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -196,7 +196,8 @@ static void action_main_region_draw(const bContext *C, ARegion *region) UI_view2d_view_ortho(v2d); /* time grid */ - UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, saction->flag & SACTION_DRAWTIME); + UI_view2d_draw_lines_x__discrete_frames_or_seconds( + v2d, scene, saction->flag & SACTION_DRAWTIME, true); ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 326c221a2e3..aef3385f2dc 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1112,7 +1112,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *region) UI_view2d_view_ortho(v2d); /* time grid */ - UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, sc->flag & SC_SHOW_SECONDS); + UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, sc->flag & SC_SHOW_SECONDS, true); /* data... */ clip_draw_dopesheet_main(sc, region, scene); diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 011cd7e2651..987d06cfe5c 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -239,7 +239,7 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) UI_view2d_view_ortho(v2d); /* time grid */ - UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, snla->flag & SNLA_DRAWTIME); + UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, snla->flag & SNLA_DRAWTIME, true); ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index a2652d88ebf..3f8dea8b533 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1981,7 +1981,7 @@ static void draw_seq_backdrop(View2D *v2d) /* Lines separating the horizontal bands. */ i = max_ii(1, ((int)v2d->cur.ymin) - 1); int line_len = (int)v2d->cur.ymax - i + 1; - immUniformThemeColor(TH_GRID); + immUniformThemeColorShade(TH_GRID, 10); immBegin(GPU_PRIM_LINES, line_len * 2); while (line_len--) { immVertex2f(pos, v2d->cur.xmax, i); @@ -2419,7 +2419,12 @@ void draw_timeline_seq(const bContext *C, ARegion *region) /* Get timeline bound-box, needed for the scroll-bars. */ SEQ_timeline_boundbox(scene, SEQ_active_seqbase_get(ed), &v2d->tot); draw_seq_backdrop(v2d); - UI_view2d_constant_grid_draw(v2d, FPS); + if ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY) && (sseq->flag & SEQ_SHOW_GRID)) { + U.v2d_min_gridsize *= 3; + UI_view2d_draw_lines_x__discrete_frames_or_seconds( + v2d, scene, (sseq->flag & SEQ_DRAWFRAMES) == 0, false); + U.v2d_min_gridsize /= 3; + } /* Only draw backdrop in timeline view. */ if (sseq->view == SEQ_VIEW_SEQUENCE && sseq->draw_flag & SEQ_DRAW_BACKDROP) { diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index cf26d1e3243..6de95f0995a 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -100,7 +100,7 @@ static SpaceLink *sequencer_create(const ScrArea *UNUSED(area), const Scene *sce sseq->mainb = SEQ_DRAW_IMG_IMBUF; sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS | SEQ_SHOW_FCURVES | SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME | - SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION; + SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION | SEQ_SHOW_GRID; /* Tool header. */ region = MEM_callocN(sizeof(ARegion), "tool header for sequencer"); diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 04c9eab33f1..1321bd669f1 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -654,6 +654,7 @@ typedef enum eSpaceSeq_Flag { SEQ_SHOW_STRIP_SOURCE = (1 << 15), SEQ_SHOW_STRIP_DURATION = (1 << 16), SEQ_USE_PROXIES = (1 << 17), + SEQ_SHOW_GRID = (1 << 18), } eSpaceSeq_Flag; /* SpaceSeq.view */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index a213b418e0e..1d4318602c2 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -5519,6 +5519,11 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_TRANSFORM_PREVIEW); RNA_def_property_ui_text(prop, "Transform Preview", "Show preview of the transformed frames"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_grid", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GRID); + RNA_def_property_ui_text(prop, "Show Grid", "Show vertical grid lines"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); } static void rna_def_space_text(BlenderRNA *brna) |