diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-18 13:16:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-18 13:44:17 +0300 |
commit | 6aef124e7d2869a692dd564a4515f2304924da33 (patch) | |
tree | 9ed5d09fd9a94761ce08db54abe2b5082a00029f /source/blender/editors/space_clip | |
parent | d55a9cac2c0aa6a7d130a256cac7c04e52cdee4a (diff) |
UI: move region toggling to properties
Each space had separate operators, duplicating logic.
Use RNA properties instead so adding the ability to toggle other
region types (floating redo region for eg) doesn't need to have an
extra operator per space type.
It's also nicer to show a check-box for something which can be toggled.
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_toolbar.c | 92 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 4 |
3 files changed, 0 insertions, 98 deletions
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 8ecf596fac7..70dc1caf36f 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -110,8 +110,6 @@ void CLIP_OT_cursor_set(struct wmOperatorType *ot); /* clip_toolbar.c */ struct ARegion *ED_clip_has_properties_region(struct ScrArea *sa); -void CLIP_OT_tools(struct wmOperatorType *ot); -void CLIP_OT_properties(struct wmOperatorType *ot); /* clip_utils.c */ void clip_graph_tracking_values_iterate_track( diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c index acb05e7d542..d54a6da9a3c 100644 --- a/source/blender/editors/space_clip/clip_toolbar.c +++ b/source/blender/editors/space_clip/clip_toolbar.c @@ -78,95 +78,3 @@ ARegion *ED_clip_has_properties_region(ScrArea *sa) return arnew; } - -static bool properties_poll(bContext *C) -{ - return (CTX_wm_space_clip(C) != NULL); -} - -static int properties_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = ED_clip_has_properties_region(sa); - - if (ar && ar->alignment != RGN_ALIGN_NONE) - ED_region_toggle_hidden(C, ar); - - return OPERATOR_FINISHED; -} - -void CLIP_OT_properties(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Toggle Sidebar"; - ot->description = "Toggle the properties region visibility"; - ot->idname = "CLIP_OT_properties"; - - /* api callbacks */ - ot->exec = properties_exec; - ot->poll = properties_poll; -} - -/************************** tools ******************************/ - -static ARegion *clip_has_tools_region(ScrArea *sa) -{ - ARegion *ar, *artool = NULL, *arhead; - - for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_TOOLS) - artool = ar; - } - - /* tool region hide/unhide also hides props */ - if (artool) { - return artool; - } - - if (artool == NULL) { - /* add subdiv level; after header */ - arhead = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); - - /* is error! */ - if (arhead == NULL) - return NULL; - - artool = MEM_callocN(sizeof(ARegion), "clip tools region"); - - BLI_insertlinkafter(&sa->regionbase, arhead, artool); - artool->regiontype = RGN_TYPE_TOOLS; - artool->alignment = RGN_ALIGN_LEFT; - - artool->flag = RGN_FLAG_HIDDEN; - } - - return artool; -} - -static bool tools_poll(bContext *C) -{ - return (CTX_wm_space_clip(C) != NULL); -} - -static int tools_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = clip_has_tools_region(sa); - - if (ar && ar->alignment != RGN_ALIGN_NONE) - ED_region_toggle_hidden(C, ar); - - return OPERATOR_FINISHED; -} - -void CLIP_OT_tools(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Toggle Toolbar"; - ot->description = "Toggle clip tools panel"; - ot->idname = "CLIP_OT_tools"; - - /* api callbacks */ - ot->exec = tools_exec; - ot->poll = tools_poll; -} diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 7c62af80a0f..d12e6634987 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -434,10 +434,6 @@ static void clip_operatortypes(void) WM_operatortype_append(CLIP_OT_set_scene_frames); WM_operatortype_append(CLIP_OT_cursor_set); - /* ** clip_toolbar.c ** */ - WM_operatortype_append(CLIP_OT_tools); - WM_operatortype_append(CLIP_OT_properties); - /* ** tracking_ops.c ** */ /* navigation */ |