forked from bartvdbraak/blender
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.
This commit is contained in:
parent
e944e215bf
commit
b00d971efe
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 *************************/
|
||||
|
||||
|
@ -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
|
||||
|
@ -254,15 +254,6 @@ static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene)
|
||||
ar->regiontype = RGN_TYPE_TOOLS;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
/* tools view */
|
||||
ar = MEM_callocN(sizeof(ARegion), "tool properties for clip");
|
||||
|
||||
BLI_addtail(&sc->regionbase, ar);
|
||||
ar->regiontype = RGN_TYPE_TOOL_PROPS;
|
||||
ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
|
||||
#endif
|
||||
|
||||
/* properties view */
|
||||
ar = MEM_callocN(sizeof(ARegion), "properties for clip");
|
||||
|
||||
@ -895,19 +886,12 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
|
||||
bool main_visible = false, preview_visible = false, tools_visible = false;
|
||||
bool properties_visible = false, channels_visible = false;
|
||||
bool view_changed = false;
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
ARegion *ar_tool_props = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS);
|
||||
bool tool_props_visible = false;
|
||||
#endif
|
||||
|
||||
switch (sc->view) {
|
||||
case SC_VIEW_CLIP:
|
||||
main_visible = true;
|
||||
preview_visible = false;
|
||||
tools_visible = true;
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
tool_props_visible = true;
|
||||
#endif
|
||||
properties_visible = true;
|
||||
channels_visible = false;
|
||||
break;
|
||||
@ -915,9 +899,6 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
|
||||
main_visible = false;
|
||||
preview_visible = true;
|
||||
tools_visible = false;
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
tool_props_visible = false;
|
||||
#endif
|
||||
properties_visible = false;
|
||||
channels_visible = false;
|
||||
|
||||
@ -927,9 +908,6 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
|
||||
main_visible = false;
|
||||
preview_visible = true;
|
||||
tools_visible = false;
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
tool_props_visible = false;
|
||||
#endif
|
||||
properties_visible = false;
|
||||
channels_visible = true;
|
||||
|
||||
@ -1010,32 +988,6 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
if (tool_props_visible) {
|
||||
if (ar_tool_props && (ar_tool_props->flag & RGN_FLAG_HIDDEN)) {
|
||||
ar_tool_props->flag &= ~RGN_FLAG_HIDDEN;
|
||||
ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED;
|
||||
view_changed = true;
|
||||
}
|
||||
if (ar_tool_props && (ar_tool_props->alignment != (RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV))) {
|
||||
ar_tool_props->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
|
||||
view_changed = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ar_tool_props && !(ar_tool_props->flag & RGN_FLAG_HIDDEN)) {
|
||||
ar_tool_props->flag |= RGN_FLAG_HIDDEN;
|
||||
ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED;
|
||||
WM_event_remove_handlers((bContext *)C, &ar_tool_props->handlers);
|
||||
view_changed = true;
|
||||
}
|
||||
if (ar_tool_props && ar_tool_props->alignment != RGN_ALIGN_NONE) {
|
||||
ar_tool_props->alignment = RGN_ALIGN_NONE;
|
||||
view_changed = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (preview_visible) {
|
||||
if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
|
||||
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
|
||||
@ -1618,21 +1570,6 @@ void ED_spacetype_clip(void)
|
||||
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
/* tool properties */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype clip tool properties region");
|
||||
art->regionid = RGN_TYPE_TOOL_PROPS;
|
||||
art->prefsizex = 0;
|
||||
art->prefsizey = 120;
|
||||
art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI;
|
||||
art->listener = clip_props_region_listener;
|
||||
art->init = clip_tools_region_init;
|
||||
art->draw = clip_tools_region_draw;
|
||||
ED_clip_tool_props_register(art);
|
||||
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
#endif
|
||||
|
||||
/* regions: header */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype clip region");
|
||||
art->regionid = RGN_TYPE_HEADER;
|
||||
|
@ -114,26 +114,14 @@ ARegion *view3d_has_buttons_region(ScrArea *sa)
|
||||
ARegion *view3d_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;
|
||||
}
|
||||
|
||||
@ -154,17 +142,6 @@ ARegion *view3d_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 view3d");
|
||||
|
||||
BLI_insertlinkafter(&sa->regionbase, artool, arprops);
|
||||
arprops->regiontype = RGN_TYPE_TOOL_PROPS;
|
||||
arprops->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
|
||||
}
|
||||
#endif
|
||||
|
||||
return artool;
|
||||
}
|
||||
|
||||
@ -382,16 +359,6 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
ar->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
/* tool properties */
|
||||
ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
|
||||
|
||||
BLI_addtail(&v3d->regionbase, ar);
|
||||
ar->regiontype = RGN_TYPE_TOOL_PROPS;
|
||||
ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
|
||||
ar->flag = RGN_FLAG_HIDDEN;
|
||||
#endif
|
||||
|
||||
/* buttons/list view */
|
||||
ar = MEM_callocN(sizeof(ARegion), "buttons for view3d");
|
||||
|
||||
@ -1326,29 +1293,6 @@ static void view3d_tools_region_draw(const bContext *C, ARegion *ar)
|
||||
ED_region_panels(C, ar, CTX_data_mode_string(C), -1, true);
|
||||
}
|
||||
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
static void view3d_props_region_listener(
|
||||
bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar,
|
||||
wmNotifier *wmn, const Scene *UNUSED(scene))
|
||||
{
|
||||
/* context changes */
|
||||
switch (wmn->category) {
|
||||
case NC_WM:
|
||||
if (wmn->data == ND_HISTORY)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
case NC_SCENE:
|
||||
if (wmn->data == ND_MODE)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
case NC_SPACE:
|
||||
if (wmn->data == ND_SPACE_VIEW3D)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* area (not region) level listener */
|
||||
static void space_view3d_listener(
|
||||
bScreen *UNUSED(sc), ScrArea *sa, struct wmNotifier *wmn, Scene *UNUSED(scene),
|
||||
@ -1539,21 +1483,6 @@ void ED_spacetype_view3d(void)
|
||||
view3d_toolshelf_register(art);
|
||||
#endif
|
||||
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
/* regions: tool properties */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tool properties region");
|
||||
art->regionid = RGN_TYPE_TOOL_PROPS;
|
||||
art->prefsizex = 0;
|
||||
art->prefsizey = 120;
|
||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
|
||||
art->listener = view3d_props_region_listener;
|
||||
art->init = view3d_tools_region_init;
|
||||
art->draw = view3d_tools_region_draw;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
view3d_tool_props_register(art);
|
||||
#endif
|
||||
|
||||
/* regions: header */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype view3d header region");
|
||||
art->regionid = RGN_TYPE_HEADER;
|
||||
@ -1566,4 +1495,3 @@ void ED_spacetype_view3d(void)
|
||||
|
||||
BKE_spacetype_register(st);
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,6 @@ struct Object *ED_view3d_cameracontrol_object_get(
|
||||
/* view3d_toolbar.c */
|
||||
void VIEW3D_OT_toolshelf(struct wmOperatorType *ot);
|
||||
void view3d_toolshelf_register(struct ARegionType *art);
|
||||
void view3d_tool_props_register(struct ARegionType *art);
|
||||
|
||||
/* view3d_snap.c */
|
||||
bool ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]);
|
||||
|
@ -62,73 +62,6 @@
|
||||
|
||||
#include "view3d_intern.h" /* own include */
|
||||
|
||||
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
/* ******************* view3d space & buttons ************** */
|
||||
|
||||
static void view3d_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 view3d_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 view3d_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);
|
||||
view3d_panel_operator_redo_operator(C, pa, op);
|
||||
}
|
||||
}
|
||||
else {
|
||||
view3d_panel_operator_redo_buts(C, pa, op);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO de-duplicate redo panel functions - campbell */
|
||||
static void view3d_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_active_win(CTX_wm_area(C));
|
||||
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);
|
||||
|
||||
view3d_panel_operator_redo_operator(C, pa, op);
|
||||
}
|
||||
|
||||
/* set region back */
|
||||
CTX_wm_region_set((bContext *)C, ar);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ******************* */
|
||||
|
||||
typedef struct CustomTool {
|
||||
@ -242,21 +175,6 @@ void view3d_toolshelf_register(ARegionType *art)
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
}
|
||||
|
||||
#ifndef WITH_REDO_REGION_REMOVAL
|
||||
void view3d_tool_props_register(ARegionType *art)
|
||||
{
|
||||
PanelType *pt;
|
||||
|
||||
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel last operator");
|
||||
strcpy(pt->idname, "VIEW3D_PT_last_operator");
|
||||
strcpy(pt->label, N_("Operator"));
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->draw_header = view3d_panel_operator_redo_header;
|
||||
pt->draw = view3d_panel_operator_redo;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ********** operator to open/close toolshelf region */
|
||||
|
||||
static int view3d_toolshelf_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
@ -304,7 +304,6 @@ void ED_OT_undo_redo(wmOperatorType *ot)
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef WITH_REDO_REGION_REMOVAL
|
||||
struct OperatorRepeatContextHandle {
|
||||
ScrArea *restore_area;
|
||||
ARegion *restore_region;
|
||||
@ -334,7 +333,6 @@ 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
|
||||
@ -350,17 +348,8 @@ int ED_undo_operator_repeat(bContext *C, wmOperator *op)
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
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)) &&
|
||||
@ -406,12 +395,7 @@ 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'");
|
||||
|
@ -67,10 +67,6 @@ struct MovieClipScopes;
|
||||
struct Mask;
|
||||
struct BLI_mempool;
|
||||
|
||||
/* TODO 2.8: Remove the operator redo panel/region from the 3D View and Clip
|
||||
* Editor toolshelf. Leaving this ifdef'ed out for until new tool system and
|
||||
* topbar design is more clear. */
|
||||
//#define WITH_REDO_REGION_REMOVAL
|
||||
/* TODO 2.8: We don't write the topbar to files currently. Uncomment this
|
||||
* define to enable writing (should become the default in a bit). */
|
||||
//#define WITH_TOPBAR_WRITING
|
||||
|
@ -811,11 +811,9 @@ 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");
|
||||
|
@ -165,10 +165,8 @@ void wm_operator_register(bContext *C, wmOperator *op)
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
int tot = 0;
|
||||
|
||||
#ifdef WITH_REDO_REGION_REMOVAL
|
||||
op->execution_area = CTX_wm_area(C);
|
||||
op->execution_region = CTX_wm_region(C);
|
||||
#endif
|
||||
|
||||
BLI_addtail(&wm->operators, op);
|
||||
|
||||
|
@ -944,7 +944,6 @@ int WM_operator_call_notest(bContext *C, wmOperator *op)
|
||||
*/
|
||||
int WM_operator_repeat(bContext *C, wmOperator *op)
|
||||
{
|
||||
#ifdef WITH_REDO_REGION_REMOVAL
|
||||
const OperatorRepeatContextHandle *context_info;
|
||||
int retval;
|
||||
|
||||
@ -953,9 +952,6 @@ int WM_operator_repeat(bContext *C, wmOperator *op)
|
||||
ED_operator_repeat_reset_context(C, context_info);
|
||||
|
||||
return retval;
|
||||
#else
|
||||
return wm_operator_exec(C, op, true, true);
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* \return true if #WM_operator_repeat can run
|
||||
|
Loading…
Reference in New Issue
Block a user