[Bf-blender-cvs] [ab10cb5ca86] topbar: Topbar: disable redo properties in topbar entirely for now, behind #ifdef.
Brecht Van Lommel
noreply at git.blender.org
Fri Apr 20 14:35:09 CEST 2018
Commit: ab10cb5ca86c509bc6fa4cf3ad725b45dad670f3
Author: Brecht Van Lommel
Date: Fri Apr 20 14:15:20 2018 +0200
Branches: topbar
https://developer.blender.org/rBab10cb5ca86c509bc6fa4cf3ad725b45dad670f3
Topbar: disable redo properties in topbar entirely for now, behind #ifdef.
This is going to be different with the tool / command separation plans, so
let's not confuse users for now.
===================================================================
M release/scripts/startup/bl_ui/space_topbar.py
M source/blender/blenloader/intern/versioning_280.c
M source/blender/editors/include/ED_undo.h
M source/blender/editors/include/ED_util.h
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/undo/ed_undo.c
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 dd4c3af311e..7ce512ebb2a 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -88,7 +88,9 @@ class TOPBAR_HT_lower_bar(Header):
elif region.alignment == 'RIGHT':
self.draw_right(context)
else:
- layout.template_operator_redo_props()
+ # WITH_REDO_REGION_REMOVAL:
+ # layout.template_operator_redo_props()
+ pass
def draw_left(self, context):
layout = self.layout
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index deba38729a0..447c59a3328 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -949,30 +949,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
if (!DNA_struct_find(fd->filesdna, "SpaceTopBar")) {
-#ifdef WITH_REDO_REGION_REMOVAL
+ /* Remove info editor, but only if at the top of the window. */
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
- for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
- if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_CLIP)) {
- ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
-
- for (ARegion *region = regionbase->first, *region_next; region; region = region_next) {
- region_next = region->next;
-
- if (region->regiontype == RGN_TYPE_TOOL_PROPS) {
- BKE_area_region_free(NULL, region);
- BLI_freelinkN(regionbase, region);
- }
- }
- }
- }
- }
- }
-#endif
-
- for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
- int win_width = 0, win_height = 0;
/* Calculate window width/height from screen vertices */
+ int win_width = 0, win_height = 0;
for (ScrVert *vert = screen->vertbase.first; vert; vert = vert->next) {
win_width = MAX2(win_width, vert->vec.x);
win_height = MAX2(win_height, vert->vec.y);
@@ -999,4 +979,28 @@ 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)) {
+ /* 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) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_CLIP)) {
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+
+ for (ARegion *region = regionbase->first, *region_next; region; region = region_next) {
+ region_next = region->next;
+
+ if (region->regiontype == RGN_TYPE_TOOL_PROPS) {
+ BKE_area_region_free(NULL, region);
+ BLI_freelinkN(regionbase, region);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+#endif
}
diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h
index f5e2cb53a5e..da8cd95555c 100644
--- a/source/blender/editors/include/ED_undo.h
+++ b/source/blender/editors/include/ED_undo.h
@@ -33,8 +33,6 @@ struct wmOperator;
struct wmOperatorType;
struct UndoStack;
-typedef struct OperatorRepeatContextHandle OperatorRepeatContextHandle;
-
/* undo.c */
void ED_undo_push(struct bContext *C, const char *str);
void ED_undo_push_op(struct bContext *C, struct wmOperator *op);
@@ -53,11 +51,16 @@ int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op);
/* convenience since UI callbacks use this mostly*/
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;
+
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/ED_util.h b/source/blender/editors/include/ED_util.h
index aecff73e1b0..69e80f60d0a 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -36,8 +36,6 @@
struct bContext;
struct wmOperatorType;
-typedef struct OperatorRepeatContextHandle OperatorRepeatContextHandle;
-
/* ed_util.c */
void ED_editors_init(struct bContext *C);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 777129daedd..402be964436 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -980,7 +980,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 f7a3e2cb807..4af63f2bbcb 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1531,6 +1531,7 @@ 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;
@@ -1582,7 +1583,7 @@ void uiTemplateOperatorRedoProperties(uiLayout *layout, bContext *C)
}
}
}
-
+#endif
/************************ Constraint Template *************************/
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 10044126d35..03dd1ad26e7 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -304,6 +304,7 @@ void ED_OT_undo_redo(wmOperatorType *ot)
/** \} */
+#ifdef WITH_REDO_REGION_REMOVAL
struct OperatorRepeatContextHandle {
ScrArea *restore_area;
ARegion *restore_region;
@@ -333,6 +334,7 @@ void ED_operator_repeat_reset_context(bContext *C, const OperatorRepeatContextHa
CTX_wm_area_set(C, context_info->restore_area);
CTX_wm_region_set(C, context_info->restore_region);
}
+#endif
/* -------------------------------------------------------------------- */
/** \name Operator Repeat
@@ -346,10 +348,19 @@ int ED_undo_operator_repeat(bContext *C, wmOperator *op)
if (op) {
CLOG_INFO(&LOG, 1, "idname='%s'", op->type->idname);
wmWindowManager *wm = CTX_wm_manager(C);
- struct Scene *cur_scene = CTX_data_scene(C);
- const OperatorRepeatContextHandle *context_info;
+ struct Scene *scene = CTX_data_scene(C);
+#ifdef WITH_REDO_REGION_REMOVAL
+ const OperatorRepeatContextHandle *context_info;
context_info = ED_operator_repeat_prepare_context(C, op);
+#else
+ /* keep in sync with logic in view3d_panel_operator_redo() */
+ ARegion *ar = CTX_wm_region(C);
+ ARegion *ar1 = BKE_area_find_region_active_win(CTX_wm_area(C));
+
+ if (ar1)
+ CTX_wm_region_set(C, ar1);
+#endif
if ((WM_operator_repeat_check(C, op)) &&
(WM_operator_poll(C, op->type)) &&
@@ -358,7 +369,7 @@ int ED_undo_operator_repeat(bContext *C, wmOperator *op)
* (which copy their data), wont stop redo, see [#29579]],
*
* note, - WM_operator_check_ui_enabled() jobs test _must_ stay in sync with this */
- (WM_jobs_test(wm, cur_scene, WM_JOB_TYPE_ANY) == 0))
+ (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY) == 0))
{
int retval;
@@ -395,7 +406,12 @@ int ED_undo_operator_repeat(bContext *C, wmOperator *op)
}
}
+#ifdef WITH_REDO_REGION_REMOVAL
ED_operator_repeat_reset_context(C, context_info);
+#else
+ /* set region back */
+ CTX_wm_region_set(C, ar);
+#endif
}
else {
CLOG_WARN(&LOG, "called with NULL 'op'");
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index fbc16f01116..367efd71519 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -765,9 +765,11 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
+#ifdef WITH_REDO_REGION_REMOVAL
func = RNA_def_function(srna, "template_operator_redo_props", "uiTemplateOperatorRedoProperties");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Adds properties of the last executed operator using redo");
+#endif
func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
RNA_def_function_ui_description(func, "Generates the UI layout for constraints");
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 4f7003a49e2..91e47b67130 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -165,8 +165,10 @@ void wm_operator_register(bContext *C, wmOperator *op)
wmWindowManage
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list