Fix #27165: uvedit mesh selection sync did not handle click / shift+click

for switching selection modes in the header.
This commit is contained in:
2011-05-02 11:34:57 +00:00
parent b0ed43c581
commit c2f18383f9
4 changed files with 28 additions and 16 deletions

View File

@@ -370,10 +370,7 @@ class IMAGE_HT_header(bpy.types.Header):
layout.prop(toolsettings, "use_uv_select_sync", text="")
if toolsettings.use_uv_select_sync:
row = layout.row(align=True)
row.prop(toolsettings, "mesh_select_mode", text="", index=0, icon='VERTEXSEL')
row.prop(toolsettings, "mesh_select_mode", text="", index=1, icon='EDGESEL')
row.prop(toolsettings, "mesh_select_mode", text="", index=2, icon='FACESEL')
layout.template_edit_mode_selection()
else:
layout.prop(toolsettings, "uv_select_mode", text="", expand=True)
layout.prop(uvedit, "sticky_select_mode", text="", icon_only=True)

View File

@@ -712,6 +712,7 @@ void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *i
void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
void uiTemplateOperatorSearch(uiLayout *layout);
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *tex);
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);

View File

@@ -432,6 +432,27 @@ static int object_mode_icon(int mode)
return ICON_OBJECT_DATAMODE;
}
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
uiBlock *block= uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);
if(obedit && (obedit->type == OB_MESH)) {
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
uiLayout *row;
row= uiLayoutRow(layout, 1);
block= uiLayoutGetBlock(row);
uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
BKE_mesh_end_editmesh(obedit->data, em);
}
}
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
{
bScreen *screen= CTX_wm_screen(C);
@@ -527,16 +548,6 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
/* selection modus, dont use python for this since it cant do the toggle buttons with shift+click as well as clicking to set one. */
if(obedit && (obedit->type == OB_MESH)) {
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
row= uiLayoutRow(layout, 1);
block= uiLayoutGetBlock(row);
uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
BKE_mesh_end_editmesh(obedit->data, em);
}
uiTemplateEditModeSelection(layout, C);
}

View File

@@ -414,6 +414,9 @@ void RNA_api_ui_layout(StructRNA *srna)
func= RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
func= RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
func= RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);