Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-09-15 17:50:14 +0300
committerHans Goudey <h.goudey@me.com>2020-09-15 17:50:14 +0300
commit6b29c3fa07f54a0b0d123a90049fbad36a1334c2 (patch)
tree8cdf1a62f41e9e4e8fd6278f04db703d641aca4c /source/blender/editors/space_buttons/buttons_context.c
parent67e630609bb408e366398cb7ea9fdc09f31190e7 (diff)
Property Search: Move properties context buttons back to a panel
The context path "breadcrumbs" used to be in a panel in 2.79. Although they look a bit better in the header, there isn't enough space for them with the property search field in the header as well. Maybe there will be another solution in the long term to fit both the search field and this panel in the header, but for now, this commit moves these labels back to a header-less panel. Differential Revision: https://developer.blender.org/D8853
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_context.c')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c55
1 files changed, 10 insertions, 45 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 84a020a9ed7..2e10cc94004 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -1115,11 +1115,18 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
/************************* Drawing the Path ************************/
-void buttons_context_draw(const bContext *C, uiLayout *layout)
+static bool buttons_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
+{
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
+ return sbuts->mainb != BCONTEXT_TOOL;
+}
+
+static void buttons_panel_context_draw(const bContext *C, Panel *panel)
{
+ uiLayout *layout = panel->layout;
SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextPath *path = sbuts->path;
- uiLayout *row, *sub;
+ uiLayout *row;
PointerRNA *ptr;
char namebuf[128], *name;
int a, icon;
@@ -1180,52 +1187,11 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
}
}
}
-
- uiItemSpacer(row);
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetEmboss(sub, UI_EMBOSS_NONE);
- uiItemO(sub,
- "",
- (sbuts->flag & SB_PIN_CONTEXT) ? ICON_PINNED : ICON_UNPINNED,
- "BUTTONS_OT_toggle_pin");
-}
-
-#ifdef USE_HEADER_CONTEXT_PATH
-static bool buttons_header_context_poll(const bContext *C, HeaderType *UNUSED(ht))
-#else
-static bool buttons_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
-#endif
-{
- SpaceProperties *sbuts = CTX_wm_space_properties(C);
- return (sbuts->mainb != BCONTEXT_TOOL);
-}
-
-#ifdef USE_HEADER_CONTEXT_PATH
-static void buttons_header_context_draw(const bContext *C, Header *ptr)
-#else
-static void buttons_panel_context_draw(const bContext *C, Panel *ptr)
-#endif
-{
- buttons_context_draw(C, ptr->layout);
}
void buttons_context_register(ARegionType *art)
{
-#ifdef USE_HEADER_CONTEXT_PATH
- HeaderType *ht;
-
- ht = MEM_callocN(sizeof(HeaderType), "spacetype buttons context header");
- strcpy(ht->idname, "BUTTONS_HT_context");
- ht->space_type = SPACE_PROPERTIES;
- ht->region_type = art->regionid;
- ht->poll = buttons_header_context_poll;
- ht->draw = buttons_header_context_draw;
- BLI_addtail(&art->headertypes, ht);
-#else
- PanelType *pt;
-
- pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
+ PanelType *pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
strcpy(pt->idname, "BUTTONS_PT_context");
strcpy(pt->label, N_("Context")); /* XXX C panels unavailable through RNA bpy.types! */
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
@@ -1233,7 +1199,6 @@ void buttons_context_register(ARegionType *art)
pt->draw = buttons_panel_context_draw;
pt->flag = PNL_NO_HEADER;
BLI_addtail(&art->paneltypes, pt);
-#endif
}
ID *buttons_context_id_path(const bContext *C)