1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 # Interface for this addon.
24 from bpy
.types
import Panel
29 bl_space_type
= 'VIEW_3D'
30 bl_region_type
= 'TOOLS'
33 bmesh
.types
.BMVert
: 'VERTEXSEL',
34 bmesh
.types
.BMEdge
: 'EDGESEL',
35 bmesh
.types
.BMFace
: 'FACESEL',
39 def poll(cls
, context
):
40 obj
= context
.active_object
41 return (obj
and obj
.type == 'MESH')
44 def draw_report(layout
, context
):
48 obj
= context
.edit_object
50 layout
.label("Output:")
52 col
= box
.column(align
=False)
54 for i
, (text
, data
) in enumerate(info
):
55 if obj
and data
and data
[1]:
56 bm_type
, bm_array
= data
57 col
.operator("mesh.print3d_select_report",
59 icon
=Print3DToolBar
._type
_to
_icon
[bm_type
]).index
= i
63 def draw(self
, context
):
67 print_3d
= scene
.print_3d
73 row
.label("Statistics:")
74 rowsub
= layout
.row(align
=True)
75 rowsub
.operator("mesh.print3d_info_volume", text
="Volume")
76 rowsub
.operator("mesh.print3d_info_area", text
="Area")
80 col
= layout
.column(align
=True)
81 col
.operator("mesh.print3d_check_solid", text
="Solid")
82 col
.operator("mesh.print3d_check_intersect", text
="Intersections")
84 rowsub
.operator("mesh.print3d_check_degenerate", text
="Degenerate")
85 rowsub
.prop(print_3d
, "threshold_zero", text
="")
87 rowsub
.operator("mesh.print3d_check_distort", text
="Distorted")
88 rowsub
.prop(print_3d
, "angle_distort", text
="")
90 rowsub
.operator("mesh.print3d_check_thick", text
="Thickness")
91 rowsub
.prop(print_3d
, "thickness_min", text
="")
93 rowsub
.operator("mesh.print3d_check_sharp", text
="Edge Sharp")
94 rowsub
.prop(print_3d
, "angle_sharp", text
="")
96 rowsub
.operator("mesh.print3d_check_overhang", text
="Overhang")
97 rowsub
.prop(print_3d
, "angle_overhang", text
="")
99 col
.operator("mesh.print3d_check_all", text
="Check All")
102 row
.label("Cleanup:")
103 col
= layout
.column(align
=True)
104 col
.operator("mesh.print3d_clean_isolated", text
="Isolated")
106 rowsub
.operator("mesh.print3d_clean_distorted", text
="Distorted")
107 rowsub
.prop(print_3d
, "angle_distort", text
="")
109 # col.operator("mesh.print3d_clean_thin", text="Wall Thickness")
112 row
.label("Scale To:")
113 rowsub
= layout
.row(align
=True)
114 rowsub
.operator("mesh.print3d_scale_to_volume", text
="Volume")
115 rowsub
.operator("mesh.print3d_scale_to_bounds", text
="Bounds")
117 col
= layout
.column()
118 rowsub
= col
.row(align
=True)
119 rowsub
.label("Export Path:")
120 rowsub
.prop(print_3d
, "use_apply_scale", text
="", icon
='MAN_SCALE')
121 rowsub
.prop(print_3d
, "use_export_texture", text
="", icon
='FILE_IMAGE')
123 rowsub
.prop(print_3d
, "export_path", text
="")
125 rowsub
= col
.row(align
=True)
126 rowsub
.prop(print_3d
, "export_format", text
="")
127 rowsub
.operator("mesh.print3d_export", text
="Export", icon
='EXPORT')
129 Print3DToolBar
.draw_report(layout
, context
)
131 # So we can have a panel in both object mode and editmode
132 class Print3DToolBarObject(Panel
, Print3DToolBar
):
133 bl_idname
= "MESH_PT_print3d_object"
134 bl_context
= "objectmode"
136 class Print3DToolBarMesh(Panel
, Print3DToolBar
):
137 bl_idname
= "MESH_PT_print3d_mesh"
138 bl_context
= "mesh_edit"