Cleanup of 3D viewport header in painting modes:

- Hide Manipulate center points in sculpt and particle edit modes
- Hide 3D manipulators and orientation from sculpt mode
- Hide snap buttons in sculpt, weight, texture, vertex and particle painting modes

All this options weren't make sense in this modes and might only confuse user.

This will resolve issue #30180: 3D View header buttons and modes
This commit is contained in:
Sergey Sharybin 2012-02-17 06:59:32 +00:00
parent a56eeb7024
commit 283ab431a5
2 changed files with 33 additions and 28 deletions

@ -83,22 +83,23 @@ class VIEW3D_HT_header(Header):
row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
# Snap
snap_element = toolsettings.snap_element
row = layout.row(align=True)
row.prop(toolsettings, "use_snap", text="")
row.prop(toolsettings, "snap_element", text="", icon_only=True)
if snap_element != 'INCREMENT':
row.prop(toolsettings, "snap_target", text="")
if obj:
if obj.mode == 'OBJECT':
row.prop(toolsettings, "use_snap_align_rotation", text="")
elif obj.mode == 'EDIT':
row.prop(toolsettings, "use_snap_self", text="")
if obj.mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', 'PARTICLE_EDIT'}:
snap_element = toolsettings.snap_element
row = layout.row(align=True)
row.prop(toolsettings, "use_snap", text="")
row.prop(toolsettings, "snap_element", text="", icon_only=True)
if snap_element != 'INCREMENT':
row.prop(toolsettings, "snap_target", text="")
if obj:
if obj.mode == 'OBJECT':
row.prop(toolsettings, "use_snap_align_rotation", text="")
elif obj.mode == 'EDIT':
row.prop(toolsettings, "use_snap_self", text="")
if snap_element == 'VOLUME':
row.prop(toolsettings, "use_snap_peel_object", text="")
elif snap_element == 'FACE':
row.prop(toolsettings, "use_snap_project", text="")
if snap_element == 'VOLUME':
row.prop(toolsettings, "use_snap_peel_object", text="")
elif snap_element == 'FACE':
row.prop(toolsettings, "use_snap_project", text="")
# OpenGL render
row = layout.row(align=True)

@ -478,6 +478,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiBut *but;
uiLayout *row;
const float dpi_fac= UI_DPI_FAC;
int is_paint = 0;
RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);
RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr);
@ -492,6 +493,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* mode */
if(ob) {
v3d->modeselect = ob->mode;
is_paint = ELEM5(ob->mode, OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT,
OB_MODE_TEXTURE_PAINT, OB_MODE_PARTICLE_EDIT);
}
else {
v3d->modeselect = OB_MODE_OBJECT;
@ -504,20 +507,21 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* Draw type */
uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) {
/* Manipulators aren't used in weight paint mode */
PointerRNA meshptr;
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->id, &RNA_Mesh, ob->data, &meshptr);
if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
else {
row= uiLayoutRow(layout, 1);
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);
RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
else {
row= uiLayoutRow(layout, 1);
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);
}
}
} else {
const char *str_menu;