Changeset View
Changeset View
Standalone View
Standalone View
object_print3d_utils/ui.py
| Show All 23 Lines | |||||
| import bmesh | import bmesh | ||||
| from . import report | from . import report | ||||
| class Print3D_ToolBar: | class Print3D_ToolBar: | ||||
| bl_label = "Print3D" | bl_label = "Print3D" | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'TOOLS' | bl_region_type = 'UI' | ||||
| _type_to_icon = { | _type_to_icon = { | ||||
| bmesh.types.BMVert: 'VERTEXSEL', | bmesh.types.BMVert: 'VERTEXSEL', | ||||
| bmesh.types.BMEdge: 'EDGESEL', | bmesh.types.BMEdge: 'EDGESEL', | ||||
| bmesh.types.BMFace: 'FACESEL', | bmesh.types.BMFace: 'FACESEL', | ||||
| } | } | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| obj = context.active_object | obj = context.active_object | ||||
| return obj and obj.type == 'MESH' | return obj and obj.type == 'MESH' | ||||
| @staticmethod | @staticmethod | ||||
| def draw_report(layout, context): | def draw_report(layout, context): | ||||
| """Display Reports""" | """Display Reports""" | ||||
| info = report.info() | info = report.info() | ||||
| if info: | if info: | ||||
| obj = context.edit_object | obj = context.edit_object | ||||
| layout.label("Output:") | layout.label(text="Output:") | ||||
| box = layout.box() | box = layout.box() | ||||
| col = box.column(align=False) | col = box.column(align=False) | ||||
| # box.alert = True | # box.alert = True | ||||
| for i, (text, data) in enumerate(info): | for i, (text, data) in enumerate(info): | ||||
| if obj and data and data[1]: | if obj and data and data[1]: | ||||
| bm_type, bm_array = data | bm_type, bm_array = data | ||||
| col.operator("mesh.print3d_select_report", | col.operator("mesh.print3d_select_report", | ||||
| text=text, | text=text, | ||||
| icon=Print3D_ToolBar._type_to_icon[bm_type]).index = i | icon=Print3D_ToolBar._type_to_icon[bm_type]).index = i | ||||
| layout.operator("mesh.select_non_manifold", text='Non Manifold Extended') | layout.operator("mesh.select_non_manifold", text='Non Manifold Extended') | ||||
| else: | else: | ||||
| col.label(text) | col.label(text=text) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| scene = context.scene | scene = context.scene | ||||
| print_3d = scene.print_3d | print_3d = scene.print_3d | ||||
| # TODO, presets | # TODO, presets | ||||
| row = layout.row() | row = layout.row() | ||||
| row.label("Statistics:") | row.label(text="Statistics:") | ||||
| rowsub = layout.row(align=True) | rowsub = layout.row(align=True) | ||||
| rowsub.operator("mesh.print3d_info_volume", text="Volume") | rowsub.operator("mesh.print3d_info_volume", text="Volume") | ||||
| rowsub.operator("mesh.print3d_info_area", text="Area") | rowsub.operator("mesh.print3d_info_area", text="Area") | ||||
| row = layout.row() | row = layout.row() | ||||
| row.label("Checks:") | row.label(text="Checks:") | ||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| col.operator("mesh.print3d_check_solid", text="Solid") | col.operator("mesh.print3d_check_solid", text="Solid") | ||||
| col.operator("mesh.print3d_check_intersect", text="Intersections") | col.operator("mesh.print3d_check_intersect", text="Intersections") | ||||
| rowsub = col.row(align=True) | rowsub = col.row(align=True) | ||||
| rowsub.operator("mesh.print3d_check_degenerate", text="Degenerate") | rowsub.operator("mesh.print3d_check_degenerate", text="Degenerate") | ||||
| rowsub.prop(print_3d, "threshold_zero", text="") | rowsub.prop(print_3d, "threshold_zero", text="") | ||||
| rowsub = col.row(align=True) | rowsub = col.row(align=True) | ||||
| rowsub.operator("mesh.print3d_check_distort", text="Distorted") | rowsub.operator("mesh.print3d_check_distort", text="Distorted") | ||||
| rowsub.prop(print_3d, "angle_distort", text="") | rowsub.prop(print_3d, "angle_distort", text="") | ||||
| rowsub = col.row(align=True) | rowsub = col.row(align=True) | ||||
| rowsub.operator("mesh.print3d_check_thick", text="Thickness") | rowsub.operator("mesh.print3d_check_thick", text="Thickness") | ||||
| rowsub.prop(print_3d, "thickness_min", text="") | rowsub.prop(print_3d, "thickness_min", text="") | ||||
| rowsub = col.row(align=True) | rowsub = col.row(align=True) | ||||
| rowsub.operator("mesh.print3d_check_sharp", text="Edge Sharp") | rowsub.operator("mesh.print3d_check_sharp", text="Edge Sharp") | ||||
| rowsub.prop(print_3d, "angle_sharp", text="") | rowsub.prop(print_3d, "angle_sharp", text="") | ||||
| rowsub = col.row(align=True) | rowsub = col.row(align=True) | ||||
| rowsub.operator("mesh.print3d_check_overhang", text="Overhang") | rowsub.operator("mesh.print3d_check_overhang", text="Overhang") | ||||
| rowsub.prop(print_3d, "angle_overhang", text="") | rowsub.prop(print_3d, "angle_overhang", text="") | ||||
| col = layout.column() | col = layout.column() | ||||
| col.operator("mesh.print3d_check_all", text="Check All") | col.operator("mesh.print3d_check_all", text="Check All") | ||||
| row = layout.row() | row = layout.row() | ||||
| row.label("Cleanup:") | row.label(text="Cleanup:") | ||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| col.operator("mesh.print3d_clean_isolated", text="Isolated") | col.operator("mesh.print3d_clean_isolated", text="Isolated") | ||||
| rowsub = col.row(align=True) | rowsub = col.row(align=True) | ||||
| rowsub.operator("mesh.print3d_clean_distorted", text="Distorted") | rowsub.operator("mesh.print3d_clean_distorted", text="Distorted") | ||||
| rowsub.prop(print_3d, "angle_distort", text="") | rowsub.prop(print_3d, "angle_distort", text="") | ||||
| col = layout.column() | col = layout.column() | ||||
| col.operator("mesh.print3d_clean_non_manifold", text="Make Manifold") | col.operator("mesh.print3d_clean_non_manifold", text="Make Manifold") | ||||
| # XXX TODO | # XXX TODO | ||||
| # col.operator("mesh.print3d_clean_thin", text="Wall Thickness") | # col.operator("mesh.print3d_clean_thin", text="Wall Thickness") | ||||
| row = layout.row() | row = layout.row() | ||||
| row.label("Scale To:") | row.label(text="Scale To:") | ||||
| rowsub = layout.row(align=True) | rowsub = layout.row(align=True) | ||||
| rowsub.operator("mesh.print3d_scale_to_volume", text="Volume") | rowsub.operator("mesh.print3d_scale_to_volume", text="Volume") | ||||
| rowsub.operator("mesh.print3d_scale_to_bounds", text="Bounds") | rowsub.operator("mesh.print3d_scale_to_bounds", text="Bounds") | ||||
| col = layout.column() | col = layout.column() | ||||
| rowsub = col.row(align=True) | rowsub = col.row(align=True) | ||||
| rowsub.label("Export Path:") | rowsub.label(text="Export Path:") | ||||
| rowsub.prop(print_3d, "use_apply_scale", text="", icon='MAN_SCALE') | rowsub.prop(print_3d, "use_apply_scale", text="", icon='MAN_SCALE') | ||||
| rowsub.prop(print_3d, "use_export_texture", text="", icon='FILE_IMAGE') | rowsub.prop(print_3d, "use_export_texture", text="", icon='FILE_IMAGE') | ||||
| rowsub = col.row() | rowsub = col.row() | ||||
| rowsub.prop(print_3d, "export_path", text="") | rowsub.prop(print_3d, "export_path", text="") | ||||
| rowsub = col.row(align=True) | rowsub = col.row(align=True) | ||||
| rowsub.prop(print_3d, "export_format", text="") | rowsub.prop(print_3d, "export_format", text="") | ||||
| rowsub.operator("mesh.print3d_export", text="Export", icon='EXPORT') | rowsub.operator("mesh.print3d_export", text="Export", icon='EXPORT') | ||||
| Show All 15 Lines | |||||