-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_empty_1.1.py
More file actions
74 lines (58 loc) · 1.86 KB
/
Copy pathmake_empty_1.1.py
File metadata and controls
74 lines (58 loc) · 1.86 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
bl_info = {
"name": "Make Empty",
"author": "Leonardo Cáceres",
"version": (1, 1),
"blender": (2, 70, 0),
"location": "Tools > Make Empty > ",
"description": "Adds a new Mesh Object",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Tools"}
import bpy
def MakeEmpty(ob):
if ob.type == 'MESH':
ob.draw_type = 'WIRE'
ob.hide_render = True
ob.show_all_edges = True
def MakeSolid(ob):
if ob.type == 'MESH':
ob.draw_type = 'SOLID'
ob.hide_render = False
ob.show_all_edges = False
class MakeEmptyOperator(bpy.types.Operator):
"""Make selected object an empty object"""
bl_idname = "make.empty_operator"
bl_label = "Make Empty Operator"
bl_options = {'UNDO'}
makeES= bpy.props.BoolProperty()
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
for o in context.selected_objects:
if self.makeES:
MakeEmpty(o)
else:
MakeSolid(o)
return {'FINISHED'}
class MakeEmptyPanel(bpy.types.Panel):
"""Panel Principal"""
bl_idname = "VIEW3D_PT_make_empty"
bl_label = "Make Empty"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = 'Tools'
bl_context = "objectmode"
def draw(self, context):
layout = self.layout
layout.operator(MakeEmptyOperator.bl_idname, text = "Make Empty").makeES = True
layout.operator(MakeEmptyOperator.bl_idname, text = "Make Solid").makeES = False
def register():
bpy.utils.register_class(MakeEmptyOperator)
bpy.utils.register_class(MakeEmptyPanel)
def unregister():
bpy.utils.unregister_class(MakeEmptyOperator)
bpy.utils.unregister_class(MakeEmptyPanel)
if __name__ == "__main__":
register()