diff options
author | William Reynish <billrey@me.com> | 2019-08-21 22:46:52 +0300 |
---|---|---|
committer | William Reynish <billrey@me.com> | 2019-08-21 22:46:52 +0300 |
commit | 3d322e57d420591bc636c82fd59c8d9178ba91ef (patch) | |
tree | b5b798d1a2062b2c42e1e99e7577d8f92de6737e | |
parent | 35325774a8314060124b72c1284fe95e62d0491e (diff) |
OBJ IO layouts
-rw-r--r-- | io_scene_obj/__init__.py | 194 |
1 files changed, 177 insertions, 17 deletions
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 @@ -145,30 +145,181 @@ 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, ) |