diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_buttons.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_buttons.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 63786e87b1f..f5e8bf10817 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -55,19 +55,21 @@ #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_customdata.h" -#include "BKE_depsgraph.h" #include "BKE_screen.h" #include "BKE_editmesh.h" #include "BKE_deform.h" #include "BKE_object.h" #include "BKE_object_deform.h" +#include "DEG_depsgraph.h" + #include "WM_api.h" #include "WM_types.h" #include "RNA_access.h" #include "ED_armature.h" +#include "ED_object.h" #include "ED_mesh.h" #include "ED_screen.h" @@ -776,18 +778,18 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event) return; } else { - Scene *scene = CTX_data_scene(C); - Object *ob = scene->basact->object; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = view_layer->basact->object; ED_vgroup_vert_active_mirror(ob, event - B_VGRP_PNL_EDIT_SINGLE); - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); } } static bool view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) { - Scene *scene = CTX_data_scene(C); - Object *ob = OBACT; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); if (ob && (BKE_object_is_in_editmode_vgroup(ob) || BKE_object_is_in_wpaint_select_vert(ob))) { @@ -805,7 +807,8 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) { uiBlock *block = uiLayoutAbsoluteBlock(pa->layout); Scene *scene = CTX_data_scene(C); - Object *ob = scene->basact->object; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = view_layer->basact->object; MDeformVert *dv; @@ -1095,9 +1098,9 @@ static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event) { - Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); - Object *ob = OBACT; + Object *ob = OBACT(view_layer); switch (event) { @@ -1108,7 +1111,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event case B_OBJECTPANELMEDIAN: if (ob) { v3d_editvertex_buts(NULL, v3d, ob, 1.0); - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); } break; } @@ -1119,16 +1122,17 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event static bool view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt)) { - Scene *scene = CTX_data_scene(C); - return (scene->basact != NULL); + ViewLayer *view_layer = CTX_data_view_layer(C); + return (view_layer->basact != NULL); } static void view3d_panel_transform(const bContext *C, Panel *pa) { uiBlock *block; Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); Object *obedit = CTX_data_edit_object(C); - Object *ob = scene->basact->object; + Object *ob = view_layer->basact->object; uiLayout *col; block = uiLayoutGetBlock(pa->layout); @@ -1160,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; @@ -1179,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)) @@ -1194,7 +1212,7 @@ static int view3d_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) void VIEW3D_OT_properties(wmOperatorType *ot) { - ot->name = "Properties"; + ot->name = "Toggle Sidebar"; ot->description = "Toggle the properties region visibility"; ot->idname = "VIEW3D_OT_properties"; |