forked from takhlaq/blender_misc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_shortcuts_enable.py
61 lines (49 loc) · 1.41 KB
/
custom_shortcuts_enable.py
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
import bpy
bl_info = {
"name": "Custom Shortcuts Enable",
"author": "Jan Kadeřábek",
"version": (1, 0),
"blender": (2, 7, 0),
"location": "",
"description": "",
"category": "User",
}
class show_only_render(bpy.types.Operator):
bl_idname = "view3d.show_only_render"
bl_label = "Show Only Render"
def execute(self, context):
space = bpy.context.space_data
if space.show_only_render:
space.show_only_render = False
else:
space.show_only_render = True
return {"FINISHED"}
class show_edges(bpy.types.Operator):
bl_idname = "mesh.show_edges"
bl_label = "Show Edges"
def execute(self, context):
obj = bpy.context.active_object
if obj.data.show_edges :
obj.data.show_edges = False
else:
obj.data.show_edges = True
return {"FINISHED"}
class trigger_shadeless(bpy.types.Operator):
bl_idname = "screen.trigger_shadeless"
bl_label = "Trigger Shadeless"
def execute(self, context):
obj = bpy.context.active_object
material = obj.data.materials[obj.active_material_index]
if material.use_shadeless :
material.use_shadeless = False
else:
material.use_shadeless = True
return {"FINISHED"}
def register():
bpy.utils.register_class(show_only_render)
bpy.utils.register_class(trigger_shadeless)
bpy.utils.register_class(show_edges)
def unregister():
bpy.utils.unregister_class(show_only_render)
bpy.utils.unregister_class(trigger_shadeless)
bpy.utils.unregister_class(show_edges)