diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-03 17:04:55 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-03 17:08:21 +0300 |
commit | 53aec1ccff1b7e6356836a29b36115b475f0c3d2 (patch) | |
tree | b276067c771906ecc2b7b970a9e327ede080c16b /io_mesh_stl/__init__.py | |
parent | 0a6d3d725f0b6edc99198f6afa91138968580caf (diff) |
UI: New options layout for IO Add-ons
Updates importers/exporters for the new file-browser design. They are
now reorganized into sub-panels.
Updated the Blender version requirement (won't be compatible with older
Blender versions). Left the Add-on versions untouched, will leave that
up to Authors to change.
Diffstat (limited to 'io_mesh_stl/__init__.py')
-rw-r--r-- | io_mesh_stl/__init__.py | 170 |
1 files changed, 168 insertions, 2 deletions
diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py index a5c61d9f..cd81b228 100644 --- a/io_mesh_stl/__init__.py +++ b/io_mesh_stl/__init__.py @@ -22,7 +22,7 @@ bl_info = { "name": "STL format", "author": "Guillaume Bouchard (Guillaum)", "version": (1, 1, 3), - "blender": (2, 80, 0), + "blender": (2, 81, 6), "location": "File > Import-Export > Stl", "description": "Import-Export STL files", "warning": "", @@ -151,6 +151,61 @@ class ImportSTL(Operator, ImportHelper): return {'FINISHED'} + def draw(self, context): + pass + + +class STL_PT_import_transform(bpy.types.Panel): + bl_space_type = 'FILE_BROWSER' + bl_region_type = 'TOOL_PROPS' + bl_label = "Transform" + bl_parent_id = "FILE_PT_operator" + + @classmethod + def poll(cls, context): + sfile = context.space_data + operator = sfile.active_operator + + return operator.bl_idname == "IMPORT_MESH_OT_stl" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False # No animation. + + sfile = context.space_data + operator = sfile.active_operator + + layout.prop(operator, "global_scale") + layout.prop(operator, "use_scene_unit") + + layout.prop(operator, "axis_forward") + layout.prop(operator, "axis_up") + + +class STL_PT_import_geometry(bpy.types.Panel): + bl_space_type = 'FILE_BROWSER' + bl_region_type = 'TOOL_PROPS' + bl_label = "Geometry" + bl_parent_id = "FILE_PT_operator" + + @classmethod + def poll(cls, context): + sfile = context.space_data + operator = sfile.active_operator + + return operator.bl_idname == "IMPORT_MESH_OT_stl" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False # No animation. + + sfile = context.space_data + operator = sfile.active_operator + + layout.prop(operator, "use_facet_normal") + @orientation_helper(axis_forward='Y', axis_up='Z') class ExportSTL(Operator, ExportHelper): @@ -244,6 +299,111 @@ class ExportSTL(Operator, ExportHelper): return {'FINISHED'} + def draw(self, context): + pass + + +class STL_PT_export_main(bpy.types.Panel): + bl_space_type = 'FILE_BROWSER' + bl_region_type = 'TOOL_PROPS' + bl_label = "" + bl_parent_id = "FILE_PT_operator" + bl_options = {'HIDE_HEADER'} + + @classmethod + def poll(cls, context): + sfile = context.space_data + operator = sfile.active_operator + + return operator.bl_idname == "EXPORT_MESH_OT_stl" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False # No animation. + + sfile = context.space_data + operator = sfile.active_operator + + layout.prop(operator, "ascii") + layout.prop(operator, "batch_mode") + + +class STL_PT_export_include(bpy.types.Panel): + bl_space_type = 'FILE_BROWSER' + bl_region_type = 'TOOL_PROPS' + bl_label = "Include" + bl_parent_id = "FILE_PT_operator" + + @classmethod + def poll(cls, context): + sfile = context.space_data + operator = sfile.active_operator + + return operator.bl_idname == "EXPORT_MESH_OT_stl" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False # No animation. + + sfile = context.space_data + operator = sfile.active_operator + + layout.prop(operator, "use_selection") + + +class STL_PT_export_transform(bpy.types.Panel): + bl_space_type = 'FILE_BROWSER' + bl_region_type = 'TOOL_PROPS' + bl_label = "Transform" + bl_parent_id = "FILE_PT_operator" + + @classmethod + def poll(cls, context): + sfile = context.space_data + operator = sfile.active_operator + + return operator.bl_idname == "EXPORT_MESH_OT_stl" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False # No animation. + + sfile = context.space_data + operator = sfile.active_operator + + layout.prop(operator, "global_scale") + layout.prop(operator, "use_scene_unit") + + layout.prop(operator, "axis_forward") + layout.prop(operator, "axis_up") + + +class STL_PT_export_geometry(bpy.types.Panel): + bl_space_type = 'FILE_BROWSER' + bl_region_type = 'TOOL_PROPS' + bl_label = "Geometry" + bl_parent_id = "FILE_PT_operator" + + @classmethod + def poll(cls, context): + sfile = context.space_data + operator = sfile.active_operator + + return operator.bl_idname == "EXPORT_MESH_OT_stl" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False # No animation. + + sfile = context.space_data + operator = sfile.active_operator + + layout.prop(operator, "use_mesh_modifiers") + def menu_import(self, context): self.layout.operator(ImportSTL.bl_idname, text="Stl (.stl)") @@ -255,7 +415,13 @@ def menu_export(self, context): classes = ( ImportSTL, - ExportSTL + STL_PT_import_transform, + STL_PT_import_geometry, + ExportSTL, + STL_PT_export_main, + STL_PT_export_include, + STL_PT_export_transform, + STL_PT_export_geometry, ) def register(): |