forked from bartvdbraak/blender
remove C specials menus, reuse python ones from the header menu instead.
This commit is contained in:
parent
10198e99ff
commit
d2e1e0d2a9
@ -41,7 +41,7 @@ class INFO_HT_header(bpy.types.Header):
|
||||
layout.itemL(text=scene.statistics())
|
||||
|
||||
|
||||
class INFO_MT_file(dynamic_menu.DynMenu):
|
||||
class INFO_MT_file(bpy.types.Menu):
|
||||
__label__ = "File"
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
import bpy
|
||||
|
||||
import dynamic_menu
|
||||
|
||||
# ********** Header **********
|
||||
|
||||
class VIEW3D_HT_header(bpy.types.Header):
|
||||
@ -742,11 +744,37 @@ class VIEW3D_MT_edit_mesh(bpy.types.Menu):
|
||||
|
||||
layout.itemM("VIEW3D_MT_edit_mesh_showhide")
|
||||
|
||||
# Only used by the menu
|
||||
class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
|
||||
__label__ = "Specials"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.itemO("mesh.subdivide", text="Subdivide")
|
||||
layout.item_floatO("mesh.subdivide", "smoothness", 1.0, text="Subdivide Smooth")
|
||||
layout.itemO("mesh.merge", text="Merge...")
|
||||
layout.itemO("mesh.remove_doubles", text="Remove Doubles")
|
||||
layout.itemO("mesh.hide", text="Hide")
|
||||
layout.itemO("mesh.reveal", text="Reveal")
|
||||
layout.itemO("mesh.select_inverse", text="Select Inverse")
|
||||
layout.itemO("mesh.flip_normals")
|
||||
layout.itemO("mesh.vertices_smooth", text="Smooth")
|
||||
# layout.itemO("mesh.bevel", text="Bevel")
|
||||
layout.itemO("mesh.faces_shade_smooth")
|
||||
layout.itemO("mesh.faces_shade_flat")
|
||||
# layout.itemO("mesh.blend_from_shape", text="Blend From Shape")
|
||||
# layout.itemO("mesh.shape_propagate_to_all", text="Propagate to All Shapes")
|
||||
layout.itemO("mesh.select_vertex_path", text="Select Vertex Path")
|
||||
|
||||
class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
|
||||
__label__ = "Vertices"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.itemO("mesh.merge")
|
||||
layout.itemO("mesh.rip")
|
||||
@ -758,11 +786,17 @@ class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
|
||||
layout.itemO("mesh.vertices_smooth")
|
||||
layout.itemO("mesh.remove_doubles")
|
||||
|
||||
layout.itemO("mesh.select_vertex_path", text="Select Vertex Path")
|
||||
|
||||
# uiItemO(layout, "Blend From Shape", 0, "mesh.blend_from_shape");
|
||||
# uiItemO(layout, "Propagate to All Shapes", 0, "mesh.shape_propagate_to_all");
|
||||
|
||||
class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
|
||||
__label__ = "Edges"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.itemO("mesh.edge_face_add")
|
||||
layout.itemO("mesh.subdivide")
|
||||
@ -782,12 +816,30 @@ class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
|
||||
layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
|
||||
layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW")
|
||||
|
||||
class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
|
||||
layout.itemS()
|
||||
|
||||
layout.itemO("TFM_OT_edge_slide", text="Edge Slide")
|
||||
layout.itemO("mesh.loop_multi_select", text="Edge Loop")
|
||||
|
||||
# uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
|
||||
# uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
|
||||
|
||||
layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring")
|
||||
|
||||
layout.itemO("mesh.loop_to_region")
|
||||
layout.itemO("mesh.region_to_loop")
|
||||
|
||||
|
||||
class VIEW3D_MT_edit_mesh_faces(dynamic_menu.DynMenu):
|
||||
__label__ = "Faces"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.itemO("mesh.flip_normals")
|
||||
# layout.itemO("mesh.bevel")
|
||||
# layout.itemO("mesh.bevel")
|
||||
layout.itemO("mesh.edge_face_add")
|
||||
layout.itemO("mesh.fill")
|
||||
layout.itemO("mesh.beauty_fill")
|
||||
@ -803,6 +855,21 @@ class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
|
||||
layout.itemO("mesh.faces_shade_smooth")
|
||||
layout.itemO("mesh.faces_shade_flat")
|
||||
|
||||
layout.itemS()
|
||||
|
||||
# uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
|
||||
# uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
|
||||
|
||||
layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
|
||||
|
||||
layout.itemS()
|
||||
|
||||
layout.item_menu_enumO("mesh.uvs_rotate", "direction")
|
||||
layout.item_menu_enumO("mesh.uvs_mirror", "axis")
|
||||
layout.item_menu_enumO("mesh.colors_rotate", "direction")
|
||||
layout.item_menu_enumO("mesh.colors_mirror", "axis")
|
||||
|
||||
|
||||
class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
|
||||
__label__ = "Normals"
|
||||
|
||||
@ -1264,14 +1331,14 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
|
||||
col = layout.column()
|
||||
|
||||
col.itemR(view, "transform_orientation")
|
||||
col.itemO("TFM_OT_create_orientation", text="Create")
|
||||
col.itemO("tfm.create_orientation", text="Create")
|
||||
|
||||
# orientation_index = view.__rna__.properties["transform_orientation"].items[view.transform_orientation].value
|
||||
#
|
||||
# if orientation_index >= 4:
|
||||
# orientation = context.scene.orientations[orientation_index - 4]
|
||||
# col.itemR(orientation, "name")
|
||||
col.itemO("TFM_OT_delete_orientation", text="Delete")
|
||||
col.itemO("tfm.delete_orientation", text="Delete")
|
||||
|
||||
# Operators
|
||||
|
||||
|
@ -63,174 +63,6 @@
|
||||
|
||||
#include "mesh_intern.h"
|
||||
|
||||
/******************************** menus *************************************/
|
||||
|
||||
static int vertex_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
|
||||
pup= uiPupMenuBegin(C, "Vertex Specials", 0);
|
||||
layout= uiPupMenuLayout(pup);
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
|
||||
|
||||
uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
|
||||
uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
|
||||
uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
|
||||
uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path");
|
||||
//uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
|
||||
//uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
|
||||
|
||||
uiPupMenuEnd(C, pup);
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static void MESH_OT_vertex_specials(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Vertex Specials";
|
||||
//ot->description= "Perform special vertex operations.";
|
||||
ot->idname= "MESH_OT_vertex_specials";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= vertex_specials_invoke;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
}
|
||||
|
||||
static int edge_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
|
||||
pup= uiPupMenuBegin(C, "Edge Specials", 0);
|
||||
layout= uiPupMenuLayout(pup);
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
|
||||
|
||||
uiItemO(layout, "Mark Seam", 0, "MESH_OT_mark_seam");
|
||||
uiItemBooleanO(layout, "Clear Seam", 0, "MESH_OT_mark_seam", "clear", 1);
|
||||
uiItemEnumO(layout, "Rotate Edge CW", 0, "MESH_OT_edge_rotate", "direction", 1);
|
||||
uiItemEnumO(layout, "Rotate Edge CCW", 0, "MESH_OT_edge_rotate", "direction", 2);
|
||||
//uiItemO(layout, "Loopcut", 0, "MESH_OT_loop_cut"); // CutEdgeloop(em, 1);
|
||||
//uiItemO(layout, "Edge Slide", 0, "MESH_OT_edge_slide"); // EdgeSlide(em, 0,0.0);
|
||||
uiItemO(layout, "Edge Slide", 0, "TFM_OT_edge_slide");
|
||||
uiItemO(layout, "Edge Loop", 0, "MESH_OT_loop_multi_select");
|
||||
uiItemBooleanO(layout, "Edge Ring", 0, "MESH_OT_loop_multi_select", "ring", 1);
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_loop_to_region");
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_region_to_loop");
|
||||
uiItemO(layout, "Mark Sharp", 0, "MESH_OT_mark_sharp");
|
||||
uiItemBooleanO(layout, "Clear Sharp", 0, "MESH_OT_mark_sharp", "clear", 1);
|
||||
|
||||
uiPupMenuEnd(C, pup);
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static void MESH_OT_edge_specials(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Edge Specials";
|
||||
//ot->description= "Perform special edge operations.";
|
||||
ot->idname= "MESH_OT_edge_specials";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= edge_specials_invoke;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
}
|
||||
|
||||
static int face_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
|
||||
pup= uiPupMenuBegin(C, "Face Specials", 0);
|
||||
layout= uiPupMenuLayout(pup);
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
|
||||
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
|
||||
// uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat");
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris");
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads");
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_edge_flip");
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_fill");
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill");
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
// uiItemO(layout, NULL, 0, "MESH_OT_face_mode"); // mesh_set_face_flags(em, 1);
|
||||
// uiItemBooleanO(layout, NULL, 0, "MESH_OT_face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
|
||||
//
|
||||
// uiItemS(layout);
|
||||
|
||||
uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_rotate", "direction");
|
||||
uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_mirror", "axis");
|
||||
uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_rotate", "direction");
|
||||
uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_mirror", "axis");
|
||||
|
||||
uiPupMenuEnd(C, pup);
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static void MESH_OT_face_specials(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Face Specials";
|
||||
//ot->description= "Perform special face operations.";
|
||||
ot->idname= "MESH_OT_face_specials";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= face_specials_invoke;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
}
|
||||
|
||||
static int specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
|
||||
pup= uiPupMenuBegin(C, "Specials", 0);
|
||||
layout= uiPupMenuLayout(pup);
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
|
||||
|
||||
uiItemO(layout, "Subdivide", 0, "MESH_OT_subdivide");
|
||||
uiItemFloatO(layout, "Subdivide Smooth", 0, "MESH_OT_subdivide", "smoothness", 1.0f);
|
||||
uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
|
||||
uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
|
||||
uiItemO(layout, "Hide", 0, "MESH_OT_hide");
|
||||
uiItemO(layout, "Reveal", 0, "MESH_OT_reveal");
|
||||
uiItemO(layout, "Select Inverse", 0, "MESH_OT_select_inverse");
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
|
||||
uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
|
||||
// uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
|
||||
uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat");
|
||||
//uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
|
||||
//uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
|
||||
uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path");
|
||||
|
||||
uiPupMenuEnd(C, pup);
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static void MESH_OT_specials(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Specials";
|
||||
//ot->description= "Perform special vertice, edge or face operations.";
|
||||
ot->idname= "MESH_OT_specials";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= specials_invoke;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
}
|
||||
|
||||
/**************************** registration **********************************/
|
||||
|
||||
void ED_operatortypes_mesh(void)
|
||||
@ -314,11 +146,6 @@ void ED_operatortypes_mesh(void)
|
||||
WM_operatortype_append(MESH_OT_sticky_add);
|
||||
WM_operatortype_append(MESH_OT_sticky_remove);
|
||||
|
||||
WM_operatortype_append(MESH_OT_vertex_specials);
|
||||
WM_operatortype_append(MESH_OT_edge_specials);
|
||||
WM_operatortype_append(MESH_OT_face_specials);
|
||||
WM_operatortype_append(MESH_OT_specials);
|
||||
|
||||
WM_operatortype_append(MESH_OT_edgering_select);
|
||||
WM_operatortype_append(MESH_OT_loopcut);
|
||||
}
|
||||
@ -449,10 +276,17 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, 0, KKEY);
|
||||
|
||||
/* menus */
|
||||
WM_keymap_add_item(keymap, "MESH_OT_vertex_specials", VKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_edge_specials", EKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_face_specials", FKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_specials", WKEY, KM_PRESS, 0, 0);
|
||||
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", WKEY, KM_PRESS, 0, 0);
|
||||
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_specials");
|
||||
|
||||
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", FKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_faces");
|
||||
|
||||
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", EKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_edges");
|
||||
|
||||
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", VKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_vertices");
|
||||
|
||||
/* UV's */
|
||||
WM_keymap_add_item(keymap, "UV_OT_mapping_menu", UKEY, KM_PRESS, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user