Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Reynish <billrey@me.com>2019-08-22 00:34:27 +0300
committerWilliam Reynish <billrey@me.com>2019-08-22 00:34:27 +0300
commitdaff657d5fed3da49dfeb504b6fdeab9d3a8a226 (patch)
tree09751fc2eb45edfb28a9a90bfb190d10d921e852
parent2c18cce570a9dd708a3dcdacf05932b15d4564bb (diff)
STL and PLY IO layouts
-rw-r--r--io_mesh_ply/__init__.py62
-rw-r--r--io_mesh_stl/__init__.py168
2 files changed, 220 insertions, 10 deletions
diff --git a/io_mesh_ply/__init__.py b/io_mesh_ply/__init__.py
index d0713b21..2a8292f1 100644
--- a/io_mesh_ply/__init__.py
+++ b/io_mesh_ply/__init__.py
@@ -166,18 +166,60 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
return export_ply.save(self, context, **keywords)
def draw(self, context):
+ pass
+
+
+class PLY_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_ply"
+
+ 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, "axis_forward")
+ layout.prop(operator, "axis_up")
+ layout.prop(operator, "global_scale")
+
+
+class PLY_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_ply"
+
+ def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
+ layout.use_property_decorate = False # No animation.
- row = layout.row()
- row.prop(self, "use_mesh_modifiers")
- row.prop(self, "use_normals")
- row = layout.row()
- row.prop(self, "use_uv_coords")
- row.prop(self, "use_colors")
+ sfile = context.space_data
+ operator = sfile.active_operator
- layout.prop(self, "axis_forward")
- layout.prop(self, "axis_up")
- layout.prop(self, "global_scale")
+ layout.prop(operator, "use_mesh_modifiers")
+ layout.prop(operator, "use_normals")
+ layout.prop(operator, "use_uv_coords")
+ layout.prop(operator, "use_colors")
def menu_func_import(self, context):
@@ -191,6 +233,8 @@ def menu_func_export(self, context):
classes = (
ImportPLY,
ExportPLY,
+ PLY_PT_export_transform,
+ PLY_PT_export_geometry,
)
diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py
index a5c61d9f..fbb36bbf 100644
--- a/io_mesh_stl/__init__.py
+++ b/io_mesh_stl/__init__.py
@@ -150,6 +150,61 @@ class ImportSTL(Operator, ImportHelper):
blender_utils.create_and_link_mesh(objName, tris, tri_nors, pts, global_matrix)
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')
@@ -243,6 +298,111 @@ class ExportSTL(Operator, ExportHelper):
stl_utils.write_stl(faces=faces, **keywords_temp)
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):
@@ -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():