From 4234cddda9ed59e5a7fff7043a2add2aaf158d23 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 18 Jun 2018 19:49:53 +0200 Subject: Objects: support for hiding all objects in a collection. In the outliner there are now icons for it, Ctrl+Click isolates a single collections. In the 3D view, Ctrl+H key opens a menu that is more or less the equivalent of the old layer buttons in the header. Regular Click isolates the collection, Shift+Click toggle the collection visibility. Pressing number keys and letters works in this menu, which can help for quickly selecting a specific collection. Shortcuts for quick switching by just pressing 1/2/3/.. keys are available again. The order can be confusing with nested collections, but that seems unavoidable. The first numbers control the top level collections, and then sub collections if numbers are left. Remaining design issues: * The 3D view menu needs to be improved: support for sub collections, staying open on shift+click, access from the 3D view header somewhere, shortcut key display. * Currently collection hiding just controls per-object hiding, we plan to separate this state still so alt+H doesn't affect collection hiding. --- source/blender/editors/space_view3d/view3d_buttons.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source/blender/editors/space_view3d/view3d_buttons.c') diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 300b6fafd7a..6ebed88728e 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -69,6 +69,7 @@ #include "RNA_access.h" #include "ED_armature.h" +#include "ED_object.h" #include "ED_mesh.h" #include "ED_screen.h" @@ -1163,6 +1164,11 @@ static void view3d_panel_transform(const bContext *C, Panel *pa) } } +static void hide_collections_menu_draw(const bContext *C, Menu *menu) +{ + ED_hide_collections_menu_draw(C, menu->layout); +} + void view3d_buttons_register(ARegionType *art) { PanelType *pt; @@ -1182,6 +1188,15 @@ void view3d_buttons_register(ARegionType *art) pt->draw = view3d_panel_vgroup; pt->poll = view3d_panel_vgroup_poll; BLI_addtail(&art->paneltypes, pt); + + MenuType *mt; + + mt = MEM_callocN(sizeof(MenuType), "spacetype view3d menu collections"); + strcpy(mt->idname, "VIEW3D_MT_collection"); + strcpy(mt->label, N_("Collection")); + strcpy(mt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + mt->draw = hide_collections_menu_draw; + WM_menutype_add(mt); } static int view3d_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -- cgit v1.2.3