Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/area.c75
-rw-r--r--source/blender/editors/screen/glutil.c8
-rw-r--r--source/blender/editors/screen/screen_context.c4
-rw-r--r--source/blender/editors/screen/screen_edit.c19
-rw-r--r--source/blender/editors/screen/screen_ops.c128
-rw-r--r--source/blender/editors/screen/screendump.c8
6 files changed, 153 insertions, 89 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 7f95e2b732c..ce6033f5f49 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -404,7 +404,7 @@ void ED_area_overdraw(bContext *C)
az->do_draw = FALSE;
}
}
- }
+ }
glDisable(GL_BLEND);
}
@@ -421,8 +421,12 @@ void region_scissor_winrct(ARegion *ar, rcti *winrct)
ar = ar->prev;
if (BLI_rcti_isect(winrct, &ar->winrct, NULL)) {
- if (ar->flag & RGN_FLAG_HIDDEN) ;
- else if (ar->alignment & RGN_SPLIT_PREV) ;
+ if (ar->flag & RGN_FLAG_HIDDEN) {
+ /* pass */
+ }
+ else if (ar->alignment & RGN_SPLIT_PREV) {
+ /* pass */
+ }
else if (ar->alignment == RGN_OVERLAP_LEFT) {
winrct->xmin = ar->winrct.xmax + 1;
}
@@ -475,11 +479,11 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
if (ar->drawrct.xmin == ar->drawrct.xmax)
ar->drawrct = winrct;
else {
- /* extra clip for safety */
- ar->drawrct.xmin = MAX2(winrct.xmin, ar->drawrct.xmin);
- ar->drawrct.ymin = MAX2(winrct.ymin, ar->drawrct.ymin);
- ar->drawrct.xmax = MIN2(winrct.xmax, ar->drawrct.xmax);
- ar->drawrct.ymax = MIN2(winrct.ymax, ar->drawrct.ymax);
+ /* extra clip for safety (intersect the rects, could use API func) */
+ ar->drawrct.xmin = max_ii(winrct.xmin, ar->drawrct.xmin);
+ ar->drawrct.ymin = max_ii(winrct.ymin, ar->drawrct.ymin);
+ ar->drawrct.xmax = min_ii(winrct.xmax, ar->drawrct.xmax);
+ ar->drawrct.ymax = min_ii(winrct.ymax, ar->drawrct.ymax);
}
/* note; this sets state, so we can use wmOrtho and friends */
@@ -543,10 +547,7 @@ void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
}
else if (ar->drawrct.xmin != ar->drawrct.xmax) {
/* partial redraw already set, expand region */
- ar->drawrct.xmin = MIN2(ar->drawrct.xmin, rct->xmin);
- ar->drawrct.ymin = MIN2(ar->drawrct.ymin, rct->ymin);
- ar->drawrct.xmax = MAX2(ar->drawrct.xmax, rct->xmax);
- ar->drawrct.ymax = MAX2(ar->drawrct.ymax, rct->ymax);
+ BLI_rcti_union(&ar->drawrct, rct);
}
}
}
@@ -949,20 +950,25 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
/* prefsize, for header we stick to exception */
prefsizex = ar->sizex ? ar->sizex : ar->type->prefsizex;
- if (ar->regiontype == RGN_TYPE_HEADER)
+ if (ar->regiontype == RGN_TYPE_HEADER) {
prefsizey = ar->type->prefsizey;
+ }
else if (ar->regiontype == RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
prefsizey = UI_UNIT_Y * 2 + (UI_UNIT_Y / 2);
}
- else
+ else {
prefsizey = ar->sizey ? ar->sizey : ar->type->prefsizey;
-
- /* hidden is user flag */
- if (ar->flag & RGN_FLAG_HIDDEN) ;
- /* XXX floating area region, not handled yet here */
- else if (alignment == RGN_ALIGN_FLOAT) ;
- /* remainder is too small for any usage */
+ }
+
+
+ if (ar->flag & RGN_FLAG_HIDDEN) {
+ /* hidden is user flag */
+ }
+ else if (alignment == RGN_ALIGN_FLOAT) {
+ /* XXX floating area region, not handled yet here */
+ }
else if (rct_fits(remainder, 'v', 1) < 0 || rct_fits(remainder, 'h', 1) < 0) {
+ /* remainder is too small for any usage */
ar->flag |= RGN_FLAG_TOO_SMALL;
}
else if (alignment == RGN_ALIGN_NONE) {
@@ -1265,19 +1271,15 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
}
else {
/* prevent uiblocks to run */
- uiFreeBlocks(NULL, &ar->uiblocks);
+ uiFreeBlocks(NULL, &ar->uiblocks);
}
-
- /* rechecks 2d matrix for header on dpi changing, do not do for other regions, it resets view && blocks view2d operator polls (ton) */
- if (ar->regiontype == RGN_TYPE_HEADER)
- ar->v2d.flag &= ~V2D_IS_INITIALISED;
}
}
/* externally called for floating regions like menus */
void ED_region_init(bContext *C, ARegion *ar)
{
-// ARegionType *at= ar->type;
+// ARegionType *at = ar->type;
/* refresh can be called before window opened */
region_subwindow(CTX_wm_window(C), ar);
@@ -1419,7 +1421,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
/* put in front of list */
BLI_remlink(&sa->spacedata, sl);
BLI_addhead(&sa->spacedata, sl);
- }
+ }
else {
/* new space */
if (st) {
@@ -1462,7 +1464,8 @@ void ED_area_prevspace(bContext *C, ScrArea *sa)
ED_area_newspace(C, sa, sl->next->spacetype);
}
else {
- ED_area_newspace(C, sa, SPACE_INFO);
+ /* no change */
+ return;
}
ED_area_tag_redraw(sa);
@@ -1531,7 +1534,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
but = uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D,
editortype_pup(), xco, yco, UI_UNIT_X + 10, UI_UNIT_Y,
&(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- TIP_("Display current editor type (click for menu of available types)"));
+ TIP_("Display current editor type (click for a menu of available types)"));
uiButSetFunc(but, spacefunc, NULL, NULL);
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
@@ -1675,11 +1678,9 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
- /* don't jump back when panels close or hide */
- if (!newcontext)
- y = MAX2(-y, -v2d->cur.ymin);
- else
- y = -y;
+ /* ensure tot is set correctly, to keep views on bottons, with sliders */
+ y = min_ii(y, v2d->cur.ymin);
+ y = -y;
}
else {
/* for now, allow scrolling in both directions (since layouts are optimized for vertical,
@@ -1693,7 +1694,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
/* don't jump back when panels close or hide */
if (!newcontext)
- x = MAX2(x, v2d->cur.xmax);
+ x = max_ii(x, v2d->cur.xmax);
y = -y;
}
@@ -1746,7 +1747,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
int maxco, xco, yco;
int headery = ED_area_headersize();
- /* clear */
+ /* clear */
UI_ThemeClearColor((ED_screen_area_active(C)) ? TH_HEADER : TH_HEADERDESEL);
gpuClear(GL_COLOR_BUFFER_BIT);
@@ -1783,7 +1784,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
}
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_rctf_size_y(&ar->v2d.tot));
+ UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, headery);
/* restore view matrix? */
UI_view2d_view_restore(C);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index e9de3275a07..3bd4001250d 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -506,8 +506,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
/* The maximum pixel amounts the image can be cropped
* at the lower left without exceeding the origin.
*/
- int off_x = floor(MAX2(ix, 0));
- int off_y = floor(MAX2(iy, 0));
+ int off_x = floor(max_ff(ix, 0.0f));
+ int off_y = floor(max_ff(iy, 0.0f));
/* The zoomed space coordinate of the raster position
* (starting at the lower left most unclipped pixel).
@@ -531,8 +531,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
* covers the entire screen).
*/
gpuGetSizeBox(GL_SCISSOR_BOX, scissor);
- draw_w = mini(img_w - off_x, ceil(((float)scissor[2] - rast_x) / xzoom));
- draw_h = mini(img_h - off_y, ceil(((float)scissor[3] - rast_y) / yzoom));
+ draw_w = min_ii(img_w - off_x, ceil((float)(scissor[2] - rast_x) / xzoom));
+ draw_h = min_ii(img_h - off_y, ceil((float)(scissor[3] - rast_y) / yzoom));
if (draw_w > 0 && draw_h > 0) {
/* Don't use safe RasterPos (slower) if we can avoid it. */
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 352039c5a61..a516603cfd4 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -194,7 +194,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
}
}
- }
+ }
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
@@ -236,7 +236,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
}
}
- }
+ }
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index b1c6dfc2ebf..52d026c2a89 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -36,6 +36,7 @@
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -273,7 +274,7 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
if (abs(my - se->v1->vec.y) <= 2 && mx >= min && mx <= max)
return se;
- }
+ }
else {
short min, max;
min = MIN2(se->v1->vec.y, se->v2->vec.y);
@@ -633,10 +634,8 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
max[0] = max[1] = 0.0f;
for (sv = sc->vertbase.first; sv; sv = sv->next) {
- min[0] = MIN2(min[0], sv->vec.x);
- min[1] = MIN2(min[1], sv->vec.y);
- max[0] = MAX2(max[0], sv->vec.x);
- max[1] = MAX2(max[1], sv->vec.y);
+ const float fv[2] = {(float)sv->vec.x, (float)sv->vec.y};
+ minmax_v2v2_v2(min, max, fv);
}
/* always make 0.0 left under */
@@ -1084,7 +1083,7 @@ static void screen_refresh_headersizes(void)
for (st = lb->first; st; st = st->next) {
ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_HEADER);
if (art) art->prefsizey = ED_area_headersize();
- }
+ }
}
/* make this screen usable */
@@ -1338,7 +1337,7 @@ int ED_screen_area_active(const bContext *C)
for (ar = sa->regionbase.first; ar; ar = ar->next)
if (ar->swinid == sc->subwinactive)
return 1;
- }
+ }
return 0;
}
@@ -1471,10 +1470,10 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
if (scene != sc->scene) {
/* all areas endlocalview */
- // XXX ScrArea *sa= sc->areabase.first;
+ // XXX ScrArea *sa = sc->areabase.first;
// while (sa) {
// endlocalview(sa);
- // sa= sa->next;
+ // sa = sa->next;
// }
sc->scene = scene;
}
@@ -1751,7 +1750,7 @@ void ED_refresh_viewport_fps(bContext *C)
fpsi->redrawtime = fpsi->lredrawtime;
fpsi->lredrawtime = animtimer->ltime;
}
- else {
+ else {
/* playback stopped or shouldn't be running */
if (scene->fps_info)
MEM_freeN(scene->fps_info);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index c64a4a37f3a..6a9c24d2913 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -192,7 +192,7 @@ int ED_operator_region_view3d_active(bContext *C)
return TRUE;
CTX_wm_operator_poll_msg_set(C, "expected a view3d region");
- return FALSE;
+ return FALSE;
}
/* generic for any view2d which uses anim_ops */
@@ -256,7 +256,7 @@ int ED_operator_node_active(bContext *C)
return 0;
}
-// XXX rename
+/* XXX rename */
int ED_operator_graphedit_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_IPO);
@@ -580,7 +580,7 @@ static int actionzone_area_poll(bContext *C)
for (az = sa->actionzones.first; az; az = az->next)
if (BLI_rcti_isect_pt(&az->rect, x, y))
return 1;
- }
+ }
return 0;
}
@@ -628,6 +628,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
event.type = EVT_ACTIONZONE_AREA;
else
event.type = EVT_ACTIONZONE_REGION;
+ event.val = 0;
event.customdata = op->customdata;
event.customdatafree = TRUE;
op->customdata = NULL;
@@ -701,7 +702,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event)
case ESCKEY:
actionzone_exit(op);
return OPERATOR_CANCELLED;
- case LEFTMOUSE:
+ case LEFTMOUSE:
actionzone_exit(op);
return OPERATOR_CANCELLED;
@@ -969,18 +970,18 @@ static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller
/* if top or down edge selected, test height */
if (sa->v1->flag && sa->v4->flag)
- *bigger = MIN2(*bigger, y1);
+ *bigger = min_ii(*bigger, y1);
else if (sa->v2->flag && sa->v3->flag)
- *smaller = MIN2(*smaller, y1);
+ *smaller = min_ii(*smaller, y1);
}
else {
int x1 = sa->v4->vec.x - sa->v1->vec.x - AREAMINX;
/* if left or right edge selected, test width */
if (sa->v1->flag && sa->v2->flag)
- *bigger = MIN2(*bigger, x1);
+ *bigger = min_ii(*bigger, x1);
else if (sa->v3->flag && sa->v4->flag)
- *smaller = MIN2(*smaller, x1);
+ *smaller = min_ii(*smaller, x1);
}
}
}
@@ -1341,7 +1342,7 @@ static int area_split_apply(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
return 1;
- }
+ }
return 0;
}
@@ -1691,7 +1692,7 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
AZone *az;
if (event->type != EVT_ACTIONZONE_REGION) {
- BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");
+ BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");
return OPERATOR_CANCELLED;
}
@@ -1855,7 +1856,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
case ESCKEY:
- ;
+ break;
}
return OPERATOR_RUNNING_MODAL;
@@ -2071,15 +2072,23 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
/* ************** switch screen operator ***************************** */
+static int screen_set_is_ok(bScreen *screen, bScreen *screen_prev)
+{
+ return ((screen->winid == 0) &&
+ (screen->full == 0) &&
+ (screen != screen_prev) &&
+ (screen->id.name[2] != '.' || !(U.uiflag & USER_HIDE_DOT)));
+}
/* function to be called outside UI context, or for redo */
static int screen_set_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
bScreen *screen = CTX_wm_screen(C);
bScreen *screen_prev = screen;
ScrArea *sa = CTX_wm_area(C);
- int tot = BLI_countlist(&CTX_data_main(C)->screen);
+ int tot = BLI_countlist(&bmain->screen);
int delta = RNA_int_get(op->ptr, "delta");
/* temp screens are for userpref or render display */
@@ -2089,17 +2098,19 @@ static int screen_set_exec(bContext *C, wmOperator *op)
if (delta == 1) {
while (tot--) {
screen = screen->id.next;
- if (screen == NULL) screen = CTX_data_main(C)->screen.first;
- if (screen->winid == 0 && screen->full == 0 && screen != screen_prev)
+ if (screen == NULL) screen = bmain->screen.first;
+ if (screen_set_is_ok(screen, screen_prev)) {
break;
+ }
}
}
else if (delta == -1) {
while (tot--) {
screen = screen->id.prev;
- if (screen == NULL) screen = CTX_data_main(C)->screen.last;
- if (screen->winid == 0 && screen->full == 0 && screen != screen_prev)
+ if (screen == NULL) screen = bmain->screen.last;
+ if (screen_set_is_ok(screen, screen_prev)) {
break;
+ }
}
}
else {
@@ -2359,14 +2370,14 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
ScrArea *sa = screen_areahascursor(sc, event->x, event->y);
int dir;
- if (sa) {
+ if (sa) {
if (jd->sa1 != sa) {
dir = area_getorientation(jd->sa1, sa);
if (dir >= 0) {
if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa2 = sa;
jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
- }
+ }
else {
/* we are not bordering on the previously selected area
* we check if area has common border with the one marked for removal
@@ -2380,14 +2391,14 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
jd->sa2 = sa;
if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
- }
+ }
else {
if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa2 = NULL;
}
}
WM_event_add_notifier(C, NC_WINDOW, NULL);
- }
+ }
else {
/* we are back in the area previously selected for keeping
* we swap the areas if possible to allow user to choose */
@@ -2402,7 +2413,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
if (dir < 0) {
printf("oops, didn't expect that!\n");
}
- }
+ }
else {
dir = area_getorientation(jd->sa1, sa);
if (dir >= 0) {
@@ -2716,6 +2727,8 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
/* lock views and set them */
if (sa->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = sa->spacedata.first;
+
/* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set,
* otherwise when restoring rv3d->localvd the 'viewquat' won't
* match the 'view', set on entering localview See: [#26315],
@@ -2743,7 +2756,15 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
ar = ar->next;
rv3d = ar->regiondata;
- rv3d->view = RV3D_VIEW_CAMERA; rv3d->persp = RV3D_CAMOB;
+
+ /* check if we have a camera */
+ if (v3d->camera) {
+ rv3d->view = RV3D_VIEW_CAMERA; rv3d->persp = RV3D_CAMOB;
+ }
+ else {
+ rv3d->view = RV3D_VIEW_PERSPORTHO; rv3d->persp = RV3D_PERSP;
+ }
+
ED_view3d_lock(rv3d);
view3d_localview_update_rv3d(rv3d);
}
@@ -2827,7 +2848,7 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
/* don't do anything if no region */
if (ar == NULL)
return OPERATOR_CANCELLED;
- }
+ }
/* copied from SCREEN_OT_region_flip */
if (ar->alignment == RGN_ALIGN_TOP)
@@ -2861,6 +2882,38 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot)
ot->flag = 0;
}
+
+
+/* ************** show menus operator ***************************** */
+
+/* show/hide header text menus */
+static int header_toggle_menus_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ ScrArea *sa = CTX_wm_area(C);
+
+ sa->flag = sa->flag ^ HEADER_NO_PULLDOWN;
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+
+static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Show/Hide Header Menus";
+ ot->idname = "SCREEN_OT_header_toggle_menus";
+ ot->description = "Show or hide the header pulldown menus";
+
+ /* api callbacks */
+ ot->exec = header_toggle_menus_exec;
+ ot->poll = ED_operator_areaactive;
+ ot->flag = 0;
+}
+
+
/* ************** header tools operator ***************************** */
void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
{
@@ -2873,6 +2926,11 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN
else
uiItemO(layout, IFACE_("Flip to Top"), ICON_NONE, "SCREEN_OT_header_flip");
+ if (sa->flag & HEADER_NO_PULLDOWN)
+ uiItemO(layout, IFACE_("Show Menus"), ICON_NONE, "SCREEN_OT_header_toggle_menus");
+ else
+ uiItemO(layout, IFACE_("Hide Menus"), ICON_NONE, "SCREEN_OT_header_toggle_menus");
+
uiItemS(layout);
/* file browser should be fullscreen all the time, but other regions can be maximized/restored... */
@@ -3025,7 +3083,11 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
}
else {
if (sync) {
- int step = floor((wt->duration - sad->last_duration) * FPS);
+ /* note: this is very simplistic,
+ * its has problem that it may skip too many frames.
+ * however at least this gives a less jittery playback */
+ const int step = max_ii(1, floor((wt->duration - sad->last_duration) * FPS));
+
/* skip frames */
if (sad->flag & ANIMPLAY_FLAG_REVERSE)
scene->r.cfra -= step;
@@ -3094,11 +3156,12 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
for (sa = window->screen->areabase.first; sa; sa = sa->next) {
ARegion *ar;
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar == sad->ar)
+ if (ar == sad->ar) {
ED_region_tag_redraw(ar);
- else
- if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws))
+ }
+ else if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws)) {
ED_region_tag_redraw(ar);
+ }
}
if (match_area_with_refresh(sa->spacetype, sad->refresh))
@@ -3115,7 +3178,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
/* recalculate the timestep for the timer now that we've finished calculating this,
* since the frames-per-second value may have been changed
*/
- // TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this?
+ /* TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this? */
wt->timestep = (1.0 / FPS);
return OPERATOR_FINISHED;
@@ -3165,7 +3228,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
else {
int refresh = SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */
- if (mode == 1) // XXX only play audio forwards!?
+ if (mode == 1) /* XXX only play audio forwards!? */
sound_play_scene(scene);
ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode);
@@ -3417,7 +3480,7 @@ static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op))
static void SCREEN_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Delete Screen"; //was scene
+ ot->name = "Delete Screen"; /* was scene */
ot->description = "Delete active screen";
ot->idname = "SCREEN_OT_delete";
@@ -3537,6 +3600,7 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(SCREEN_OT_region_scale);
WM_operatortype_append(SCREEN_OT_region_flip);
WM_operatortype_append(SCREEN_OT_header_flip);
+ WM_operatortype_append(SCREEN_OT_header_toggle_menus);
WM_operatortype_append(SCREEN_OT_header_toolbox);
WM_operatortype_append(SCREEN_OT_screen_set);
WM_operatortype_append(SCREEN_OT_screen_full_area);
@@ -3564,7 +3628,7 @@ void ED_operatortypes_screen(void)
/* tools shared by more space types */
WM_operatortype_append(ED_OT_undo);
WM_operatortype_append(ED_OT_undo_push);
- WM_operatortype_append(ED_OT_redo);
+ WM_operatortype_append(ED_OT_redo);
WM_operatortype_append(ED_OT_undo_history);
}
@@ -3734,7 +3798,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", MEDIASTOP, KM_PRESS, 0, 0);
/* Alternative keys for animation and sequencer playing */
-#if 0 // XXX: disabled for restoring later... bad implementation
+#if 0 /* XXX: disabled for restoring later... bad implementation */
keymap = WM_keymap_find(keyconf, "Frames", 0, 0);
kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 13146d9000f..d980703dce5 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -214,7 +214,7 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
- }
+ }
return OPERATOR_CANCELLED;
}
@@ -365,7 +365,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
if (ok == 0) {
printf("Write error: cannot save %s\n", name);
- BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name);
+ BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s", name);
break;
}
else {
@@ -374,7 +374,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
}
/* imbuf knows which rects are not part of ibuf */
- IMB_freeImBuf(ibuf);
+ IMB_freeImBuf(ibuf);
}
MEM_freeN(sj->dumprect);
@@ -408,7 +408,7 @@ static int screencast_exec(bContext *C, wmOperator *op)
sj->y = 0;
sj->dumpsx = win->sizex;
sj->dumpsy = win->sizey;
- }
+ }
else {
ScrArea *curarea = CTX_wm_area(C);
sj->x = curarea->totrct.xmin;