diff options
47 files changed, 218 insertions, 506 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 92ad7cc52a5..9dc57ac08bb 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -153,6 +153,21 @@ def op_tool_cycle(tool, kmi_args): # ------------------------------------------------------------------------------ # Keymap Templates +def _template_space_region_type_toggle(*, toolbar_key=None, sidebar_key=None): + items = [] + if toolbar_key is not None: + items.append( + ("wm.context_toggle", toolbar_key, + {"properties": [("data_path", 'space_data.show_region_toolbar')]}) + ) + if sidebar_key is not None: + items.append( + ("wm.context_toggle", sidebar_key, + {"properties": [("data_path", 'space_data.show_region_ui')]}), + ) + return items + + def _template_items_select_actions(params, operator): if not params.use_select_all_toggle: return [ @@ -900,8 +915,10 @@ def km_view3d_generic(_params): ) items.extend([ - ("view3d.properties", {"type": 'N', "value": 'PRESS'}, None), - ("view3d.toolshelf", {"type": 'T', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ) ]) return keymap @@ -1328,7 +1345,9 @@ def km_graph_editor_generic(_params): ) items.extend([ - ("graph.properties", {"type": 'N', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("graph.extrapolation_type", {"type": 'E', "value": 'PRESS', "shift": True}, None), ("anim.channels_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, None), ("graph.hide", {"type": 'H', "value": 'PRESS'}, @@ -1464,14 +1483,16 @@ def km_image_generic(_params): ) items.extend([ + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("image.new", {"type": 'N', "value": 'PRESS', "alt": True}, None), ("image.open", {"type": 'O', "value": 'PRESS', "alt": True}, None), ("image.reload", {"type": 'R', "value": 'PRESS', "alt": True}, None), ("image.read_viewlayers", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), ("image.save", {"type": 'S', "value": 'PRESS', "alt": True}, None), ("image.save_as", {"type": 'S', "value": 'PRESS', "shift": True}, None), - ("image.properties", {"type": 'N', "value": 'PRESS'}, None), - ("image.toolshelf", {"type": 'T', "value": 'PRESS'}, None), ("image.cycle_render_slot", {"type": 'J', "value": 'PRESS'}, None), ("image.cycle_render_slot", {"type": 'J', "value": 'PRESS', "alt": True}, {"properties": [("reverse", True)]}), @@ -1558,8 +1579,10 @@ def km_node_generic(_params): ) items.extend([ - ("node.properties", {"type": 'N', "value": 'PRESS'}, None), - ("node.toolbar", {"type": 'T', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ]) return keymap @@ -1864,9 +1887,10 @@ def km_dopesheet_generic(_params): ) items.extend([ - ("action.properties", {"type": 'N', "value": 'PRESS'}, None), - ("wm.context_set_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, - {"properties": [("data_path", 'area.type'), ("value", 'GRAPH_EDITOR')]}) + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ]) return keymap @@ -1985,7 +2009,9 @@ def km_nla_generic(_params): ) items.extend([ - ("nla.properties", {"type": 'N', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("nla.tweakmode_enter", {"type": 'TAB', "value": 'PRESS'}, None), ("nla.tweakmode_exit", {"type": 'TAB', "value": 'PRESS'}, None), ("nla.tweakmode_enter", {"type": 'TAB', "value": 'PRESS', "shift": True}, @@ -2098,11 +2124,13 @@ def km_text_generic(params): ) items.extend([ + *_template_space_region_type_toggle( + sidebar_key={"type": 'T', "value": 'PRESS', "ctrl": True}, + ), ("text.start_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, None), ("text.jump", {"type": 'J', "value": 'PRESS', "ctrl": True}, None), ("text.find", {"type": 'G', "value": 'PRESS', "ctrl": True}, None), ("text.replace", {"type": 'H', "value": 'PRESS', "ctrl": True}, None), - ("text.properties", {"type": 'T', "value": 'PRESS', "ctrl": True}, None), ]) if params.apple: @@ -2297,7 +2325,9 @@ def km_sequencercommon(_params): ) items.extend([ - ("sequencer.properties", {"type": 'N', "value": 'PRESS'}, None), + *_template_space_region_type_toggle( + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("wm.context_toggle", {"type": 'O', "value": 'PRESS', "shift": True}, {"properties": [("data_path", 'scene.sequence_editor.show_overlay')]}), ("sequencer.view_toggle", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, None), @@ -2521,9 +2551,11 @@ def km_clip(_params): ) items.extend([ + *_template_space_region_type_toggle( + toolbar_key={"type": 'T', "value": 'PRESS'}, + sidebar_key={"type": 'N', "value": 'PRESS'}, + ), ("clip.open", {"type": 'O', "value": 'PRESS', "alt": True}, None), - ("clip.tools", {"type": 'T', "value": 'PRESS'}, None), - ("clip.properties", {"type": 'N', "value": 'PRESS'}, None), ("clip.track_markers", {"type": 'LEFT_ARROW', "value": 'PRESS', "alt": True}, {"properties": [("backwards", True), ("sequence", False)]}), ("clip.track_markers", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True}, diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py index 4eb13b263c6..a91787298f8 100644 --- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -588,8 +588,10 @@ def km_view3d_generic(_params): ) items.extend([ - ("view3d.toolshelf", {"type": 'LEFT_BRACKET', "value": 'PRESS', "ctrl": True}, None), - ("view3d.properties", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, None), + ("wm.context_toggle", {"type": 'LEFT_BRACKET', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_region_toolbar')]}), + ("wm.context_toggle", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_region_ui')]}), ]) return keymap @@ -1277,7 +1279,8 @@ def km_dopesheet_generic(params): ) items.extend([ - ("action.properties", {"type": 'N', "value": 'PRESS'}, None), + ("wm.context_toggle", {"type": 'N', "value": 'PRESS'}, + {"properties": [("data_path", 'space_data.show_region_ui')]}), ("wm.context_set_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, {"properties": [("data_path", 'area.type'), ("value", 'GRAPH_EDITOR')]}) ]) @@ -1482,7 +1485,8 @@ def km_text_generic(params): ("text.jump", {"type": 'J', "value": 'PRESS', "ctrl": True}, None), ("text.find", {"type": 'G', "value": 'PRESS', "ctrl": True}, None), ("text.replace", {"type": 'H', "value": 'PRESS', "ctrl": True}, None), - ("text.properties", {"type": 'I', "value": 'PRESS', "ctrl": True}, None), + ("wm.context_toggle", {"type": 'I', "value": 'PRESS', "ctrl": True}, + {"properties": [("data_path", 'space_data.show_region_ui')]}), ]) return keymap @@ -1638,7 +1642,8 @@ def km_sequencercommon(_params): ) items.extend([ - ("sequencer.properties", {"type": 'N', "value": 'PRESS'}, None), + ("wm.context_toggle", {"type": 'N', "value": 'PRESS'}, + {"properties": [("data_path", 'space_data.show_region_ui')]}), ("wm.context_toggle", {"type": 'O', "value": 'PRESS', "shift": True}, {"properties": [("data_path", 'scene.sequence_editor.show_overlay')]}), #("sequencer.view_toggle", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, None), diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 436a87c2e93..32c8d9af0bc 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -1231,8 +1231,9 @@ class CLIP_MT_view(Menu): sc = context.space_data if sc.view == 'CLIP': - layout.operator("clip.properties", icon='MENU_PANEL') - layout.operator("clip.tools", icon='MENU_PANEL') + layout.prop(sc, "show_region_ui") + layout.prop(sc, "show_region_toolbar") + layout.separator() layout.operator("clip.view_selected") diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index e3d5aaf2169..d67ceacd3de 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -323,7 +323,8 @@ class DOPESHEET_MT_view(Menu): st = context.space_data - layout.operator("action.properties", icon='MENU_PANEL') + layout.prop(st, "show_region_ui") + layout.separator() layout.prop(st.dopesheet, "use_multi_word_filter", text="Multi-word Match Search") diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index 09f9529c302..2e7fb2e0083 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -111,7 +111,7 @@ class GRAPH_MT_view(Menu): st = context.space_data - layout.operator("graph.properties", icon='MENU_PANEL') + layout.prop(st, "show_region_ui") layout.separator() layout.prop(st, "use_realtime_update") diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index de0b6f8cc1d..163e75165da 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -69,8 +69,8 @@ class IMAGE_MT_view(Menu): show_uvedit = sima.show_uvedit show_render = sima.show_render - layout.operator("image.properties", icon='MENU_PANEL') - layout.operator("image.toolshelf", icon='MENU_PANEL') + layout.prop(sima, "show_region_toolbar") + layout.prop(sima, "show_region_ui") layout.separator() diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index 62a8e87b779..a836fdf5d19 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -87,8 +87,7 @@ class NLA_MT_view(Menu): st = context.space_data - layout.operator("nla.properties", icon='MENU_PANEL') - + layout.prop(st, "show_region_ui") layout.separator() layout.prop(st, "use_realtime_update") diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 12c51da3e29..374ef912303 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -213,8 +213,8 @@ class NODE_MT_view(Menu): snode = context.space_data - layout.operator("node.properties", icon='MENU_PANEL') - layout.operator("node.toolbar", icon='MENU_PANEL') + layout.prop(snode, "show_region_toolbar") + layout.prop(snode, "show_region_ui") layout.separator() diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 95e76bd077c..f8c628faf22 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -175,7 +175,7 @@ class SEQUENCER_MT_view(Menu): # mode, else the lookup for the shortcut will fail in # wm_keymap_item_find_props() (see #32595). layout.operator_context = 'INVOKE_REGION_PREVIEW' - layout.operator("sequencer.properties", icon='MENU_PANEL') + layout.prop(st, "show_region_ui") layout.operator_context = 'INVOKE_DEFAULT' layout.separator() diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 07184c81e42..917c700f027 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -188,7 +188,9 @@ class TEXT_MT_view(Menu): def draw(self, context): layout = self.layout - layout.operator("text.properties", icon='MENU_PANEL') + st = context.space_data + + layout.prop(st, "show_region_ui") layout.separator() diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 9c326372f89..074773c6bc9 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -580,8 +580,8 @@ class VIEW3D_MT_view(Menu): layout = self.layout view = context.space_data - layout.operator("view3d.toolshelf", icon='MENU_PANEL') - layout.operator("view3d.properties", icon='MENU_PANEL') + layout.prop(view, "show_region_toolbar") + layout.prop(view, "show_region_ui") layout.separator() diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index bcf9cb3fcc0..04bbbbdf25f 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -100,7 +100,14 @@ void ED_region_header_draw(const struct bContext *C, struct ARegion *ar); void ED_region_cursor_set(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar); void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar); -void ED_region_visibility_change_update(struct bContext *C, struct ARegion *ar); +void ED_region_visibility_change_update(struct bContext *C, + struct ScrArea *sa, + struct ARegion *ar); +/* screen_ops.c */ +void ED_region_visibility_change_update_animated(struct bContext *C, + struct ScrArea *sa, + struct ARegion *ar); + void ED_region_info_draw(struct ARegion *ar, const char *text, float fill_color[4], diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index ce952b50f9d..b4ea97d6e04 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1735,10 +1735,8 @@ void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *ar) } /* for use after changing visibility of regions */ -void ED_region_visibility_change_update(bContext *C, ARegion *ar) +void ED_region_visibility_change_update(bContext *C, ScrArea *sa, ARegion *ar) { - ScrArea *sa = CTX_wm_area(C); - if (ar->flag & RGN_FLAG_HIDDEN) WM_event_remove_handlers(C, &ar->handlers); @@ -1755,10 +1753,10 @@ void region_toggle_hidden(bContext *C, ARegion *ar, const bool do_fade) if (do_fade && ar->overlap) { /* starts a timer, and in end calls the stuff below itself (region_sblend_invoke()) */ - region_blend_start(C, sa, ar); + ED_region_visibility_change_update_animated(C, sa, ar); } else { - ED_region_visibility_change_update(C, ar); + ED_region_visibility_change_update(C, sa, ar); } } diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index d2c43d1df28..4971b310eff 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -89,9 +89,6 @@ extern const char *screen_context_dir[]; /* doc access */ /* screendump.c */ void SCREEN_OT_screenshot(struct wmOperatorType *ot); -/* screen_ops.c */ -void region_blend_start(struct bContext *C, struct ScrArea *sa, struct ARegion *ar); - /* workspace_layout_edit.c */ bool workspace_layout_set_poll(const struct WorkSpaceLayout *layout); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f059659806e..9b69c6dbf93 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4785,7 +4785,7 @@ static void region_blend_end(bContext *C, ARegion *ar, const bool is_running) ar->regiontimer = NULL; } /* assumes that *ar itself is not a splitted version from previous region */ -void region_blend_start(bContext *C, ScrArea *sa, ARegion *ar) +void ED_region_visibility_change_update_animated(bContext *C, ScrArea *sa, ARegion *ar) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); diff --git a/source/blender/editors/space_action/action_buttons.c b/source/blender/editors/space_action/action_buttons.c index a30d5f34ed0..c9c20adcab4 100644 --- a/source/blender/editors/space_action/action_buttons.c +++ b/source/blender/editors/space_action/action_buttons.c @@ -92,27 +92,3 @@ void action_buttons_register(ARegionType *UNUSED(art)) BLI_addtail(&art->paneltypes, pt); #endif } - -static int action_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = action_has_buttons_region(sa); - - if (ar) - ED_region_toggle_hidden(C, ar); - - return OPERATOR_FINISHED; -} - -void ACTION_OT_properties(wmOperatorType *ot) -{ - ot->name = "Toggle Sidebar"; - ot->idname = "ACTION_OT_properties"; - ot->description = "Toggle the properties region visibility"; - - ot->exec = action_properties_toggle_exec; - ot->poll = ED_operator_action_active; - - /* flags */ - ot->flag = 0; -} diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index 5d86cf6faec..bf2880dea36 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -43,7 +43,6 @@ struct wmOperatorType; struct ARegion *action_has_buttons_region(struct ScrArea *sa); void action_buttons_register(struct ARegionType *art); -void ACTION_OT_properties(struct wmOperatorType *ot); /* ***************************************** */ /* action_draw.c */ diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index d5ddf974284..4419a4d068e 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -43,9 +43,6 @@ void action_operatortypes(void) { - /* view */ - WM_operatortype_append(ACTION_OT_properties); - /* keyframes */ /* selection */ WM_operatortype_append(ACTION_OT_clickselect); 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 */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index ac77095cbe2..8742f5d408c 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -1405,27 +1405,3 @@ void graph_buttons_register(ARegionType *art) pt->draw = graph_panel_view; BLI_addtail(&art->paneltypes, pt); } - -static int graph_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = graph_has_buttons_region(sa); - - if (ar) - ED_region_toggle_hidden(C, ar); - - return OPERATOR_FINISHED; -} - -void GRAPH_OT_properties(wmOperatorType *ot) -{ - ot->name = "Toggle Sidebar"; - ot->idname = "GRAPH_OT_properties"; - ot->description = "Toggle the properties region visibility"; - - ot->exec = graph_properties_toggle_exec; - ot->poll = ED_operator_graphedit_active; - - /* flags */ - ot->flag = 0; -} diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index 7d0a3a1f13d..73dd1ae68f7 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -164,7 +164,6 @@ void GRAPH_OT_ghost_curves_clear(struct wmOperatorType *ot); /* ***************************************** */ /* graph_buttons.c */ -void GRAPH_OT_properties(struct wmOperatorType *ot); void graph_buttons_register(struct ARegionType *art); /* ***************************************** */ diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 6bbc6a2de1c..f80041ff586 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -415,7 +415,6 @@ void graphedit_operatortypes(void) WM_operatortype_append(GRAPH_OT_previewrange_set); WM_operatortype_append(GRAPH_OT_view_all); WM_operatortype_append(GRAPH_OT_view_selected); - WM_operatortype_append(GRAPH_OT_properties); WM_operatortype_append(GRAPH_OT_view_frame); WM_operatortype_append(GRAPH_OT_ghost_curves_create); diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index 1c3b4f1377b..8029f0b796e 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -66,7 +66,7 @@ void ED_drivers_editor_init(bContext *C, ScrArea *sa) ar_props->flag &= ~RGN_FLAG_HIDDEN; /* XXX: Adjust width of this too? */ - ED_region_visibility_change_update(C, ar_props); + ED_region_visibility_change_update(C, sa, ar_props); } else { printf("%s: Couldn't find properties region for Drivers Editor - %p\n", __func__, sa); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 66e5607b06d..4bd4ddde2f9 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -1521,53 +1521,3 @@ void image_buttons_register(ARegionType *art) pt->flag |= PNL_DEFAULT_CLOSED; BLI_addtail(&art->paneltypes, pt); } - -static int image_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = image_has_buttons_region(sa); - - if (ar) { - ED_region_toggle_hidden(C, ar); - } - - return OPERATOR_FINISHED; -} - -void IMAGE_OT_properties(wmOperatorType *ot) -{ - ot->name = "Toggle Sidebar"; - ot->idname = "IMAGE_OT_properties"; - ot->description = "Toggle the properties region visibility"; - - ot->exec = image_properties_toggle_exec; - ot->poll = ED_operator_image_active; - - /* flags */ - ot->flag = 0; -} - -static int image_scopes_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = image_has_tools_region(sa); - - if (ar) { - ED_region_toggle_hidden(C, ar); - } - - return OPERATOR_FINISHED; -} - -void IMAGE_OT_toolshelf(wmOperatorType *ot) -{ - ot->name = "Toggle Toolbar"; - ot->idname = "IMAGE_OT_toolshelf"; - ot->description = "Toggles tool shelf display"; - - ot->exec = image_scopes_toggle_exec; - ot->poll = ED_operator_image_active; - - /* flags */ - ot->flag = 0; -} diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index db56f1051c5..180ad93a33c 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -91,7 +91,5 @@ void IMAGE_OT_clear_render_border(struct wmOperatorType *ot); /* image_panels.c */ struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree); void image_buttons_register(struct ARegionType *art); -void IMAGE_OT_properties(struct wmOperatorType *ot); -void IMAGE_OT_toolshelf(struct wmOperatorType *ot); #endif /* __IMAGE_INTERN_H__ */ diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 9c834f09fd4..3160e419393 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -291,9 +291,6 @@ static void image_operatortypes(void) WM_operatortype_append(IMAGE_OT_sample_line); WM_operatortype_append(IMAGE_OT_curves_point_set); - WM_operatortype_append(IMAGE_OT_properties); - WM_operatortype_append(IMAGE_OT_toolshelf); - WM_operatortype_append(IMAGE_OT_change_frame); WM_operatortype_append(IMAGE_OT_read_viewlayers); diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index b19dc3680bf..fb657a31d34 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -562,27 +562,3 @@ void nla_buttons_register(ARegionType *art) pt->poll = nla_strip_eval_panel_poll; BLI_addtail(&art->paneltypes, pt); } - -static int nla_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = nla_has_buttons_region(sa); - - if (ar) - ED_region_toggle_hidden(C, ar); - - return OPERATOR_FINISHED; -} - -void NLA_OT_properties(wmOperatorType *ot) -{ - ot->name = "Toggle Sidebar"; - ot->idname = "NLA_OT_properties"; - ot->description = "Toggle the properties region visibility"; - - ot->exec = nla_properties_toggle_exec; - ot->poll = ED_operator_nla_active; - - /* flags */ - ot->flag = 0; -} diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 291dfe17343..ea067cf4847 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -40,7 +40,6 @@ bool nla_panel_context(const bContext *C, PointerRNA *strip_ptr); void nla_buttons_register(ARegionType *art); -void NLA_OT_properties(wmOperatorType *ot); /* **************************************** */ /* nla_draw.c */ diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 51d6232cf71..2715c07164b 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -100,9 +100,6 @@ bool nlaedit_is_tweakmode_on(bAnimContext *ac) void nla_operatortypes(void) { - /* view */ - WM_operatortype_append(NLA_OT_properties); - /* channels */ WM_operatortype_append(NLA_OT_channels_click); diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 63e97ecd955..072a67dee6c 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -226,35 +226,3 @@ void node_buttons_register(ARegionType *art) pt->poll = node_tree_interface_poll; BLI_addtail(&art->paneltypes, pt); } - -static int node_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = node_has_buttons_region(sa); - - if (ar) { - ED_region_toggle_hidden(C, ar); - } - - return OPERATOR_FINISHED; -} - -/* non-standard poll operator which doesn't care if there are any nodes */ -static bool node_properties_poll(bContext *C) -{ - ScrArea *sa = CTX_wm_area(C); - return (sa && (sa->spacetype == SPACE_NODE)); -} - -void NODE_OT_properties(wmOperatorType *ot) -{ - ot->name = "Toggle Sidebar"; - ot->description = "Toggle the properties region visibility"; - ot->idname = "NODE_OT_properties"; - - ot->exec = node_properties_toggle_exec; - ot->poll = node_properties_poll; - - /* flags */ - ot->flag = 0; -} diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 7b4102ce324..ce198d3e85c 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -95,11 +95,9 @@ void node_from_view(struct bNode *node, float x, float y, float *rx, float *ry); /* node_buttons.c */ void node_buttons_register(struct ARegionType *art); -void NODE_OT_properties(struct wmOperatorType *ot); /* node_toolbar.c */ void node_toolbar_register(struct ARegionType *art); -void NODE_OT_toolbar(struct wmOperatorType *ot); /* node_ops.c */ void node_operatortypes(void); diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index ce6bf2820c6..0836617ab44 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -41,9 +41,6 @@ void node_operatortypes(void) { - WM_operatortype_append(NODE_OT_properties); - WM_operatortype_append(NODE_OT_toolbar); - WM_operatortype_append(NODE_OT_select); WM_operatortype_append(NODE_OT_select_all); WM_operatortype_append(NODE_OT_select_linked_to); diff --git a/source/blender/editors/space_node/node_toolbar.c b/source/blender/editors/space_node/node_toolbar.c index bc7119fa4ab..7afd3fef4db 100644 --- a/source/blender/editors/space_node/node_toolbar.c +++ b/source/blender/editors/space_node/node_toolbar.c @@ -40,37 +40,3 @@ void node_toolbar_register(ARegionType *UNUSED(art)) { } - -/* ********** operator to open/close toolshelf region */ - -static int node_toolbar_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = node_has_tools_region(sa); - - if (ar) { - ED_region_toggle_hidden(C, ar); - } - - return OPERATOR_FINISHED; -} - -/* non-standard poll operator which doesn't care if there are any nodes */ -static bool node_toolbar_poll(bContext *C) -{ - ScrArea *sa = CTX_wm_area(C); - return (sa && (sa->spacetype == SPACE_NODE)); -} - -void NODE_OT_toolbar(wmOperatorType *ot) -{ - ot->name = "Tool Shelf"; - ot->description = "Toggles tool shelf display"; - ot->idname = "NODE_OT_toolbar"; - - ot->exec = node_toolbar_toggle_exec; - ot->poll = node_toolbar_poll; - - /* flags */ - ot->flag = 0; -} diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index 8d9fea2cb98..a6458ee5d31 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -119,30 +119,3 @@ void sequencer_buttons_register(ARegionType *art) pt->flag |= PNL_DEFAULT_CLOSED; BLI_addtail(&art->paneltypes, pt); } - -/* **************** operator to open/close properties view ************* */ - -static int sequencer_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = sequencer_has_buttons_region(sa); - - if (ar) { - ED_region_toggle_hidden(C, ar); - } - - return OPERATOR_FINISHED; -} - -void SEQUENCER_OT_properties(wmOperatorType *ot) -{ - ot->name = "Properties"; - ot->idname = "SEQUENCER_OT_properties"; - ot->description = "Toggle the properties region visibility"; - - ot->exec = sequencer_properties_toggle_exec; - ot->poll = ED_operator_sequencer_active; - - /* flags */ - ot->flag = 0; -} diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index a051071ab61..88181e4127f 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -210,7 +210,6 @@ struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf *ibuf); /* sequencer_buttons.c */ void sequencer_buttons_register(struct ARegionType *art); -void SEQUENCER_OT_properties(struct wmOperatorType *ot); /* sequencer_modifiers.c */ void SEQUENCER_OT_strip_modifier_add(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 6adca28a3fa..b0bb775de83 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -109,9 +109,6 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_image_strip_add); WM_operatortype_append(SEQUENCER_OT_effect_strip_add); - /* sequencer_buttons.c */ - WM_operatortype_append(SEQUENCER_OT_properties); - /* sequencer_modifiers.c */ WM_operatortype_append(SEQUENCER_OT_strip_modifier_add); WM_operatortype_append(SEQUENCER_OT_strip_modifier_remove); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 9232d0322ab..506babafb6e 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -219,8 +219,6 @@ static void text_operatortypes(void) WM_operatortype_append(TEXT_OT_line_break); WM_operatortype_append(TEXT_OT_insert); - WM_operatortype_append(TEXT_OT_properties); - WM_operatortype_append(TEXT_OT_find); WM_operatortype_append(TEXT_OT_find_set_selected); WM_operatortype_append(TEXT_OT_replace); diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index cbb3be0f1c8..6f81a3ad659 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -71,29 +71,6 @@ static bool text_properties_poll(bContext *C) return (CTX_wm_space_text(C) != NULL); } -static int text_properties_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = text_has_properties_region(sa); - - if (ar) - ED_region_toggle_hidden(C, ar); - - return OPERATOR_FINISHED; -} - -void TEXT_OT_properties(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Toggle Sidebar"; - ot->description = "Toggle the properties region visibility"; - ot->idname = "TEXT_OT_properties"; - - /* api callbacks */ - ot->exec = text_properties_exec; - ot->poll = text_properties_poll; -} - static int text_text_search_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index cf28f3d317c..aab5069f919 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -145,8 +145,6 @@ void TEXT_OT_selection_set(struct wmOperatorType *ot); void TEXT_OT_cursor_set(struct wmOperatorType *ot); void TEXT_OT_line_number(struct wmOperatorType *ot); -void TEXT_OT_properties(struct wmOperatorType *ot); - /* find = find indicated text */ void TEXT_OT_find(struct wmOperatorType *ot); void TEXT_OT_find_set_selected(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index 279c6913064..1514f7a236b 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -64,7 +64,6 @@ set(SRC view3d_project.c view3d_select.c view3d_snap.c - view3d_toolbar.c view3d_utils.c view3d_view.c view3d_walk.c diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index abe36b1d563..987f09e049a 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1628,31 +1628,6 @@ void view3d_buttons_register(ARegionType *art) WM_menutype_add(mt); } -static int view3d_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = view3d_has_buttons_region(sa); - - if (ar) { - ED_region_toggle_hidden(C, ar); - } - - return OPERATOR_FINISHED; -} - -void VIEW3D_OT_properties(wmOperatorType *ot) -{ - ot->name = "Toggle Sidebar"; - ot->description = "Toggle the properties region visibility"; - ot->idname = "VIEW3D_OT_properties"; - - ot->exec = view3d_properties_toggle_exec; - ot->poll = ED_operator_view3d_active; - - /* flags */ - ot->flag = 0; -} - static int view3d_object_mode_menu(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index fd306619577..4974e2269b3 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -234,7 +234,6 @@ void viewzoom_modal_keymap(struct wmKeyConfig *keyconf); void viewdolly_modal_keymap(struct wmKeyConfig *keyconf); /* view3d_buttons.c */ -void VIEW3D_OT_properties(struct wmOperatorType *ot); void VIEW3D_OT_object_mode_pie_or_toggle(struct wmOperatorType *ot); void view3d_buttons_register(struct ARegionType *art); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 4e33005ebc0..e5a145b0411 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -199,9 +199,7 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_copybuffer); WM_operatortype_append(VIEW3D_OT_pastebuffer); - WM_operatortype_append(VIEW3D_OT_properties); WM_operatortype_append(VIEW3D_OT_object_mode_pie_or_toggle); - WM_operatortype_append(VIEW3D_OT_toolshelf); WM_operatortype_append(VIEW3D_OT_snap_selected_to_grid); WM_operatortype_append(VIEW3D_OT_snap_selected_to_cursor); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c deleted file mode 100644 index 9357d3e05ee..00000000000 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup spview3d - */ - -#include <string.h> -#include <stdio.h> -#include <math.h> -#include <float.h> - -#include "DNA_scene_types.h" - -#include "BLI_utildefines.h" - -#include "BKE_context.h" - -#include "WM_api.h" -#include "WM_types.h" - -#include "ED_screen.h" - -#include "view3d_intern.h" /* own include */ - -/* ********** operator to open/close toolshelf region */ - -static int view3d_toolshelf_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = view3d_has_tools_region(sa); - - if (ar) { - ED_region_toggle_hidden(C, ar); - } - - return OPERATOR_FINISHED; -} - -void VIEW3D_OT_toolshelf(wmOperatorType *ot) -{ - ot->name = "Toggle Toolbar"; - ot->description = "Toggles tool shelf display"; - ot->idname = "VIEW3D_OT_toolshelf"; - - ot->exec = view3d_toolshelf_toggle_exec; - ot->poll = ED_operator_view3d_active; - - /* flags */ - ot->flag = 0; -} diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d5b12ed5d5b..f6ce958752d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -550,6 +550,91 @@ static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **r_sa, ARe area_region_from_regiondata(sc, regiondata, r_sa, r_ar); } +/* -------------------------------------------------------------------- */ +/** \name Generic Region Flag Access + * \{ */ + +static bool rna_Space_bool_from_region_flag_get_by_type(PointerRNA *ptr, + const int region_type, + const int region_flag) +{ + ScrArea *sa = rna_area_from_space(ptr); + ARegion *ar = BKE_area_find_region_type(sa, region_type); + if (ar) { + return (ar->flag & region_flag); + } + return false; +} + +static void rna_Space_bool_from_region_flag_set_by_type(PointerRNA *ptr, + const int region_type, + const int region_flag, + bool value) +{ + ScrArea *sa = rna_area_from_space(ptr); + ARegion *ar = BKE_area_find_region_type(sa, region_type); + if (ar) { + SET_FLAG_FROM_TEST(ar->flag, value, region_flag); + } + ED_region_tag_redraw(ar); +} + +static void rna_Space_bool_from_region_flag_update_by_type(bContext *C, + PointerRNA *ptr, + const int region_type, + const int region_flag) +{ + ScrArea *sa = rna_area_from_space(ptr); + ARegion *ar = BKE_area_find_region_type(sa, region_type); + if (ar) { + if (region_flag == RGN_FLAG_HIDDEN) { + /* Only support animation when the area is in the current context. */ + if (ar->overlap && (sa == CTX_wm_area(C))) { + ED_region_visibility_change_update_animated(C, sa, ar); + } + else { + ED_region_visibility_change_update(C, sa, ar); + } + } + } +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Region Flag Access (Typed Callbacks) + * \{ */ + +/* Tools Region. */ +static bool rna_Space_show_region_toolbar_get(PointerRNA *ptr) +{ + return !rna_Space_bool_from_region_flag_get_by_type(ptr, RGN_TYPE_TOOLS, RGN_FLAG_HIDDEN); +} +static void rna_Space_show_region_toolbar_set(PointerRNA *ptr, bool value) +{ + rna_Space_bool_from_region_flag_set_by_type(ptr, RGN_TYPE_TOOLS, RGN_FLAG_HIDDEN, !value); +} +static void rna_Space_show_region_toolbar_update(bContext *C, PointerRNA *ptr) +{ + rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_TOOLS, RGN_FLAG_HIDDEN); +} + +/* UI Region */ +static bool rna_Space_show_region_ui_get(PointerRNA *ptr) +{ + return !rna_Space_bool_from_region_flag_get_by_type(ptr, RGN_TYPE_UI, RGN_FLAG_HIDDEN); +} +static void rna_Space_show_region_ui_set(PointerRNA *ptr, bool value) +{ + rna_Space_bool_from_region_flag_set_by_type(ptr, RGN_TYPE_UI, RGN_FLAG_HIDDEN, !value); +} +static void rna_Space_show_region_ui_update(bContext *C, PointerRNA *ptr) +{ + rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_UI, RGN_FLAG_HIDDEN); +} + +/** \} */ + static bool rna_Space_view2d_sync_get(PointerRNA *ptr) { ScrArea *sa; @@ -1731,7 +1816,7 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr) else { channels_region->flag &= ~RGN_FLAG_HIDDEN; } - ED_region_visibility_change_update(C, channels_region); + ED_region_visibility_change_update(C, sa, channels_region); } } @@ -2308,6 +2393,33 @@ static void rna_def_space(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Space_view2d_sync_update"); } +static void rna_def_space_generic_show_region_toggles(StructRNA *srna, int region_type_mask) +{ + PropertyRNA *prop; + +# define DEF_SHOW_REGION_PROPERTY(identifier, label, description) \ + { \ + prop = RNA_def_property(srna, STRINGIFY(identifier), PROP_BOOLEAN, PROP_NONE); \ + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); \ + RNA_def_property_boolean_funcs(prop, \ + STRINGIFY(rna_Space_##identifier##_get), \ + STRINGIFY(rna_Space_##identifier##_set)); \ + RNA_def_property_ui_text(prop, label, description); \ + RNA_def_property_update(prop, 0, STRINGIFY(rna_Space_##identifier##_update)); \ + } \ + ((void)0) + + if (region_type_mask & (1 << RGN_TYPE_TOOLS)) { + region_type_mask &= ~(1 << RGN_TYPE_TOOLS); + DEF_SHOW_REGION_PROPERTY(show_region_toolbar, "Toolbar", ""); + } + if (region_type_mask & (1 << RGN_TYPE_UI)) { + region_type_mask &= ~(1 << RGN_TYPE_UI); + DEF_SHOW_REGION_PROPERTY(show_region_ui, "Sidebar", ""); + } + BLI_assert(region_type_mask == 0); +} + /* for all spaces that use a mask */ static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *mask_set_func) { @@ -3387,6 +3499,8 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_struct_sdna(srna, "View3D"); RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI)); + prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_sdna(prop, NULL, "camera"); @@ -3891,6 +4005,8 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceImage"); RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI)); + /* image */ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceImageEditor_image_set", NULL, NULL); @@ -4119,6 +4235,8 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceSeq"); RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI)); + /* view type, fairly important */ prop = RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "view"); @@ -4261,6 +4379,8 @@ static void rna_def_space_text(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceText"); RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI)); + /* text */ prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); @@ -4383,6 +4503,8 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceAction"); RNA_def_struct_ui_text(srna, "Space Dope Sheet Editor", "Dope Sheet space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI)); + /* data */ prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); @@ -4561,6 +4683,8 @@ static void rna_def_space_graph(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceGraph"); RNA_def_struct_ui_text(srna, "Space Graph Editor", "Graph Editor space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI)); + /* mode */ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); @@ -4712,6 +4836,8 @@ static void rna_def_space_nla(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceNla"); RNA_def_struct_ui_text(srna, "Space Nla Editor", "NLA editor space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI)); + /* display */ prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_DRAWTIME); @@ -5503,6 +5629,8 @@ static void rna_def_space_node(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceNode"); RNA_def_struct_ui_text(srna, "Space Node Editor", "Node editor space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI)); + prop = RNA_def_property(srna, "tree_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, dummy_items); RNA_def_property_enum_funcs(prop, @@ -5679,6 +5807,8 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceClip"); RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data"); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI)); + /* movieclip */ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); |