[Bf-blender-cvs] [b00d971efe6] blender2.8: UI: Apply remove redo region
Campbell Barton
noreply at git.blender.org
Wed Apr 25 07:57:00 CEST 2018
Commit: b00d971efe67799042577cf0391bb34e9f870835
Author: Campbell Barton
Date: Wed Apr 25 07:52:40 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb00d971efe67799042577cf0391bb34e9f870835
UI: Apply remove redo region
This was a disabled part of the top-bar merge (code by @Severin)
The only change made is to move to redo UI into a popover.
===================================================================
M release/scripts/startup/bl_ui/space_topbar.py
M source/blender/blenkernel/BKE_blender_version.h
M source/blender/blenloader/intern/versioning_280.c
M source/blender/editors/include/ED_undo.h
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/space_clip/clip_toolbar.c
M source/blender/editors/space_clip/space_clip.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/editors/space_view3d/view3d_intern.h
M source/blender/editors/space_view3d/view3d_toolbar.c
M source/blender/editors/undo/ed_undo.c
M source/blender/makesdna/DNA_space_types.h
M source/blender/makesrna/intern/rna_ui_api.c
M source/blender/windowmanager/intern/wm.c
M source/blender/windowmanager/intern/wm_event_system.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 87a4a91b257..9db584aee2e 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -101,8 +101,7 @@ class TOPBAR_HT_lower_bar(Header):
elif region.alignment == 'RIGHT':
self.draw_right(context)
else:
- # WITH_REDO_REGION_REMOVAL:
- # layout.template_operator_redo_props()
+ # 'NONE' currently not used
pass
def draw_left(self, context):
@@ -133,13 +132,23 @@ class TOPBAR_HT_lower_bar(Header):
row = layout.row()
row.enabled = op is not None
row.popover(
- space_type='VIEW_3D',
- region_type='TOOL_PROPS',
- panel_type="VIEW3D_PT_last_operator",
+ space_type='TOPBAR',
+ region_type='WINDOW',
+ panel_type="TOPBAR_PT_redo",
text=op.name + " Settings" if op else "Command Settings",
)
+class TOPBAR_PT_redo(Panel):
+ bl_label = "Redo"
+ bl_space_type = 'TOPBAR'
+ bl_region_type = 'WINDOW'
+
+ def draw(self, context):
+ layout = self.layout
+ layout.column().template_operator_redo_props()
+
+
class INFO_MT_editor_menus(Menu):
bl_idname = "INFO_MT_editor_menus"
bl_label = ""
@@ -406,6 +415,7 @@ class INFO_MT_help(Menu):
classes = (
TOPBAR_HT_upper_bar,
TOPBAR_HT_lower_bar,
+ TOPBAR_PT_redo,
INFO_MT_editor_menus,
INFO_MT_file,
INFO_MT_file_import,
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 6ba9e3eab9c..194757561d7 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 11
+#define BLENDER_SUBVERSION 12
/* Several breakages with 270, e.g. constraint deg vs rad */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 6
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index f036d018a03..ef6c05ff59f 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1054,8 +1054,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
-#ifdef WITH_REDO_REGION_REMOVAL
- if (!MAIN_VERSION_ATLEAST(main, 280, TO_BE_DETERMINED)) {
+ if (!MAIN_VERSION_ATLEAST(main, 280, 12)) {
/* Remove tool property regions. */
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
@@ -1076,5 +1075,4 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
-#endif
}
diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h
index da8cd95555c..6df568a6bc9 100644
--- a/source/blender/editors/include/ED_undo.h
+++ b/source/blender/editors/include/ED_undo.h
@@ -52,7 +52,6 @@ int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op);
void ED_undo_operator_repeat_cb(struct bContext *C, void *arg_op, void *arg_unused);
void ED_undo_operator_repeat_cb_evt(struct bContext *C, void *arg_op, int arg_unused);
-#ifdef WITH_REDO_REGION_REMOVAL
/* Context sanity helpers for operator repeat. */
typedef struct OperatorRepeatContextHandle OperatorRepeatContextHandle;
@@ -60,7 +59,6 @@ const OperatorRepeatContextHandle *ED_operator_repeat_prepare_context(
struct bContext *C, struct wmOperator *op) ATTR_WARN_UNUSED_RESULT;
void ED_operator_repeat_reset_context(
struct bContext *C, const OperatorRepeatContextHandle *context_info);
-#endif
bool ED_undo_is_valid(const struct bContext *C, const char *undoname);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 38d89a4099d..a9fb328ab8b 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1001,9 +1001,9 @@ void uiTemplateSearchPreview(
void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
struct PointerRNA *root_ptr, const char *text);
uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
-#ifdef WITH_REDO_REGION_REMOVAL
+
void uiTemplateOperatorRedoProperties(uiLayout *layout, struct bContext *C);
-#endif
+
uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
void uiTemplatePreview(uiLayout *layout, struct bContext *C, struct ID *id, int show_buttons, struct ID *parent,
struct MTex *slot, const char *preview_id);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 8cb2ae92bad..b22b8e02c90 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1533,7 +1533,6 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
/************************ Redo Buttons Template *************************/
-#ifdef WITH_REDO_REGION_REMOVAL
static bool template_operator_redo_property_buts_poll(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
return (RNA_property_tags(prop) & OP_PROP_TAG_ADVANCED) == 0;
@@ -1569,9 +1568,12 @@ void uiTemplateOperatorRedoProperties(uiLayout *layout, bContext *C)
return;
}
+ /* Disable for now, doesn't fit well in popover. */
+#if 0
/* Repeat button with operator name as text. */
uiItemFullO(layout, "SCREEN_OT_repeat_last", RNA_struct_ui_name(op->type->srna),
ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
+#endif
if (WM_operator_repeat_check(C, op)) {
bool has_advanced = false;
@@ -1585,7 +1587,6 @@ void uiTemplateOperatorRedoProperties(uiLayout *layout, bContext *C)
}
}
}
-#endif
/************************ Constraint Template *************************/
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index 3b1f423b5ef..61bd8df3dbf 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -120,27 +120,14 @@ void CLIP_OT_properties(wmOperatorType *ot)
static ARegion *clip_has_tools_region(ScrArea *sa)
{
ARegion *ar, *artool = NULL, *arhead;
-#ifndef WITH_REDO_REGION_REMOVAL
- ARegion *arprops = NULL;
-#endif
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_TOOLS)
artool = ar;
-
-#ifndef WITH_REDO_REGION_REMOVAL
- if (ar->regiontype == RGN_TYPE_TOOL_PROPS)
- arprops = ar;
-#endif
}
/* tool region hide/unhide also hides props */
- if (artool
-#ifndef WITH_REDO_REGION_REMOVAL
- && arprops
-#endif
- )
- {
+ if (artool) {
return artool;
}
@@ -161,17 +148,6 @@ static ARegion *clip_has_tools_region(ScrArea *sa)
artool->flag = RGN_FLAG_HIDDEN;
}
-#ifndef WITH_REDO_REGION_REMOVAL
- if (arprops == NULL) {
- /* add extra subdivided region for tool properties */
- arprops = MEM_callocN(sizeof(ARegion), "tool props for clip");
-
- BLI_insertlinkafter(&sa->regionbase, artool, arprops);
- arprops->regiontype = RGN_TYPE_TOOL_PROPS;
- arprops->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
- }
-#endif
-
return artool;
}
@@ -202,81 +178,3 @@ void CLIP_OT_tools(wmOperatorType *ot)
ot->exec = tools_exec;
ot->poll = tools_poll;
}
-
-#ifndef WITH_REDO_REGION_REMOVAL
-
-/************************** redo panel ******************************/
-
-static void clip_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOperator *op)
-{
- uiTemplateOperatorPropertyButs(C, pa->layout, op, NULL, UI_BUT_LABEL_ALIGN_COLUMN, 0);
-}
-
-static void clip_panel_operator_redo_header(const bContext *C, Panel *pa)
-{
- wmOperator *op = WM_operator_last_redo(C);
-
- if (op)
- BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
- else
- BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
-}
-
-static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
-{
- if (op->type->flag & OPTYPE_MACRO) {
- for (op = op->macro.first; op; op = op->next) {
- uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
- clip_panel_operator_redo_operator(C, pa, op);
- }
- }
- else {
- clip_panel_operator_redo_buts(C, pa, op);
- }
-}
-
-/* TODO de-duplicate redo panel functions - campbell */
-static void clip_panel_operator_redo(const bContext *C, Panel *pa)
-{
- wmOperator *op = WM_operator_last_redo(C);
- ARegion *ar;
- ARegion *ar1;
-
- if (op == NULL)
- return;
-
- /* keep in sync with logic in ED_undo_operator_repeat() */
- ar = CTX_wm_region(C);
- ar1 = BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
- if (ar1)
- CTX_wm_region_set((bContext *)C, ar1);
-
- if (WM_operator_poll((bContext *)C, op->type)) {
- uiBlock *block = uiLayoutGetBlock(pa->layout);
-
- if (!WM_operator_check_ui_enabled(C, op->type->name))
- uiLayoutSetEnabled(pa->layout, false);
-
- /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
- UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op);
-
- clip_panel_operator_redo_operator(C, pa, op);
- }
-
- /* set region back */
- CTX_wm_region_set((bContext *)C, ar);
-}
-
-void ED_clip_tool_props_register(ARegionType *art)
-{
- PanelType *pt;
-
- pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel last operator");
- strcpy(pt->idname, "CLIP_PT_last_operator");
- strcpy(pt->label, N_("Operator"));
- strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
- pt->draw_header = clip_panel_operator_redo_header;
- pt->draw = clip_panel_operator_redo;
- BLI_addtail(&art->paneltypes, pt);
-}
-#endif
diff --git a/source/blender/editors/space_clip/space_clip.c b/so
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list