-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathMod Menu
More file actions
89 lines (65 loc) · 4.13 KB
/
Copy pathMod Menu
File metadata and controls
89 lines (65 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
bl_info = {
"name": "Mode Menu",
"author": "Cédric Lepiller",
"version": (0, 1, 0),
"blender": (2, 7, 5),
"description": "custom Menu pour afficher les différents modes",
"category": "3D View"}
import bpy
class customMenu(bpy.types.Menu):
bl_label = ""
bl_idname = "Mod.customMenu"
def draw(self, context):
layout = self.layout
settings = context.tool_settings
layout.operator_context = 'INVOKE_REGION_WIN'
ob = context
if ob.mode == 'OBJECT':
# Object mode
layout.operator("object.editmode_toggle", text="Enter Edit Mode",icon='EDITMODE_HLT')
layout.operator("sculpt.sculptmode_toggle", text="Sculpt Mode",icon='SCULPTMODE_HLT')
layout.operator("paint.vertex_paint_toggle", text="Vertex Paint",icon='VPAINT_HLT')
layout.operator("paint.weight_paint_toggle", text="Weight Paint",icon='WPAINT_HLT')
layout.operator("paint.texture_paint_toggle", text="Texture Paint",icon='TPAINT_HLT')
if ob.mode == 'EDIT_MESH':
# Edit mode
layout.operator("object.editmode_toggle", text="Enter Object Mode", icon='OBJECT_DATAMODE')
layout.operator("sculpt.sculptmode_toggle", text="Sculpt Mode",icon='SCULPTMODE_HLT')
layout.operator("paint.vertex_paint_toggle", text="Vertex Paint",icon='VPAINT_HLT')
layout.operator("paint.weight_paint_toggle", text="Weight Paint",icon='WPAINT_HLT')
layout.operator("paint.texture_paint_toggle", text="Texture Paint",icon='TPAINT_HLT')
ob = context
if ob.mode == 'PAINT_WEIGHT':
# Weight paint menu
layout.operator("paint.weight_paint_toggle", text="Object Mode",icon='OBJECT_DATAMODE')
layout.operator("object.editmode_toggle", text="Enter Edit Mode",icon='EDITMODE_HLT')
layout.operator("sculpt.sculptmode_toggle", text="Sculpt Mode",icon='SCULPTMODE_HLT')
layout.operator("paint.vertex_paint_toggle", text="Vertex Paint",icon='VPAINT_HLT')
layout.operator("paint.texture_paint_toggle", text="Texture Paint",icon='TPAINT_HLT')
elif ob.mode == 'PAINT_VERTEX':
# Vertex paint menu
layout.operator("paint.vertex_paint_toggle", text="Object Mode",icon='OBJECT_DATAMODE')
layout.operator("object.editmode_toggle", text="Enter Edit Mode",icon='EDITMODE_HLT')
layout.operator("sculpt.sculptmode_toggle", text="Sculpt Mode",icon='SCULPTMODE_HLT')
layout.operator("paint.weight_paint_toggle", text="Weight Paint",icon='WPAINT_HLT')
layout.operator("paint.texture_paint_toggle", text="Texture Paint",icon='TPAINT_HLT')
if ob.mode == 'PAINT_TEXTURE':
# Texture paint menu
layout.operator("paint.texture_paint_toggle", text="Object Mode",icon='OBJECT_DATAMODE')
layout.operator("object.editmode_toggle", text="Enter Edit Mode",icon='EDITMODE_HLT')
layout.operator("sculpt.sculptmode_toggle", text="Sculpt Mode",icon='SCULPTMODE_HLT')
layout.operator("paint.vertex_paint_toggle", text="Vertex Paint",icon='VPAINT_HLT')
layout.operator("paint.weight_paint_toggle", text="Weight Paint",icon='WPAINT_HLT')
if ob.mode == 'SCULPT':
# Sculpt menu
layout.operator("sculpt.sculptmode_toggle", text="Object Mode",icon='OBJECT_DATAMODE')
layout.operator("object.editmode_toggle", text="Enter Edit Mode",icon='EDITMODE_HLT')
layout.operator("paint.vertex_paint_toggle", text="Vertex Paint",icon='VPAINT_HLT')
layout.operator("paint.weight_paint_toggle", text="Weight Paint",icon='WPAINT_HLT')
layout.operator("paint.texture_paint_toggle", text="Texture Paint",icon='TPAINT_HLT')
def register():
bpy.utils.register_class(customMenu)
#bpy.ops.wm.call_menu(name=customMenu.bl_idname)
def unregister():
bpy.utils.unregister_class(customMenu)
if __name__ == "__main__": register()