Print3D: use subpanels to declutter UI
Print3D has three tool categories: Mesh Check, Cleanup & Modify, Export. The first category being the main point of the add-on, the rest are supplementary and should not take visual space by default. Notes: Ideally Cleanup & Modify should be their own categories, but there are only two Modify tools so I decided to merge into one category. There is a point to make that Cleanup & Modify panel should be open by default, I am not strongly agains that and it could be done upon receiving feedback from users. Also fix multiple Select Non Manifod operators displaying in report.
This commit is contained in:
parent
245d0134cf
commit
aae47dca77
|
@ -128,8 +128,9 @@ class SceneProperties(PropertyGroup):
|
|||
classes = (
|
||||
SceneProperties,
|
||||
|
||||
ui.VIEW3D_PT_print3d_object,
|
||||
ui.VIEW3D_PT_print3d_mesh,
|
||||
ui.VIEW3D_PT_print3d,
|
||||
ui.VIEW3D_PT_print3d_cleanup,
|
||||
ui.VIEW3D_PT_print3d_export,
|
||||
|
||||
operators.MESH_OT_print3d_info_volume,
|
||||
operators.MESH_OT_print3d_info_area,
|
||||
|
|
|
@ -26,8 +26,9 @@ import bmesh
|
|||
from . import report
|
||||
|
||||
|
||||
class Print3DToolBar:
|
||||
class VIEW3D_PT_print3d(Panel):
|
||||
bl_label = "Print3D"
|
||||
bl_category = "3D Printing"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
|
||||
|
@ -40,107 +41,116 @@ class Print3DToolBar:
|
|||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.active_object
|
||||
return obj and obj.type == 'MESH'
|
||||
return obj is not None and obj.type == 'MESH' and obj.mode in {'OBJECT', 'EDIT'}
|
||||
|
||||
@staticmethod
|
||||
def draw_report(layout, context):
|
||||
"""Display Reports"""
|
||||
def draw_report(self, context):
|
||||
layout = self.layout
|
||||
info = report.info()
|
||||
|
||||
if info:
|
||||
obj = context.edit_object
|
||||
show_select = False
|
||||
|
||||
layout.label(text="Output:")
|
||||
layout.label(text="Report")
|
||||
box = layout.box()
|
||||
col = box.column(align=False)
|
||||
col = box.column()
|
||||
|
||||
for i, (text, data) in enumerate(info):
|
||||
if obj and data and data[1]:
|
||||
bm_type, bm_array = data
|
||||
col.operator(
|
||||
"mesh.print3d_select_report",
|
||||
text=text,
|
||||
icon=Print3DToolBar._type_to_icon[bm_type],
|
||||
).index = i
|
||||
layout.operator("mesh.select_non_manifold", text="Non Manifold Extended")
|
||||
col.operator("mesh.print3d_select_report", text=text, icon=self._type_to_icon[bm_type],).index = i
|
||||
show_select = True
|
||||
else:
|
||||
col.label(text=text)
|
||||
|
||||
if show_select:
|
||||
layout.operator("mesh.select_non_manifold")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
scene = context.scene
|
||||
print_3d = scene.print_3d
|
||||
print_3d = context.scene.print_3d
|
||||
|
||||
# TODO, presets
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Statistics:")
|
||||
rowsub = layout.row(align=True)
|
||||
rowsub.operator("mesh.print3d_info_volume", text="Volume")
|
||||
rowsub.operator("mesh.print3d_info_area", text="Area")
|
||||
layout.label(text="Statistics")
|
||||
row = layout.row(align=True)
|
||||
row.operator("mesh.print3d_info_volume", text="Volume")
|
||||
row.operator("mesh.print3d_info_area", text="Area")
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Checks:")
|
||||
layout.label(text="Checks")
|
||||
col = layout.column(align=True)
|
||||
col.operator("mesh.print3d_check_solid", text="Solid")
|
||||
col.operator("mesh.print3d_check_intersect", text="Intersections")
|
||||
rowsub = col.row(align=True)
|
||||
rowsub.operator("mesh.print3d_check_degenerate", text="Degenerate")
|
||||
rowsub.prop(print_3d, "threshold_zero", text="")
|
||||
rowsub = col.row(align=True)
|
||||
rowsub.operator("mesh.print3d_check_distort", text="Distorted")
|
||||
rowsub.prop(print_3d, "angle_distort", text="")
|
||||
rowsub = col.row(align=True)
|
||||
rowsub.operator("mesh.print3d_check_thick", text="Thickness")
|
||||
rowsub.prop(print_3d, "thickness_min", text="")
|
||||
rowsub = col.row(align=True)
|
||||
rowsub.operator("mesh.print3d_check_sharp", text="Edge Sharp")
|
||||
rowsub.prop(print_3d, "angle_sharp", text="")
|
||||
rowsub = col.row(align=True)
|
||||
rowsub.operator("mesh.print3d_check_overhang", text="Overhang")
|
||||
rowsub.prop(print_3d, "angle_overhang", text="")
|
||||
row = col.row(align=True)
|
||||
row.operator("mesh.print3d_check_degenerate", text="Degenerate")
|
||||
row.prop(print_3d, "threshold_zero", text="")
|
||||
row = col.row(align=True)
|
||||
row.operator("mesh.print3d_check_distort", text="Distorted")
|
||||
row.prop(print_3d, "angle_distort", text="")
|
||||
row = col.row(align=True)
|
||||
row.operator("mesh.print3d_check_thick", text="Thickness")
|
||||
row.prop(print_3d, "thickness_min", text="")
|
||||
row = col.row(align=True)
|
||||
row.operator("mesh.print3d_check_sharp", text="Edge Sharp")
|
||||
row.prop(print_3d, "angle_sharp", text="")
|
||||
row = col.row(align=True)
|
||||
row.operator("mesh.print3d_check_overhang", text="Overhang")
|
||||
row.prop(print_3d, "angle_overhang", text="")
|
||||
col = layout.column()
|
||||
col.operator("mesh.print3d_check_all", text="Check All")
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Cleanup:")
|
||||
self.draw_report(context)
|
||||
|
||||
|
||||
class VIEW3D_PT_print3d_cleanup(Panel):
|
||||
bl_label = "Cleanup & Modify"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
bl_parent_id = "VIEW3D_PT_print3d"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
print_3d = context.scene.print_3d
|
||||
|
||||
layout.label(text="Cleanup")
|
||||
col = layout.column(align=True)
|
||||
col.operator("mesh.print3d_clean_isolated", text="Isolated")
|
||||
rowsub = col.row(align=True)
|
||||
rowsub.operator("mesh.print3d_clean_distorted", text="Distorted")
|
||||
rowsub.prop(print_3d, "angle_distort", text="")
|
||||
row = col.row(align=True)
|
||||
row.operator("mesh.print3d_clean_distorted", text="Distorted")
|
||||
row.prop(print_3d, "angle_distort", text="")
|
||||
col = layout.column()
|
||||
col.operator("mesh.print3d_clean_non_manifold", text="Make Manifold")
|
||||
# XXX TODO
|
||||
# col.operator("mesh.print3d_clean_thin", text="Wall Thickness")
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Scale To:")
|
||||
rowsub = layout.row(align=True)
|
||||
rowsub.operator("mesh.print3d_scale_to_volume", text="Volume")
|
||||
rowsub.operator("mesh.print3d_scale_to_bounds", text="Bounds")
|
||||
layout.label(text="Scale To")
|
||||
row = layout.row(align=True)
|
||||
row.operator("mesh.print3d_scale_to_volume", text="Volume")
|
||||
row.operator("mesh.print3d_scale_to_bounds", text="Bounds")
|
||||
|
||||
|
||||
class VIEW3D_PT_print3d_export(Panel):
|
||||
bl_label = "Export"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
bl_parent_id = "VIEW3D_PT_print3d"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
print_3d = context.scene.print_3d
|
||||
|
||||
layout.prop(print_3d, "export_path", text="")
|
||||
|
||||
col = layout.column()
|
||||
rowsub = col.row(align=True)
|
||||
rowsub.label(text="Export Path:")
|
||||
rowsub.prop(print_3d, "use_apply_scale", text="", icon='ORIENTATION_GLOBAL')
|
||||
rowsub.prop(print_3d, "use_export_texture", text="", icon='FILE_IMAGE')
|
||||
rowsub = col.row()
|
||||
rowsub.prop(print_3d, "export_path", text="")
|
||||
col.prop(print_3d, "use_apply_scale")
|
||||
col.prop(print_3d, "use_export_texture")
|
||||
|
||||
rowsub = col.row(align=True)
|
||||
rowsub.prop(print_3d, "export_format", text="")
|
||||
rowsub.operator("mesh.print3d_export", text="Export", icon='EXPORT')
|
||||
|
||||
Print3DToolBar.draw_report(layout, context)
|
||||
|
||||
|
||||
# So we can have a panel in both object mode and editmode
|
||||
class VIEW3D_PT_print3d_object(Panel, Print3DToolBar):
|
||||
bl_category = "3D Printing"
|
||||
bl_context = "objectmode"
|
||||
|
||||
|
||||
class VIEW3D_PT_print3d_mesh(Panel, Print3DToolBar):
|
||||
bl_category = "3D Printing"
|
||||
bl_context = "mesh_edit"
|
||||
layout.prop(print_3d, "export_format")
|
||||
layout.operator("mesh.print3d_export", text="Export", icon='EXPORT')
|
||||
|
|
Loading…
Reference in New Issue