[Bf-extensions-cvs] [3d322e57] filebrowser_redesign: OBJ IO layouts

William Reynish noreply at git.blender.org
Wed Aug 21 21:46:54 CEST 2019


Commit: 3d322e57d420591bc636c82fd59c8d9178ba91ef
Author: William Reynish
Date:   Wed Aug 21 21:46:52 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rBA3d322e57d420591bc636c82fd59c8d9178ba91ef

OBJ IO layouts

===================================================================

M	io_scene_obj/__init__.py

===================================================================

diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index ccf5ee3b..281390b2 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -144,31 +144,182 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
 
         return import_obj.load(context, **keywords)
 
+    def draw(self, context):
+        pass
+
+
+class OBJ_PT_import_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 == "IMPORT_SCENE_OT_obj"
+
+    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_image_search')
+        layout.prop(operator, 'use_smooth_groups')
+        layout.prop(operator, 'use_edges')
+
+
+class OBJ_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_SCENE_OT_obj"
+
     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_clight_size")
+        layout.prop(operator, "axis_forward")
+        layout.prop(operator, "axis_up")
+
 
-        row = layout.row(align=True)
-        row.prop(self, "use_smooth_groups")
-        row.prop(self, "use_edges")
+class OBJ_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"
+    bl_options = {'DEFAULT_CLOSED'}
 
-        box = layout.box()
-        row = box.row()
-        row.prop(self, "split_mode", expand=True)
+    @classmethod
+    def poll(cls, context):
+        sfile = context.space_data
+        operator = sfile.active_operator
 
-        row = box.row()
-        if self.split_mode == 'ON':
-            row.label(text="Split by:")
-            row.prop(self, "use_split_objects")
-            row.prop(self, "use_split_groups")
+        return operator.bl_idname == "IMPORT_SCENE_OT_obj"
+
+    def draw(self, context):
+        layout = self.layout
+        
+        sfile = context.space_data
+        operator = sfile.active_operator
+
+        layout.row().prop(operator, "split_mode", expand=True)
+
+        layout.use_property_split = True
+        layout.use_property_decorate = False  # No animation.
+        
+        col = layout.column()
+        if operator.split_mode == 'ON':
+            col.prop(operator, "use_split_objects", text="Split by Object")
+            col.prop(operator, "use_split_groups", text="Split by Group")
         else:
-            row.prop(self, "use_groups_as_vgroups")
+            col.prop(operator, "use_groups_as_vgroups")
+
+
+class OBJ_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
 
-        row = layout.split(factor=0.67)
-        row.prop(self, "global_clight_size")
-        layout.prop(self, "axis_forward")
-        layout.prop(self, "axis_up")
+        return operator.bl_idname == "EXPORT_SCENE_OT_obj"
 
-        layout.prop(self, "use_image_search")
+    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')
+        layout.prop(operator, 'use_blen_objects')
+        layout.prop(operator, 'group_by_object')
+        layout.prop(operator, 'group_by_material')
+        layout.prop(operator, 'use_animation')
+
+
+class OBJ_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_SCENE_OT_obj"
+
+    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, 'path_mode')
+        layout.prop(operator, 'axis_forward')
+        layout.prop(operator, 'axis_up')
+
+
+class OBJ_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"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        sfile = context.space_data
+        operator = sfile.active_operator
+
+        return operator.bl_idname == "EXPORT_SCENE_OT_obj"
+
+    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')
+        layout.prop(operator, 'use_mesh_modifiers_render')
+        layout.prop(operator, 'use_smooth_groups')
+        layout.prop(operator, 'use_smooth_groups_bitflags')
+        layout.prop(operator, 'use_normals')
+        layout.prop(operator, 'use_uvs')
+        layout.prop(operator, 'use_materials')
+        layout.prop(operator, 'use_triangles')
+        layout.prop(operator, 'use_nurbs', text="Curves as NURBS")
+        layout.prop(operator, 'keep_vertex_order')
 
 
 @orientation_helper(axis_forward='-Z', axis_up='Y')
@@ -310,6 +461,9 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
         keywords["global_matrix"] = global_matrix
         return export_obj.save(context, **keywords)
 
+    def draw(self, context):
+        pass
+
 
 def menu_func_import(self, context):
     self.layout.operator(ImportOBJ.bl_idname, text="Wavefront (.obj)")
@@ -321,7 +475,13 @@ def menu_func_export(self, context):
 
 classes = (
     ImportOBJ,
+    OBJ_PT_import_include,
+    OBJ_PT_import_transform,
+    OBJ_PT_import_geometry,
     ExportOBJ,
+    OBJ_PT_export_include,
+    OBJ_PT_export_transform,
+    OBJ_PT_export_geometry,
 )



More information about the Bf-extensions-cvs mailing list