diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_header.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 66 |
1 files changed, 50 insertions, 16 deletions
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 8f6f0b70fdc..52a8562b6ba 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -274,6 +274,47 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) } } +static void uiTemplatePaintModeSelection(uiLayout *layout, struct bContext *C) +{ + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); + + /* Manipulators aren't used in paint modes */ + if (!ELEM(ob->mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) { + /* masks aren't used for sculpt and particle painting */ + PointerRNA meshptr; + + RNA_pointer_create(ob->data, &RNA_Mesh, ob->data, &meshptr); + if (ob->mode & (OB_MODE_TEXTURE_PAINT)) { + uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + } + else { + uiLayout *row = uiLayoutRow(layout, true); + uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + } + } +} + +void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C) +{ + /* Extracted from: uiTemplateHeader3D */ + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); + Object *obedit = CTX_data_edit_object(C); + bGPdata *gpd = CTX_data_gpencil_data(C); + + bool is_paint = ( + ob && !(gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)) && + ELEM(ob->mode, + OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, OB_MODE_TEXTURE_PAINT)); + + uiTemplateEditModeSelection(layout, C); + if ((obedit == NULL) && is_paint) { + uiTemplatePaintModeSelection(layout, C); + } +} + void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) { bScreen *screen = CTX_wm_screen(C); @@ -310,21 +351,11 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } if (obedit == NULL && is_paint) { - /* Manipulators aren't used in paint modes */ - if (!ELEM(ob->mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) { - /* masks aren't used for sculpt and particle painting */ - PointerRNA meshptr; - - RNA_pointer_create(ob->data, &RNA_Mesh, ob->data, &meshptr); - if (ob->mode & (OB_MODE_TEXTURE_PAINT)) { - uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - } - else { - row = uiLayoutRow(layout, true); - uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - } - } + /* Currently Python calls this directly. */ +#if 0 + uiTemplatePaintModeSelection(layout, C); +#endif + } else { /* Transform widget / manipulators */ @@ -337,6 +368,9 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) /* Scene lock */ uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); } - + + /* Currently Python calls this directly. */ +#if 0 uiTemplateEditModeSelection(layout, C); +#endif } |