diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:39:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:39:04 +0300 |
commit | 95011f6d484b369db92ae13c674a6522d664ea8f (patch) | |
tree | 91ba2719c9f3096fad0f1f768aa7b1c4d79aa32a /source/blender/editors/screen/screen_ops.c | |
parent | 0911acb5cf49c5ba05b1df045b41697704aa288a (diff) | |
parent | 44505b38df557a5711703613685a1dec9fc2c3d9 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 716 |
1 files changed, 358 insertions, 358 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 3c627f6ed73..e504a116384 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -171,11 +171,11 @@ int ED_operator_objectmode(bContext *C) return 0; if (CTX_data_edit_object(C)) return 0; - + /* add a check for ob->mode too? */ if (obact && (obact->mode != OB_MODE_OBJECT)) return 0; - + return 1; } @@ -252,20 +252,20 @@ int ED_operator_buttons_active(bContext *C) int ED_operator_node_active(bContext *C) { SpaceNode *snode = CTX_wm_space_node(C); - + if (snode && snode->edittree) return 1; - + return 0; } int ED_operator_node_editable(bContext *C) { SpaceNode *snode = CTX_wm_space_node(C); - + if (snode && snode->edittree && !ID_IS_LINKED(snode->edittree)) return 1; - + return 0; } @@ -451,15 +451,15 @@ int ED_operator_uvmap(bContext *C) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = NULL; - + if (obedit && obedit->type == OB_MESH) { em = BKE_editmesh_from_object(obedit); } - + if (em && (em->bm->totface)) { return true; } - + return false; } @@ -606,7 +606,7 @@ static ARegion *screen_find_region_type(bContext *C, int type) /** \name Action Zone Operator * \{ */ -/* operator state vars used: +/* operator state vars used: * none * * functions: @@ -639,11 +639,11 @@ static int actionzone_area_poll(bContext *C) { wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); - + if (sa && win && win->eventstate) { const int *xy = &win->eventstate->x; AZone *az; - + for (az = sa->actionzones.first; az; az = az->next) if (BLI_rcti_isect_pt_v(&az->rect, xy)) return 1; @@ -672,13 +672,13 @@ static void fullscreen_click_rcti_init(rcti *rect, const short x1, const short y AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]) { AZone *az = NULL; - + for (az = sa->actionzones.first; az; az = az->next) { if (BLI_rcti_isect_pt_v(&az->rect, xy)) { if (az->type == AZONE_AREA) { /* no triangle intersect but a hotspot circle based on corner */ int radius = (xy[0] - az->x1) * (xy[0] - az->x1) + (xy[1] - az->y1) * (xy[1] - az->y1); - + if (radius <= AZONESPOT * AZONESPOT) break; } @@ -776,7 +776,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]) } } } - + return az; } @@ -794,9 +794,9 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type) wmEvent event; wmWindow *win = CTX_wm_window(C); sActionzoneData *sad = op->customdata; - + sad->modifier = RNA_int_get(op->ptr, "modifier"); - + wm_event_init_from_window(win, &event); if (type == AZONE_AREA) @@ -810,7 +810,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type) event.customdata = op->customdata; event.customdatafree = true; op->customdata = NULL; - + wm_event_add(win, &event); } @@ -819,17 +819,17 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event) ScrArea *sa = CTX_wm_area(C); AZone *az = is_in_area_actionzone(sa, &event->x); sActionzoneData *sad; - + /* quick escape */ if (az == NULL) return OPERATOR_PASS_THROUGH; - + /* ok we do the actionzone */ sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData"); sad->sa1 = sa; sad->az = az; sad->x = event->x; sad->y = event->y; - + /* region azone directly reacts on mouse clicks */ if (ELEM(sad->az->type, AZONE_REGION, AZONE_FULLSCREEN)) { actionzone_apply(C, op, sad->az->type); @@ -842,7 +842,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event) else { /* add modal handler */ WM_event_add_modal_handler(C, op); - + return OPERATOR_RUNNING_MODAL; } } @@ -870,7 +870,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) sad->gesture_dir = 's'; else sad->gesture_dir = 'w'; - + if (sad->az->type == AZONE_AREA) { const wmWindow *win = CTX_wm_window(C); rcti screen_rect; @@ -894,7 +894,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) /* apply sends event */ actionzone_apply(C, op, sad->az->type); actionzone_exit(op); - + return OPERATOR_FINISHED; } break; @@ -905,9 +905,9 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event) case LEFTMOUSE: actionzone_exit(op); return OPERATOR_CANCELLED; - + } - + return OPERATOR_RUNNING_MODAL; } @@ -922,15 +922,15 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot) ot->name = "Handle Area Action Zones"; ot->description = "Handle area action zones for mouse actions/gestures"; ot->idname = "SCREEN_OT_actionzone"; - + ot->invoke = actionzone_invoke; ot->modal = actionzone_modal; ot->poll = actionzone_area_poll; ot->cancel = actionzone_cancel; - + /* flags */ ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL; - + RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2); } @@ -968,15 +968,15 @@ static int area_swap_init(wmOperator *op, const wmEvent *event) { sAreaSwapData *sd = NULL; sActionzoneData *sad = event->customdata; - + if (sad == NULL || sad->sa1 == NULL) return 0; - + sd = MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData"); sd->sa1 = sad->sa1; sd->sa2 = sad->sa2; op->customdata = sd; - + return 1; } @@ -996,22 +996,22 @@ static void area_swap_cancel(bContext *C, wmOperator *op) static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - + if (!area_swap_init(op, event)) return OPERATOR_PASS_THROUGH; - + /* add modal handler */ WM_cursor_modal_set(CTX_wm_window(C), BC_SWAPAREA_CURSOR); WM_event_add_modal_handler(C, op); - + return OPERATOR_RUNNING_MODAL; - + } static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event) { sActionzoneData *sad = op->customdata; - + switch (event->type) { case MOUSEMOVE: /* second area, for join */ @@ -1028,15 +1028,15 @@ static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event) ED_area_tag_redraw(sad->sa2); ED_area_swapspace(C, sad->sa1, sad->sa2); - + area_swap_exit(C, op); - + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); - + return OPERATOR_FINISHED; } break; - + case ESCKEY: area_swap_cancel(C, op); return OPERATOR_CANCELLED; @@ -1049,12 +1049,12 @@ static void SCREEN_OT_area_swap(wmOperatorType *ot) ot->name = "Swap Areas"; ot->description = "Swap selected areas screen positions"; ot->idname = "SCREEN_OT_area_swap"; - + ot->invoke = area_swap_invoke; ot->modal = area_swap_modal; ot->poll = ED_operator_areaactive; ot->cancel = area_swap_cancel; - + ot->flag = OPTYPE_BLOCKING; } @@ -1077,18 +1077,18 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event) bScreen *newsc; ScrArea *sa; rcti rect; - + win = CTX_wm_window(C); scene = CTX_data_scene(C); sa = CTX_wm_area(C); - + /* XXX hrmf! */ if (event->type == EVT_ACTIONZONE_AREA) { sActionzoneData *sad = event->customdata; - + if (sad == NULL) return OPERATOR_PASS_THROUGH; - + sa = sad->sa1; } @@ -1126,7 +1126,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event) finally: if (event->type == EVT_ACTIONZONE_AREA) actionzone_exit(op); - + if (newwin) { return OPERATOR_FINISHED; } @@ -1140,7 +1140,7 @@ static void SCREEN_OT_area_dupli(wmOperatorType *ot) ot->name = "Duplicate Area into New Window"; ot->description = "Duplicate selected area into new window"; ot->idname = "SCREEN_OT_area_dupli"; - + ot->invoke = area_dupli_invoke; ot->poll = ED_operator_areaactive; } @@ -1151,7 +1151,7 @@ static void SCREEN_OT_area_dupli(wmOperatorType *ot) /** \name Move Area Edge Operator * \{ */ -/* operator state vars used: +/* operator state vars used: * x, y mouse coord near edge * delta movement of edge * @@ -1252,14 +1252,14 @@ static void area_move_set_limits( if (dir == 'h') { int y1; areamin = areaminy; - + if (sa->v1->vec.y > screen_rect->ymin) areamin += U.pixelsize; if (sa->v2->vec.y < (screen_rect->ymax - 1)) areamin += U.pixelsize; - + y1 = sa->v2->vec.y - sa->v1->vec.y + 1 - areamin; - + /* if top or down edge selected, test height */ if (sa->v1->editflag && sa->v4->editflag) *bigger = min_ii(*bigger, y1); @@ -1269,14 +1269,14 @@ static void area_move_set_limits( else { int x1; areamin = AREAMINX; - + if (sa->v1->vec.x > screen_rect->xmin) areamin += U.pixelsize; if (sa->v4->vec.x < (screen_rect->xmax - 1)) areamin += U.pixelsize; - + x1 = sa->v4->vec.x - sa->v1->vec.x + 1 - areamin; - + /* if left or right edge selected, test width */ if (sa->v1->editflag && sa->v2->editflag) *bigger = min_ii(*bigger, x1); @@ -1296,22 +1296,22 @@ static int area_move_init(bContext *C, wmOperator *op) sAreaMoveData *md; rcti screen_rect; int x, y; - + /* required properties */ x = RNA_int_get(op->ptr, "x"); y = RNA_int_get(op->ptr, "y"); - + /* setup */ actedge = screen_find_active_scredge(win, sc, x, y); if (actedge == NULL) return 0; - + md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData"); op->customdata = md; - + md->dir = scredge_is_horizontal(actedge) ? 'h' : 'v'; if (md->dir == 'h') md->origval = actedge->v1->vec.y; else md->origval = actedge->v1->vec.x; - + select_connected_scredge(win, actedge); /* now all vertices with 'flag == 1' are the ones that can be moved. Move this to editflag */ ED_screen_verts_iter(win, sc, v1) { @@ -1470,7 +1470,7 @@ static void area_move_exit(bContext *C, wmOperator *op) if (op->customdata) MEM_freeN(op->customdata); op->customdata = NULL; - + /* this makes sure aligned edges will result in aligned grabbing */ BKE_screen_remove_double_scrverts(CTX_wm_screen(C)); BKE_screen_remove_double_scredges(CTX_wm_screen(C)); @@ -1480,10 +1480,10 @@ static int area_move_exec(bContext *C, wmOperator *op) { if (!area_move_init(C, op)) return OPERATOR_CANCELLED; - + area_move_apply(C, op); area_move_exit(C, op); - + return OPERATOR_FINISHED; } @@ -1492,19 +1492,19 @@ static int area_move_invoke(bContext *C, wmOperator *op, const wmEvent *event) { RNA_int_set(op->ptr, "x", event->x); RNA_int_set(op->ptr, "y", event->y); - - if (!area_move_init(C, op)) + + if (!area_move_init(C, op)) return OPERATOR_PASS_THROUGH; - + /* add temp handler */ WM_event_add_modal_handler(C, op); - + return OPERATOR_RUNNING_MODAL; } static void area_move_cancel(bContext *C, wmOperator *op) { - + RNA_int_set(op->ptr, "delta", 0); area_move_apply(C, op); area_move_exit(C, op); @@ -1515,17 +1515,17 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event) { sAreaMoveData *md = op->customdata; int delta, x, y; - + /* execute the events */ switch (event->type) { case MOUSEMOVE: { x = RNA_int_get(op->ptr, "x"); y = RNA_int_get(op->ptr, "y"); - + delta = (md->dir == 'v') ? event->x - x : event->y - y; RNA_int_set(op->ptr, "delta", delta); - + area_move_apply(C, op); break; } @@ -1535,7 +1535,7 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event) case KM_MODAL_APPLY: area_move_exit(C, op); return OPERATOR_FINISHED; - + case KM_MODAL_CANCEL: area_move_cancel(C, op); return OPERATOR_CANCELLED; @@ -1555,7 +1555,7 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event) break; } } - + return OPERATOR_RUNNING_MODAL; } @@ -1565,16 +1565,16 @@ static void SCREEN_OT_area_move(wmOperatorType *ot) ot->name = "Move Area Edges"; ot->description = "Move selected area edges"; ot->idname = "SCREEN_OT_area_move"; - + ot->exec = area_move_exec; ot->invoke = area_move_invoke; ot->cancel = area_move_cancel; ot->modal = area_move_modal; ot->poll = ED_operator_screen_mainwinactive; /* when mouse is over area-edge */ - + /* flags */ ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL; - + /* rna */ RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); @@ -1633,7 +1633,7 @@ typedef struct sAreaSplitData { ScrEdge *nedge; /* new edge */ ScrArea *sarea; /* start area */ ScrArea *narea; /* new area */ - + } sAreaSplitData; static void area_split_draw_cb(const struct wmWindow *UNUSED(win), void *userdata) @@ -1653,11 +1653,11 @@ static void area_split_draw_cb(const struct wmWindow *UNUSED(win), void *userdat static int area_split_menu_init(bContext *C, wmOperator *op) { sAreaSplitData *sd; - + /* custom data */ sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split"); op->customdata = sd; - + sd->sarea = CTX_wm_area(C); return 1; @@ -1670,21 +1670,21 @@ static int area_split_init(bContext *C, wmOperator *op) sAreaSplitData *sd; int areaminy = ED_area_headersize(); int dir; - + /* required context */ if (sa == NULL) return 0; - + /* required properties */ dir = RNA_enum_get(op->ptr, "direction"); - + /* minimal size */ if (dir == 'v' && sa->winx < 2 * AREAMINX) return 0; if (dir == 'h' && sa->winy < 2 * areaminy) return 0; - + /* custom data */ sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split"); op->customdata = sd; - + sd->sarea = sa; if (dir == 'v') { sd->origmin = sa->v1->vec.x; @@ -1710,7 +1710,7 @@ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb) ScrVert *sbv2 = sb->v2; ScrVert *sbv3 = sb->v3; ScrVert *sbv4 = sb->v4; - + if (sav1 == sbv4 && sav2 == sbv3) { /* sa to right of sb = W */ return BKE_screen_find_edge(screen, sav1, sav2); } @@ -1723,7 +1723,7 @@ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb) else if (sav1 == sbv2 && sav4 == sbv3) { /* sa on top of sb = S*/ return BKE_screen_find_edge(screen, sav1, sav4); } - + return NULL; } @@ -1735,24 +1735,24 @@ static int area_split_apply(bContext *C, wmOperator *op) sAreaSplitData *sd = (sAreaSplitData *)op->customdata; float fac; int dir; - + fac = RNA_float_get(op->ptr, "factor"); dir = RNA_enum_get(op->ptr, "direction"); - + sd->narea = area_split(sc, sd->sarea, dir, fac, 0); /* 0 = no merge */ - + if (sd->narea) { ScrVert *sv; - + sd->nedge = area_findsharededge(sc, sd->sarea, sd->narea); - + /* select newly created edge, prepare for moving edge */ for (sv = sc->vertbase.first; sv; sv = sv->next) sv->editflag = 0; - + sd->nedge->v1->editflag = 1; sd->nedge->v2->editflag = 1; - + if (dir == 'h') sd->origval = sd->nedge->v1->vec.y; else sd->origval = sd->nedge->v1->vec.x; @@ -1765,7 +1765,7 @@ static int area_split_apply(bContext *C, wmOperator *op) return 1; } - + return 0; } @@ -1782,10 +1782,10 @@ static void area_split_exit(bContext *C, wmOperator *op) MEM_freeN(op->customdata); op->customdata = NULL; } - + WM_cursor_modal_restore(CTX_wm_window(C)); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); - + /* this makes sure aligned edges will result in aligned grabbing */ BKE_screen_remove_double_scrverts(CTX_wm_screen(C)); BKE_screen_remove_double_scredges(CTX_wm_screen(C)); @@ -1806,7 +1806,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) sAreaSplitData *sd; rcti screen_rect; int dir; - + /* no full window splitting allowed */ if (sc->state != SCREENNORMAL) return OPERATOR_CANCELLED; @@ -1815,19 +1815,19 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (event->type == EVT_ACTIONZONE_AREA) { sActionzoneData *sad = event->customdata; - + if (sad == NULL || sad->modifier > 0) { return OPERATOR_PASS_THROUGH; } - + /* verify *sad itself */ if (sad->sa1 == NULL || sad->az == NULL) return OPERATOR_PASS_THROUGH; - + /* is this our *sad? if areas not equal it should be passed on */ if (CTX_wm_area(C) != sad->sa1 || sad->sa1 != sad->sa2) return OPERATOR_PASS_THROUGH; - + /* prepare operator state vars */ if (sad->gesture_dir == 'n' || sad->gesture_dir == 's') { dir = 'h'; @@ -1838,22 +1838,22 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) RNA_float_set(op->ptr, "factor", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy); } RNA_enum_set(op->ptr, "direction", dir); - + /* general init, also non-UI case, adds customdata, sets area and defaults */ if (!area_split_init(C, op)) return OPERATOR_PASS_THROUGH; - + } else { ScrEdge *actedge; int x, y; - + /* retrieve initial mouse coord, so we can find the active edge */ if (RNA_struct_property_is_set(op->ptr, "mouse_x")) x = RNA_int_get(op->ptr, "mouse_x"); else x = event->x; - + if (RNA_struct_property_is_set(op->ptr, "mouse_y")) y = RNA_int_get(op->ptr, "mouse_y"); else @@ -1862,28 +1862,28 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) actedge = screen_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &screen_rect, x, y); if (actedge == NULL) return OPERATOR_CANCELLED; - + dir = scredge_is_horizontal(actedge) ? 'v' : 'h'; - + RNA_enum_set(op->ptr, "direction", dir); - + /* special case, adds customdata, sets defaults */ if (!area_split_menu_init(C, op)) return OPERATOR_CANCELLED; - + } - + sd = (sAreaSplitData *)op->customdata; - + if (event->type == EVT_ACTIONZONE_AREA) { - + /* do the split */ if (area_split_apply(C, op)) { area_move_set_limits(win, sc, dir, &screen_rect, &sd->bigger, &sd->smaller, NULL); /* add temp handler for edge move or cancel */ WM_event_add_modal_handler(C, op); - + return OPERATOR_RUNNING_MODAL; } } @@ -1895,22 +1895,22 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) area_split_preview_update_cursor(C, op); return OPERATOR_RUNNING_MODAL; - + } - + return OPERATOR_PASS_THROUGH; } /* function to be called outside UI context, or for redo */ static int area_split_exec(bContext *C, wmOperator *op) { - + if (!area_split_init(C, op)) return OPERATOR_CANCELLED; - + area_split_apply(C, op); area_split_exit(C, op); - + return OPERATOR_FINISHED; } @@ -1918,7 +1918,7 @@ static int area_split_exec(bContext *C, wmOperator *op) static void area_split_cancel(bContext *C, wmOperator *op) { sAreaSplitData *sd = (sAreaSplitData *)op->customdata; - + if (sd->previewmode) { /* pass */ } @@ -1959,7 +1959,7 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) } } break; - + case MIDDLEMOUSE: case TABKEY: if (sd->previewmode == 0) { @@ -1975,9 +1975,9 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) } } } - + break; - + case RIGHTMOUSE: /* cancel operation */ case ESCKEY: area_split_cancel(C, op); @@ -2056,17 +2056,17 @@ static void SCREEN_OT_area_split(wmOperatorType *ot) ot->name = "Split Area"; ot->description = "Split selected area into new windows"; ot->idname = "SCREEN_OT_area_split"; - + ot->exec = area_split_exec; ot->invoke = area_split_invoke; ot->modal = area_split_modal; ot->cancel = area_split_cancel; - + ot->poll = screen_active_editable; /* flags */ ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL; - + /* rna */ RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", ""); RNA_def_float(ot->srna, "factor", 0.5f, 0.0, 1.0, "Factor", "", 0.0, 1.0); @@ -2088,7 +2088,7 @@ typedef struct RegionMoveData { int origx, origy; int maxsize; AZEdge edge; - + } RegionMoveData; @@ -2096,20 +2096,20 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) { ARegion *ar; int dist; - + if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) { dist = BLI_rcti_size_x(&sa->totrct); } else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */ dist = BLI_rcti_size_y(&sa->totrct); } - - /* subtractwidth of regions on opposite side + + /* subtractwidth of regions on opposite side * prevents dragging regions into other opposite regions */ for (ar = sa->regionbase.first; ar; ar = ar->next) { if (ar == scalear) continue; - + if (scalear->alignment == RGN_ALIGN_TOP && ar->alignment == RGN_ALIGN_BOTTOM) dist -= ar->winy; else if (scalear->alignment == RGN_ALIGN_BOTTOM && ar->alignment == RGN_ALIGN_TOP) @@ -2118,7 +2118,7 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) dist -= ar->winx; else if (scalear->alignment == RGN_ALIGN_RIGHT && ar->alignment == RGN_ALIGN_LEFT) dist -= ar->winx; - + /* case of regions in regions, like operator properties panel */ /* these can sit on top of other regions such as headers, so account for this */ else if (edge == AE_BOTTOM_TO_TOPLEFT && scalear->alignment & RGN_ALIGN_TOP && @@ -2140,20 +2140,20 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event { sActionzoneData *sad = event->customdata; AZone *az; - + if (event->type != EVT_ACTIONZONE_REGION) { BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone"); return OPERATOR_CANCELLED; } - + az = sad->az; - + if (az->ar) { RegionMoveData *rmd = MEM_callocN(sizeof(RegionMoveData), "RegionMoveData"); int maxsize; - + op->customdata = rmd; - + rmd->az = az; rmd->ar = az->ar; rmd->sa = sad->sa1; @@ -2161,13 +2161,13 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event rmd->origx = event->x; rmd->origy = event->y; rmd->maxsize = area_max_regionsize(rmd->sa, rmd->ar, rmd->edge); - + /* if not set we do now, otherwise it uses type */ if (rmd->ar->sizex == 0) rmd->ar->sizex = rmd->ar->winx; if (rmd->ar->sizey == 0) rmd->ar->sizey = rmd->ar->winy; - + /* now copy to regionmovedata */ if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) { rmd->origval = rmd->ar->sizex; @@ -2175,21 +2175,21 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event else { rmd->origval = rmd->ar->sizey; } - + /* limit headers to standard height for now */ if (rmd->ar->regiontype == RGN_TYPE_HEADER) maxsize = ED_area_headersize(); else maxsize = 1000; - + CLAMP(rmd->maxsize, 0, maxsize); - + /* add temp handler */ WM_event_add_modal_handler(C, op); - + return OPERATOR_RUNNING_MODAL; } - + return OPERATOR_FINISHED; } @@ -2245,7 +2245,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) { RegionMoveData *rmd = op->customdata; int delta; - + /* execute the events */ switch (event->type) { case MOUSEMOVE: @@ -2255,10 +2255,10 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) { delta = event->x - rmd->origx; if (rmd->edge == AE_LEFT_TO_TOPRIGHT) delta = -delta; - + /* region sizes now get multiplied */ delta /= UI_DPI_FAC; - + rmd->ar->sizex = rmd->origval + delta; if (rmd->ar->type->snap_size) { @@ -2281,7 +2281,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) int maxsize = region_scale_get_maxsize(rmd); delta = event->y - rmd->origy; if (rmd->edge == AE_BOTTOM_TO_TOPLEFT) delta = -delta; - + /* region sizes now get multiplied */ delta /= UI_DPI_FAC; @@ -2303,19 +2303,19 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) region_scale_toggle_hidden(C, rmd); } - else if (maxsize > 0 && (rmd->ar->sizey > maxsize)) + else if (maxsize > 0 && (rmd->ar->sizey > maxsize)) rmd->ar->sizey = maxsize; else if (rmd->ar->flag & RGN_FLAG_HIDDEN) region_scale_toggle_hidden(C, rmd); } ED_area_tag_redraw(rmd->sa); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); - + break; } case LEFTMOUSE: if (event->val == KM_RELEASE) { - + if (ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) { if (rmd->ar->flag & RGN_FLAG_HIDDEN) { region_scale_toggle_hidden(C, rmd); @@ -2329,15 +2329,15 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) } MEM_freeN(op->customdata); op->customdata = NULL; - + return OPERATOR_FINISHED; } break; - + case ESCKEY: break; } - + return OPERATOR_RUNNING_MODAL; } @@ -2353,13 +2353,13 @@ static void SCREEN_OT_region_scale(wmOperatorType *ot) ot->name = "Scale Region Size"; ot->description = "Scale selected area"; ot->idname = "SCREEN_OT_region_scale"; - + ot->invoke = region_scale_invoke; ot->modal = region_scale_modal; ot->cancel = region_scale_cancel; - + ot->poll = ED_operator_areaactive; - + /* flags */ ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL; } @@ -2417,19 +2417,19 @@ static int frame_offset_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); int delta; - + delta = RNA_int_get(op->ptr, "delta"); CFRA += delta; FRAMENUMBER_MIN_CLAMP(CFRA); SUBFRA = 0.f; - + areas_do_frame_follow(C, false); BKE_sound_seek_scene(bmain, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); - + return OPERATOR_FINISHED; } @@ -2438,13 +2438,13 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) ot->name = "Frame Offset"; ot->idname = "SCREEN_OT_frame_offset"; ot->description = "Move current frame forward/backward by a given number"; - + ot->exec = frame_offset_exec; - + ot->poll = ED_operator_screenactive_norender; ot->flag = OPTYPE_UNDO_GROUPED; ot->undo_group = "FRAME_CHANGE"; - + /* rna */ RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } @@ -2468,9 +2468,9 @@ static int frame_jump_exec(bContext *C, wmOperator *op) */ if (animtimer) { ScreenAnimData *sad = animtimer->customdata; - + sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME; - + if (RNA_boolean_get(op->ptr, "end")) sad->nextfra = PEFRA; else @@ -2481,14 +2481,14 @@ static int frame_jump_exec(bContext *C, wmOperator *op) CFRA = PEFRA; else CFRA = PSFRA; - + areas_do_frame_follow(C, true); BKE_sound_seek_scene(bmain, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } - + return OPERATOR_FINISHED; } @@ -2497,13 +2497,13 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot) ot->name = "Jump to Endpoint"; ot->description = "Jump to first/last frame in frame range"; ot->idname = "SCREEN_OT_frame_jump"; - + ot->exec = frame_jump_exec; - + ot->poll = ED_operator_screenactive_norender; ot->flag = OPTYPE_UNDO_GROUPED; ot->undo_group = "FRAME_CHANGE"; - + /* rna */ RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of the frame range"); } @@ -2526,7 +2526,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) float cfra; const bool next = RNA_boolean_get(op->ptr, "next"); bool done = false; - + /* sanity checks */ if (scene == NULL) return OPERATOR_CANCELLED; @@ -2535,13 +2535,13 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) /* init binarytree-list for getting keyframes */ BLI_dlrbTree_init(&keys); - + /* seed up dummy dopesheet context with flags to perform necessary filtering */ if ((scene->flag & SCE_KEYS_NO_SELONLY) == 0) { /* only selected channels are included */ ads.filterflag |= ADS_FILTER_ONLYSEL; } - + /* populate tree with keyframe nodes */ scene_to_keylist(&ads, scene, &keys, NULL); gpencil_to_keylist(&ads, scene->gpd, &keys); @@ -2550,7 +2550,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) ob_to_keylist(&ads, ob, &keys, NULL); gpencil_to_keylist(&ads, ob->gpd, &keys); } - + { Mask *mask = CTX_data_edit_mask(C); if (mask) { @@ -2561,13 +2561,13 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) /* build linked-list for searching */ BLI_dlrbTree_linkedlist_sync(&keys); - + /* find matching keyframe in the right direction */ if (next) ak = (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra); else ak = (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra); - + while ((ak != NULL) && (done == false)) { if (CFRA != (int)ak->cfra) { /* this changes the frame, so set the frame and we're done */ @@ -2584,7 +2584,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) } } } - + /* free temp stuff */ BLI_dlrbTree_free(&keys); @@ -2610,13 +2610,13 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) ot->name = "Jump to Keyframe"; ot->description = "Jump to previous/next keyframe"; ot->idname = "SCREEN_OT_keyframe_jump"; - + ot->exec = keyframe_jump_exec; - + ot->poll = ED_operator_screenactive_norender; ot->flag = OPTYPE_UNDO_GROUPED; ot->undo_group = "FRAME_CHANGE"; - + /* properties */ RNA_def_boolean(ot->srna, "next", true, "Next Keyframe", ""); } @@ -2712,7 +2712,7 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot) ot->name = "Set Screen"; ot->description = "Cycle through available screens"; ot->idname = "SCREEN_OT_screen_set"; - + ot->exec = screen_set_exec; ot->poll = ED_operator_screenactive; @@ -2732,17 +2732,17 @@ static int screen_maximize_area_exec(bContext *C, wmOperator *op) bScreen *screen = CTX_wm_screen(C); ScrArea *sa = NULL; const bool hide_panels = RNA_boolean_get(op->ptr, "use_hide_panels"); - + /* search current screen for 'fullscreen' areas */ /* prevents restoring info header, when mouse is over it */ for (sa = screen->areabase.first; sa; sa = sa->next) { if (sa->full) break; } - + if (sa == NULL) { sa = CTX_wm_area(C); } - + if (hide_panels) { if (!ELEM(screen->state, SCREENNORMAL, SCREENFULL)) { return OPERATOR_CANCELLED; @@ -2775,7 +2775,7 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot) ot->name = "Toggle Maximize Area"; ot->description = "Toggle display selected area as fullscreen/maximized"; ot->idname = "SCREEN_OT_screen_full_area"; - + ot->exec = screen_maximize_area_exec; ot->poll = screen_maximize_area_poll; ot->flag = 0; @@ -2790,7 +2790,7 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot) /** \name Screen Join-Area Operator * \{ */ -/* operator state vars used: +/* operator state vars used: * x1, y1 mouse coord in first area, which will disappear * x2, y2 mouse coord in 2nd area, which will become joined * @@ -2845,18 +2845,18 @@ static int area_join_init(bContext *C, wmOperator *op) int x1, y1; int x2, y2; int shared = 0; - + /* required properties, make negative to get return 0 if not set by caller */ x1 = RNA_int_get(op->ptr, "min_x"); y1 = RNA_int_get(op->ptr, "min_y"); x2 = RNA_int_get(op->ptr, "max_x"); y2 = RNA_int_get(op->ptr, "max_y"); - + sa1 = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, x1, y1); sa2 = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, x2, y2); if (sa1 == NULL || sa2 == NULL || sa1 == sa2) return 0; - + /* do areas share an edge? */ if (sa1->v1 == sa2->v1 || sa1->v1 == sa2->v2 || sa1->v1 == sa2->v3 || sa1->v1 == sa2->v4) shared++; if (sa1->v2 == sa2->v1 || sa1->v2 == sa2->v2 || sa1->v2 == sa2->v3 || sa1->v2 == sa2->v4) shared++; @@ -2866,7 +2866,7 @@ static int area_join_init(bContext *C, wmOperator *op) printf("areas don't share edge\n"); return 0; } - + jd = (sAreaJoinData *)MEM_callocN(sizeof(sAreaJoinData), "op_area_join"); jd->sa1 = sa1; @@ -2884,7 +2884,7 @@ static int area_join_apply(bContext *C, wmOperator *op) { sAreaJoinData *jd = (sAreaJoinData *)op->customdata; if (!jd) return 0; - + if (!screen_area_join(C, CTX_wm_screen(C), jd->sa1, jd->sa2)) { return 0; } @@ -2892,7 +2892,7 @@ static int area_join_apply(bContext *C, wmOperator *op) CTX_wm_area_set(C, NULL); CTX_wm_region_set(C, NULL); } - + return 1; } @@ -2908,7 +2908,7 @@ static void area_join_exit(bContext *C, wmOperator *op) MEM_freeN(jd); op->customdata = NULL; } - + /* this makes sure aligned edges will result in aligned grabbing */ BKE_screen_remove_double_scredges(CTX_wm_screen(C)); BKE_screen_remove_unused_scredges(CTX_wm_screen(C)); @@ -2917,55 +2917,55 @@ static void area_join_exit(bContext *C, wmOperator *op) static int area_join_exec(bContext *C, wmOperator *op) { - if (!area_join_init(C, op)) + if (!area_join_init(C, op)) return OPERATOR_CANCELLED; - + area_join_apply(C, op); area_join_exit(C, op); - + return OPERATOR_FINISHED; } /* interaction callback */ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - + if (event->type == EVT_ACTIONZONE_AREA) { sActionzoneData *sad = event->customdata; - + if (sad == NULL || sad->modifier > 0) { return OPERATOR_PASS_THROUGH; } - + /* verify *sad itself */ if (sad->sa1 == NULL || sad->sa2 == NULL) return OPERATOR_PASS_THROUGH; - + /* is this our *sad? if areas equal it should be passed on */ if (sad->sa1 == sad->sa2) return OPERATOR_PASS_THROUGH; - + /* prepare operator state vars */ RNA_int_set(op->ptr, "min_x", sad->x); RNA_int_set(op->ptr, "min_y", sad->y); RNA_int_set(op->ptr, "max_x", event->x); RNA_int_set(op->ptr, "max_y", event->y); } - - - if (!area_join_init(C, op)) + + + if (!area_join_init(C, op)) return OPERATOR_PASS_THROUGH; - + /* add temp handler */ WM_event_add_modal_handler(C, op); - + return OPERATOR_RUNNING_MODAL; } static void area_join_cancel(bContext *C, wmOperator *op) { WM_event_add_notifier(C, NC_WINDOW, NULL); - + area_join_exit(C, op); } @@ -2974,15 +2974,15 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) { bScreen *sc = CTX_wm_screen(C); sAreaJoinData *jd = (sAreaJoinData *)op->customdata; - + /* execute the events */ switch (event->type) { - - case MOUSEMOVE: + + case MOUSEMOVE: { ScrArea *sa = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y); int dir; - + if (sa) { if (jd->sa1 != sa) { dir = area_getorientation(jd->sa1, sa); @@ -2990,7 +2990,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) jd->sa2 = sa; } else { - /* we are not bordering on the previously selected area + /* we are not bordering on the previously selected area * we check if area has common border with the one marked for removal * in this case we can swap areas. */ @@ -3006,7 +3006,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) WM_event_add_notifier(C, NC_WINDOW, NULL); } else { - /* we are back in the area previously selected for keeping + /* we are back in the area previously selected for keeping * we swap the areas if possible to allow user to choose */ if (jd->sa2 != NULL) { jd->sa1 = jd->sa2; @@ -3038,13 +3038,13 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } break; - + case RIGHTMOUSE: case ESCKEY: area_join_cancel(C, op); return OPERATOR_CANCELLED; } - + return OPERATOR_RUNNING_MODAL; } @@ -3055,17 +3055,17 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) ot->name = "Join Area"; ot->description = "Join selected areas into new window"; ot->idname = "SCREEN_OT_area_join"; - + /* api callbacks */ ot->exec = area_join_exec; ot->invoke = area_join_invoke; ot->modal = area_join_modal; ot->poll = screen_active_editable; ot->cancel = area_join_cancel; - + /* flags */ ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL; - + /* rna */ RNA_def_int(ot->srna, "min_x", -100, INT_MIN, INT_MAX, "X 1", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "min_y", -100, INT_MIN, INT_MAX, "Y 1", "", INT_MIN, INT_MAX); @@ -3091,12 +3091,12 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent WM_window_screen_rect_calc(win, &screen_rect); actedge = screen_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y); - + if (actedge == NULL) return OPERATOR_CANCELLED; - + pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); layout = UI_popup_menu_layout(pup); - + uiItemFullO(layout, "SCREEN_OT_area_split", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &ptr); /* store initial mouse cursor position */ RNA_int_set(&ptr, "mouse_x", event->x); @@ -3108,9 +3108,9 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent RNA_int_set(&ptr, "min_y", event->y + 4); RNA_int_set(&ptr, "max_x", event->x - 4); RNA_int_set(&ptr, "max_y", event->y - 4); - + UI_popup_menu_end(C, pup); - + return OPERATOR_INTERFACE; } @@ -3120,10 +3120,10 @@ static void SCREEN_OT_area_options(wmOperatorType *ot) ot->name = "Area Options"; ot->description = "Operations for splitting and merging"; ot->idname = "SCREEN_OT_area_options"; - + /* api callbacks */ ot->invoke = screen_area_options_invoke; - + ot->poll = ED_operator_screen_mainwinactive; /* flags */ @@ -3142,7 +3142,7 @@ static int spacedata_cleanup_exec(bContext *C, wmOperator *op) bScreen *screen; ScrArea *sa; int tot = 0; - + for (screen = bmain->screen.first; screen; screen = screen->id.next) { for (sa = screen->areabase.first; sa; sa = sa->next) { if (sa->spacedata.first != sa->spacedata.last) { @@ -3156,7 +3156,7 @@ static int spacedata_cleanup_exec(bContext *C, wmOperator *op) } } BKE_reportf(op->reports, RPT_INFO, "Removed amount of editors: %d", tot); - + return OPERATOR_FINISHED; } @@ -3166,11 +3166,11 @@ static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot) ot->name = "Clean-up Space-data"; ot->description = "Remove unused settings for invisible editors"; ot->idname = "SCREEN_OT_spacedata_cleanup"; - + /* api callbacks */ ot->exec = spacedata_cleanup_exec; ot->poll = WM_operator_winactive; - + } /** \} */ @@ -3198,7 +3198,7 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) WM_operator_free_all_after(wm, lastop); WM_operator_repeat(C, lastop); } - + return OPERATOR_CANCELLED; } @@ -3208,12 +3208,12 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot) ot->name = "Repeat Last"; ot->description = "Repeat last action"; ot->idname = "SCREEN_OT_repeat_last"; - + /* api callbacks */ ot->exec = repeat_last_exec; - + ot->poll = ED_operator_screenactive; - + } /** \} */ @@ -3229,37 +3229,37 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNU uiPopupMenu *pup; uiLayout *layout; int items, i; - + items = BLI_listbase_count(&wm->operators); if (items == 0) return OPERATOR_CANCELLED; - + pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); layout = UI_popup_menu_layout(pup); - + for (i = items - 1, lastop = wm->operators.last; lastop; lastop = lastop->prev, i--) if ((lastop->type->flag & OPTYPE_REGISTER) && WM_operator_repeat_check(C, lastop)) { uiItemIntO(layout, RNA_struct_ui_name(lastop->type->srna), ICON_NONE, op->type->idname, "index", i); } - + UI_popup_menu_end(C, pup); - + return OPERATOR_INTERFACE; } static int repeat_history_exec(bContext *C, wmOperator *op) { wmWindowManager *wm = CTX_wm_manager(C); - + op = BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index")); if (op) { /* let's put it as last operator in list */ BLI_remlink(&wm->operators, op); BLI_addtail(&wm->operators, op); - + WM_operator_repeat(C, op); } - + return OPERATOR_FINISHED; } @@ -3269,13 +3269,13 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) ot->name = "Repeat History"; ot->description = "Display menu for previous actions performed"; ot->idname = "SCREEN_OT_repeat_history"; - + /* api callbacks */ ot->invoke = repeat_history_invoke; ot->exec = repeat_history_exec; - + ot->poll = ED_operator_screenactive; - + RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000); } @@ -3288,10 +3288,10 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { wmOperator *lastop = WM_operator_last_redo(C); - + if (lastop) WM_operator_redo_popup(C, lastop); - + return OPERATOR_CANCELLED; } @@ -3301,10 +3301,10 @@ static void SCREEN_OT_redo_last(wmOperatorType *ot) ot->name = "Redo Last"; ot->description = "Display menu for last action performed"; ot->idname = "SCREEN_OT_redo_last"; - + /* api callbacks */ ot->invoke = redo_last_invoke; - + ot->poll = ED_operator_screenactive; } @@ -3347,7 +3347,7 @@ static void region_quadview_init_rv3d(ScrArea *sa, ARegion *ar, static int region_quadview_exec(bContext *C, wmOperator *op) { ARegion *ar = CTX_wm_region(C); - + /* some rules... */ if (ar->regiontype != RGN_TYPE_WINDOW) { BKE_report(op->reports, RPT_ERROR, "Only window region can be 4-splitted"); @@ -3356,10 +3356,10 @@ static int region_quadview_exec(bContext *C, wmOperator *op) /* Exit quad-view */ ScrArea *sa = CTX_wm_area(C); ARegion *arn; - + /* keep current region */ ar->alignment = 0; - + if (sa->spacetype == SPACE_VIEW3D) { ARegion *ar_iter; RegionView3D *rv3d = ar->regiondata; @@ -3389,7 +3389,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op) } } } - + for (ar = sa->regionbase.first; ar; ar = arn) { arn = ar->next; if (ar->alignment == RGN_ALIGN_QSPLIT) { @@ -3410,14 +3410,14 @@ static int region_quadview_exec(bContext *C, wmOperator *op) ScrArea *sa = CTX_wm_area(C); ARegion *newar; int count; - + ar->alignment = RGN_ALIGN_QSPLIT; - + for (count = 0; count < 3; count++) { newar = BKE_area_region_copy(sa->type, ar); BLI_addtail(&sa->regionbase, newar); } - + /* lock views and set them */ if (sa->spacetype == SPACE_VIEW3D) { View3D *v3d = sa->spacedata.first; @@ -3447,8 +3447,8 @@ static int region_quadview_exec(bContext *C, wmOperator *op) ED_area_tag_redraw(sa); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } - - + + return OPERATOR_FINISHED; } @@ -3458,7 +3458,7 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) ot->name = "Toggle Quad View"; ot->description = "Split selected area into camera, front, right & top views"; ot->idname = "SCREEN_OT_region_quadview"; - + /* api callbacks */ ot->exec = region_quadview_exec; ot->poll = ED_operator_region_view3d_active; @@ -3475,10 +3475,10 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) static int region_flip_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar = CTX_wm_region(C); - + if (!ar) return OPERATOR_CANCELLED; - + if (ar->alignment == RGN_ALIGN_TOP) ar->alignment = RGN_ALIGN_BOTTOM; else if (ar->alignment == RGN_ALIGN_BOTTOM) @@ -3490,7 +3490,7 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op)) ED_area_tag_redraw(CTX_wm_area(C)); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); - + return OPERATOR_FINISHED; } @@ -3513,7 +3513,7 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot) ot->name = "Flip Region"; ot->idname = "SCREEN_OT_region_flip"; ot->description = "Toggle the region's alignment (left/right or top/bottom)"; - + /* api callbacks */ ot->exec = region_flip_exec; ot->poll = region_flip_poll; @@ -3580,7 +3580,7 @@ static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot) ot->name = "Expand/Collapse Header Menus"; ot->idname = "SCREEN_OT_header_toggle_menus"; ot->description = "Expand or collapse the header pulldown menus"; - + /* api callbacks */ ot->exec = header_toggle_menus_exec; ot->poll = ED_operator_areaactive; @@ -3640,7 +3640,7 @@ static void SCREEN_OT_header_toolbox(wmOperatorType *ot) ot->name = "Header Toolbox"; ot->description = "Display header region toolbox"; ot->idname = "SCREEN_OT_header_toolbox"; - + /* api callbacks */ ot->invoke = header_toolbox_invoke; } @@ -3661,14 +3661,14 @@ static int match_area_with_refresh(int spacetype, int refresh) return 1; break; } - + return 0; } static int match_region_with_redraws(int spacetype, int regiontype, int redraws, bool from_anim_edit) { if (regiontype == RGN_TYPE_WINDOW) { - + switch (spacetype) { case SPACE_VIEW3D: if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit) @@ -3706,7 +3706,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws, if ((redraws & TIME_CLIPS) || from_anim_edit) return 1; break; - + } } else if (regiontype == RGN_TYPE_CHANNELS) { @@ -3771,12 +3771,12 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv ScrArea *sa; int sync; float time; - + /* sync, don't sync, or follow scene setting */ if (sad->flag & ANIMPLAY_FLAG_SYNC) sync = 1; else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync = 0; else sync = (scene->flag & SCE_FRAME_DROP); - + if ((scene->audio.flag & AUDIO_SYNC) && (sad->flag & ANIMPLAY_FLAG_REVERSE) == false && isfinite(time = BKE_sound_sync_scene(scene))) @@ -3822,12 +3822,12 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv scene->r.cfra++; } } - + sad->last_duration = wt->duration; /* reset 'jumped' flag before checking if we need to jump... */ sad->flag &= ~ANIMPLAY_FLAG_JUMPED; - + if (sad->flag & ANIMPLAY_FLAG_REVERSE) { /* jump back to end? */ if (PRVRANGEON) { @@ -3865,14 +3865,14 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME; sad->flag |= ANIMPLAY_FLAG_JUMPED; } - + if (sad->flag & ANIMPLAY_FLAG_JUMPED) { BKE_sound_seek_scene(bmain, scene); #ifdef PROFILE_AUDIO_SYNCH old_frame = CFRA; #endif } - + /* since we follow drawflags, we can't send notifier but tag regions ourselves */ ED_update_for_newframe(bmain, depsgraph); @@ -3911,24 +3911,24 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv } } } - + if (match_area_with_refresh(sa->spacetype, sad->refresh)) ED_area_tag_refresh(sa); } } - - /* update frame rate info too - * NOTE: this may not be accurate enough, since we might need this after modifiers/etc. + + /* update frame rate info too + * NOTE: this may not be accurate enough, since we might need this after modifiers/etc. * have been calculated instead of just before updates have been done? */ ED_refresh_viewport_fps(C); - + /* 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? */ wt->timestep = (1.0 / FPS); - + return OPERATOR_FINISHED; } return OPERATOR_PASS_THROUGH; @@ -3940,12 +3940,12 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot) ot->name = "Animation Step"; ot->description = "Step through animation by position"; ot->idname = "SCREEN_OT_animation_step"; - + /* api callbacks */ ot->invoke = screen_animation_step; - + ot->poll = ED_operator_screenactive_norender; - + } /** \} */ @@ -3999,16 +3999,16 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) } else { int refresh = SPACE_ACTION; /* these settings are currently only available from a menu in the TimeLine */ - + if (mode == 1) /* XXX only play audio forwards!? */ BKE_sound_play_scene(scene); - + ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode); - + if (screen->animtimer) { wmTimer *wt = screen->animtimer; ScreenAnimData *sad = wt->customdata; - + sad->ar = CTX_wm_region(C); } } @@ -4020,10 +4020,10 @@ static int screen_animation_play_exec(bContext *C, wmOperator *op) { int mode = (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1; int sync = -1; - + if (RNA_struct_property_is_set(op->ptr, "sync")) sync = (RNA_boolean_get(op->ptr, "sync")); - + return ED_screen_animation_play(C, sync, mode); } @@ -4035,12 +4035,12 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot) ot->name = "Play Animation"; ot->description = "Play animation"; ot->idname = "SCREEN_OT_animation_play"; - + /* api callbacks */ ot->exec = screen_animation_play_exec; - + ot->poll = ED_operator_screenactive_norender; - + prop = RNA_def_boolean(ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate"); @@ -4083,10 +4083,10 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot) ot->name = "Cancel Animation"; ot->description = "Cancel animation, returning to the original frame"; ot->idname = "SCREEN_OT_animation_cancel"; - + /* api callbacks */ ot->exec = screen_animation_cancel_exec; - + ot->poll = ED_operator_screenactive; RNA_def_boolean(ot->srna, "restore_frame", true, "Restore Frame", "Restore the frame when animation was initialized"); @@ -4098,7 +4098,7 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot) /** \name Border Select Operator (Template) * \{ */ -/* operator state vars used: (added by default WM callbacks) +/* operator state vars used: (added by default WM callbacks) * xmin, ymin * xmax, ymax * @@ -4120,14 +4120,14 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot) static int border_select_exec(bContext *C, wmOperator *op) { int event_type = RNA_int_get(op->ptr, "event_type"); - + if (event_type == LEFTMOUSE) printf("border select do select\n"); else if (event_type == RIGHTMOUSE) printf("border select deselect\n"); - else + else printf("border select do something\n"); - + return 1; } @@ -4136,15 +4136,15 @@ static void SCREEN_OT_border_select(wmOperatorType *ot) /* identifiers */ ot->name = "Border Select"; ot->idname = "SCREEN_OT_border_select"; - + /* api callbacks */ ot->exec = border_select_exec; ot->invoke = WM_gesture_border_invoke; ot->modal = WM_gesture_border_modal; ot->cancel = WM_gesture_border_cancel; - + ot->poll = ED_operator_areaactive; - + /* rna */ RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); WM_operator_properties_border(ot); @@ -4164,7 +4164,7 @@ static int fullscreen_back_exec(bContext *C, wmOperator *op) { bScreen *screen = CTX_wm_screen(C); ScrArea *sa = NULL; - + /* search current screen for 'fullscreen' areas */ for (sa = screen->areabase.first; sa; sa = sa->next) { if (sa->full) break; @@ -4185,7 +4185,7 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot) ot->name = "Back to Previous Screen"; ot->description = "Revert back to the original screen layout, before fullscreen area overlay"; ot->idname = "SCREEN_OT_back_to_previous"; - + /* api callbacks */ ot->exec = fullscreen_back_exec; ot->poll = ED_operator_screenactive; @@ -4201,7 +4201,7 @@ static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *even { int sizex = 800 * UI_DPI_FAC; int sizey = 500 * UI_DPI_FAC; - + /* changes context! */ if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_USERPREFS) != NULL) { return OPERATOR_FINISHED; @@ -4219,7 +4219,7 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) ot->name = "Show User Preferences"; ot->description = "Show user preferences"; ot->idname = "SCREEN_OT_userpref_show"; - + /* api callbacks */ ot->invoke = userpref_show_invoke; ot->poll = ED_operator_screenactive; @@ -4237,23 +4237,23 @@ static int drivers_editor_show_invoke(bContext *C, wmOperator *op, const wmEvent PropertyRNA *prop = NULL; int index = -1; uiBut *but = NULL; - + int sizex = 900 * UI_DPI_FAC; int sizey = 580 * UI_DPI_FAC; - + /* Get active property to show driver for * - Need to grab it first, or else this info disappears * after we've created the window */ but = UI_context_active_but_prop_get(C, &ptr, &prop, &index); - + /* changes context! */ if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_DRIVERS) != NULL) { /* activate driver F-Curve for the property under the cursor */ if (but) { FCurve *fcu; bool driven, special; - + fcu = rna_get_fcurve_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special); @@ -4271,7 +4271,7 @@ static int drivers_editor_show_invoke(bContext *C, wmOperator *op, const wmEvent } } } - + return OPERATOR_FINISHED; } else { @@ -4287,7 +4287,7 @@ static void SCREEN_OT_drivers_editor_show(struct wmOperatorType *ot) ot->name = "Show Drivers Editor"; ot->description = "Show drivers editor in a separate window"; ot->idname = "SCREEN_OT_drivers_editor_show"; - + /* api callbacks */ ot->invoke = drivers_editor_show_invoke; ot->poll = ED_operator_screenactive; @@ -4318,7 +4318,7 @@ static void SCREEN_OT_new(wmOperatorType *ot) ot->name = "New Screen"; ot->description = "Add a new screen"; ot->idname = "SCREEN_OT_new"; - + /* api callbacks */ ot->exec = screen_new_exec; ot->poll = WM_operator_winactive; @@ -4347,7 +4347,7 @@ static void SCREEN_OT_delete(wmOperatorType *ot) ot->name = "Delete Screen"; ot->description = "Delete active screen"; ot->idname = "SCREEN_OT_delete"; - + /* api callbacks */ ot->exec = screen_delete_exec; } @@ -4385,7 +4385,7 @@ float ED_region_blend_alpha(ARegion *ar) alpha = (float)ar->regiontimer->duration / TIMEOUT; /* makes sure the blend out works 100% - without area redraws */ if (rgi->hidden) alpha = 0.9f - TIMESTEP - alpha; - + CLAMP(alpha, 0.0f, 1.0f); return alpha; } @@ -4396,12 +4396,12 @@ float ED_region_blend_alpha(ARegion *ar) static void region_blend_end(bContext *C, ARegion *ar, const bool is_running) { RegionAlphaInfo *rgi = ar->regiontimer->customdata; - + /* always send redraw */ ED_region_tag_redraw(ar); if (rgi->child_ar) ED_region_tag_redraw(rgi->child_ar); - + /* if running timer was hiding, the flag toggle went wrong */ if (is_running) { if (rgi->hidden) @@ -4425,14 +4425,14 @@ void region_blend_start(bContext *C, ScrArea *sa, ARegion *ar) wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); RegionAlphaInfo *rgi; - + /* end running timer */ if (ar->regiontimer) { region_blend_end(C, ar, true); } rgi = MEM_callocN(sizeof(RegionAlphaInfo), "RegionAlphaInfo"); - + rgi->hidden = ar->flag & RGN_FLAG_HIDDEN; rgi->sa = sa; rgi->ar = ar; @@ -4461,18 +4461,18 @@ static int region_blend_invoke(bContext *C, wmOperator *UNUSED(op), const wmEven { RegionAlphaInfo *rgi; wmTimer *timer = event->customdata; - + /* event type is TIMERREGION, but we better check */ if (event->type != TIMERREGION || timer == NULL) return OPERATOR_PASS_THROUGH; - + rgi = timer->customdata; - + /* always send redraws */ ED_region_tag_redraw(rgi->ar); if (rgi->child_ar) ED_region_tag_redraw(rgi->child_ar); - + /* end timer? */ if (rgi->ar->regiontimer->duration > (double)TIMEOUT) { region_blend_end(C, rgi->ar, false); @@ -4488,13 +4488,13 @@ static void SCREEN_OT_region_blend(wmOperatorType *ot) ot->name = "Region Alpha"; ot->idname = "SCREEN_OT_region_blend"; ot->description = "Blend in and out overlapping region"; - + /* api callbacks */ ot->invoke = region_blend_invoke; - + /* flags */ ot->flag = OPTYPE_INTERNAL; - + /* properties */ } @@ -4596,7 +4596,7 @@ static int space_workspace_cycle_invoke(bContext *C, wmOperator *op, const wmEve if (WM_window_is_temp_screen(win)) { return OPERATOR_CANCELLED; } - + Main *bmain = CTX_data_main(C); const int direction = RNA_enum_get(op->ptr, "direction"); WorkSpace *workspace_src = WM_window_get_active_workspace(win); @@ -4643,7 +4643,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_repeat_last); WM_operatortype_append(SCREEN_OT_repeat_history); WM_operatortype_append(SCREEN_OT_redo_last); - + /* screen tools */ WM_operatortype_append(SCREEN_OT_area_move); WM_operatortype_append(SCREEN_OT_area_split); @@ -4668,13 +4668,13 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_region_blend); WM_operatortype_append(SCREEN_OT_space_context_cycle); WM_operatortype_append(SCREEN_OT_workspace_cycle); - + /*frame changes*/ WM_operatortype_append(SCREEN_OT_frame_offset); WM_operatortype_append(SCREEN_OT_frame_jump); WM_operatortype_append(SCREEN_OT_keyframe_jump); WM_operatortype_append(SCREEN_OT_marker_jump); - + WM_operatortype_append(SCREEN_OT_animation_step); WM_operatortype_append(SCREEN_OT_animation_play); WM_operatortype_append(SCREEN_OT_animation_cancel); @@ -4691,7 +4691,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(ED_OT_undo_history); WM_operatortype_append(ED_OT_flush_edits); - + } /** \} */ @@ -4709,20 +4709,20 @@ static void keymap_modal_set(wmKeyConfig *keyconf) {KM_MODAL_SNAP_OFF, "SNAP_OFF", 0, "Snap off", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap; - + /* Standard Modal keymap ------------------------------------------------ */ keymap = WM_modalkeymap_add(keyconf, "Standard Modal Map", modal_items); - + WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_ANY, KM_ANY, 0, KM_MODAL_APPLY); WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_APPLY); WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, KM_MODAL_APPLY); - + WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_SNAP_ON); WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, KM_MODAL_SNAP_OFF); - + WM_modalkeymap_assign(keymap, "SCREEN_OT_area_move"); - + } static int open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) @@ -4748,14 +4748,14 @@ void ED_keymap_screen(wmKeyConfig *keyconf) ListBase *lb; wmKeyMap *keymap; wmKeyMapItem *kmi; - + /* Screen Editing ------------------------------------------------ */ keymap = WM_keymap_find(keyconf, "Screen Editing", 0, 0); - + RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "modifier", 0); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "modifier", 1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "modifier", 2); - + /* screen tools */ WM_keymap_verify_item(keymap, "SCREEN_OT_area_split", EVT_ACTIONZONE_AREA, 0, 0, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_area_join", EVT_ACTIONZONE_AREA, 0, 0, 0); @@ -4766,7 +4766,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "use_hide_panels", true); /* area move after action zones */ WM_keymap_verify_item(keymap, "SCREEN_OT_area_move", LEFTMOUSE, KM_PRESS, 0, 0); - + WM_keymap_verify_item(keymap, "SCREEN_OT_area_options", RIGHTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SCREEN_OT_header", F9KEY, KM_PRESS, KM_ALT, 0); @@ -4779,12 +4779,12 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* Screen General ------------------------------------------------ */ keymap = WM_keymap_find(keyconf, "Screen", 0, 0); - + /* standard timers */ WM_keymap_add_item(keymap, "SCREEN_OT_animation_step", TIMER0, KM_ANY, KM_ANY, 0); WM_keymap_add_item(keymap, "SCREEN_OT_region_blend", TIMERREGION, KM_ANY, KM_ANY, 0); - - + + RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_screen_set", RIGHTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_screen_set", LEFTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1); WM_keymap_add_item(keymap, "SCREEN_OT_screen_full_area", SPACEKEY, KM_PRESS, KM_SHIFT, 0); @@ -4811,12 +4811,12 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_verify_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_redo_last", F6KEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "SCRIPT_OT_reload", F8KEY, KM_PRESS, 0, 0); - + /* files */ WM_keymap_add_item(keymap, "FILE_OT_execute", RETKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "FILE_OT_execute", PADENTER, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "FILE_OT_cancel", ESCKEY, KM_PRESS, 0, 0); - + /* undo */ #ifdef __APPLE__ WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_OSKEY, 0); @@ -4826,8 +4826,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT | KM_CTRL, 0); - - + + /* render */ kmi = WM_keymap_add_item(keymap, "RENDER_OT_render", F12KEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "use_viewport", true); @@ -4837,62 +4837,62 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "RENDER_OT_view_cancel", ESCKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "RENDER_OT_view_show", F11KEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "RENDER_OT_play_rendered_anim", F11KEY, KM_PRESS, KM_CTRL, 0); - + /* user prefs */ #ifdef __APPLE__ WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", COMMAKEY, KM_PRESS, KM_OSKEY, 0); #endif WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", UKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); - - + + /* Anim Playback ------------------------------------------------ */ keymap = WM_keymap_find(keyconf, "Frames", 0, 0); - + /* frame offsets */ RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", 10); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", -10); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", -1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 1); - + RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELUPMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1); - + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "end", true); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "end", false); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", true); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", false); - + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", UPARROWKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "next", true); kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "next", false); - + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "next", true); kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "next", false); - + /* play (forward and backwards) */ WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0)->ptr, "reverse", true); WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", ESCKEY, KM_PRESS, 0, 0); - + WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", MEDIAPLAY, KM_PRESS, 0, 0); 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 */ 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); - + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", LEFTARROWKEY, KM_PRESS, KM_ALT, 0); RNA_boolean_set(kmi->ptr, "reverse", true); RNA_boolean_set(kmi->ptr, "cycle_speed", true); - + WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", DOWNARROWKEY, KM_PRESS, KM_ALT, 0); #endif |