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:
authorCampbell Barton <ideasman42@gmail.com>2021-08-16 11:22:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-08-16 11:26:55 +0300
commitfcefe43ac6cc18a4c803eed86f843f6be3a5d309 (patch)
treeb84141ad9b67b61c49d01ab4d949208a536b88fe
parent7d2d4de377e6a1b5b2c12e56991c6b2e98c84440 (diff)
Cleanup: obj import/export indentation
Also remove commented `use_mesh_modifiers_render` option which is unlikely to be added back since this option no longer exists internally.
-rw-r--r--io_scene_obj/__init__.py304
1 files changed, 153 insertions, 151 deletions
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index df600bf1..6d055c3d 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -41,18 +41,18 @@ if "bpy" in locals():
import bpy
from bpy.props import (
- BoolProperty,
- FloatProperty,
- StringProperty,
- EnumProperty,
- )
+ BoolProperty,
+ FloatProperty,
+ StringProperty,
+ EnumProperty,
+)
from bpy_extras.io_utils import (
- ImportHelper,
- ExportHelper,
- orientation_helper,
- path_reference_mode,
- axis_conversion,
- )
+ ImportHelper,
+ ExportHelper,
+ orientation_helper,
+ path_reference_mode,
+ axis_conversion,
+)
@orientation_helper(axis_forward='-Z', axis_up='Y')
@@ -64,59 +64,60 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
filename_ext = ".obj"
filter_glob: StringProperty(
- default="*.obj;*.mtl",
- options={'HIDDEN'},
- )
+ default="*.obj;*.mtl",
+ options={'HIDDEN'},
+ )
use_edges: BoolProperty(
- name="Lines",
- description="Import lines and faces with 2 verts as edge",
- default=True,
- )
+ name="Lines",
+ description="Import lines and faces with 2 verts as edge",
+ default=True,
+ )
use_smooth_groups: BoolProperty(
- name="Smooth Groups",
- description="Surround smooth groups by sharp edges",
- default=True,
- )
+ name="Smooth Groups",
+ description="Surround smooth groups by sharp edges",
+ default=True,
+ )
use_split_objects: BoolProperty(
- name="Object",
- description="Import OBJ Objects into Blender Objects",
- default=True,
- )
+ name="Object",
+ description="Import OBJ Objects into Blender Objects",
+ default=True,
+ )
use_split_groups: BoolProperty(
- name="Group",
- description="Import OBJ Groups into Blender Objects",
- default=False,
- )
+ name="Group",
+ description="Import OBJ Groups into Blender Objects",
+ default=False,
+ )
use_groups_as_vgroups: BoolProperty(
- name="Poly Groups",
- description="Import OBJ groups as vertex groups",
- default=False,
- )
+ name="Poly Groups",
+ description="Import OBJ groups as vertex groups",
+ default=False,
+ )
use_image_search: BoolProperty(
- name="Image Search",
- description="Search subdirs for any associated images "
- "(Warning, may be slow)",
- default=True,
- )
+ name="Image Search",
+ description="Search subdirs for any associated images "
+ "(Warning, may be slow)",
+ default=True,
+ )
split_mode: EnumProperty(
- name="Split",
- items=(('ON', "Split", "Split geometry, omits unused verts"),
- ('OFF', "Keep Vert Order", "Keep vertex order from file"),
- ),
- )
+ name="Split",
+ items=(
+ ('ON', "Split", "Split geometry, omits unused verts"),
+ ('OFF', "Keep Vert Order", "Keep vertex order from file"),
+ ),
+ )
global_clamp_size: FloatProperty(
- name="Clamp Size",
- description="Clamp bounds under this value (zero to disable)",
- min=0.0, max=1000.0,
- soft_min=0.0, soft_max=1000.0,
- default=0.0,
- )
+ name="Clamp Size",
+ description="Clamp bounds under this value (zero to disable)",
+ min=0.0, max=1000.0,
+ soft_min=0.0, soft_max=1000.0,
+ default=0.0,
+ )
def execute(self, context):
# print("Selected: " + context.active_object.name)
@@ -128,15 +129,19 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
else:
self.use_groups_as_vgroups = False
- keywords = self.as_keywords(ignore=("axis_forward",
- "axis_up",
- "filter_glob",
- "split_mode",
- ))
+ keywords = self.as_keywords(
+ ignore=(
+ "axis_forward",
+ "axis_up",
+ "filter_glob",
+ "split_mode",
+ ),
+ )
- global_matrix = axis_conversion(from_forward=self.axis_forward,
- from_up=self.axis_up,
- ).to_4x4()
+ global_matrix = axis_conversion(
+ from_forward=self.axis_forward,
+ from_up=self.axis_up,
+ ).to_4x4()
keywords["global_matrix"] = global_matrix
if bpy.data.is_saved and context.preferences.filepaths.use_relative_paths:
@@ -244,111 +249,104 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
filename_ext = ".obj"
filter_glob: StringProperty(
- default="*.obj;*.mtl",
- options={'HIDDEN'},
- )
+ default="*.obj;*.mtl",
+ options={'HIDDEN'},
+ )
# context group
use_selection: BoolProperty(
- name="Selection Only",
- description="Export selected objects only",
- default=False,
- )
+ name="Selection Only",
+ description="Export selected objects only",
+ default=False,
+ )
use_animation: BoolProperty(
- name="Animation",
- description="Write out an OBJ for each frame",
- default=False,
- )
+ name="Animation",
+ description="Write out an OBJ for each frame",
+ default=False,
+ )
# object group
use_mesh_modifiers: BoolProperty(
- name="Apply Modifiers",
- description="Apply modifiers",
- default=True,
- )
- # Non working in Blender 2.8 currently.
- # ~ use_mesh_modifiers_render: BoolProperty(
- # ~ name="Use Modifiers Render Settings",
- # ~ description="Use render settings when applying modifiers to mesh objects",
- # ~ default=False,
- # ~ )
-
+ name="Apply Modifiers",
+ description="Apply modifiers",
+ default=True,
+ )
# extra data group
use_edges: BoolProperty(
- name="Include Edges",
- description="",
- default=True,
- )
+ name="Include Edges",
+ description="",
+ default=True,
+ )
use_smooth_groups: BoolProperty(
- name="Smooth Groups",
- description="Write sharp edges as smooth groups",
- default=False,
- )
+ name="Smooth Groups",
+ description="Write sharp edges as smooth groups",
+ default=False,
+ )
use_smooth_groups_bitflags: BoolProperty(
- name="Bitflag Smooth Groups",
- description="Same as 'Smooth Groups', but generate smooth groups IDs as bitflags "
- "(produces at most 32 different smooth groups, usually much less)",
- default=False,
- )
+ name="Bitflag Smooth Groups",
+ description="Same as 'Smooth Groups', but generate smooth groups IDs as bitflags "
+ "(produces at most 32 different smooth groups, usually much less)",
+ default=False,
+ )
use_normals: BoolProperty(
- name="Write Normals",
- description="Export one normal per vertex and per face, to represent flat faces and sharp edges",
- default=True,
- )
+ name="Write Normals",
+ description="Export one normal per vertex and per face, to represent flat faces and sharp edges",
+ default=True,
+ )
use_uvs: BoolProperty(
- name="Include UVs",
- description="Write out the active UV coordinates",
- default=True,
- )
+ name="Include UVs",
+ description="Write out the active UV coordinates",
+ default=True,
+ )
use_materials: BoolProperty(
- name="Write Materials",
- description="Write out the MTL file",
- default=True,
- )
+ name="Write Materials",
+ description="Write out the MTL file",
+ default=True,
+ )
use_triangles: BoolProperty(
- name="Triangulate Faces",
- description="Convert all faces to triangles",
- default=False,
- )
+ name="Triangulate Faces",
+ description="Convert all faces to triangles",
+ default=False,
+ )
use_nurbs: BoolProperty(
- name="Write Nurbs",
- description="Write nurbs curves as OBJ nurbs rather than "
- "converting to geometry",
- default=False,
- )
+ name="Write Nurbs",
+ description="Write nurbs curves as OBJ nurbs rather than "
+ "converting to geometry",
+ default=False,
+ )
use_vertex_groups: BoolProperty(
- name="Polygroups",
- description="",
- default=False,
- )
+ name="Polygroups",
+ description="",
+ default=False,
+ )
# grouping group
use_blen_objects: BoolProperty(
- name="OBJ Objects",
- description="Export Blender objects as OBJ objects",
- default=True,
- )
+ name="OBJ Objects",
+ description="Export Blender objects as OBJ objects",
+ default=True,
+ )
group_by_object: BoolProperty(
- name="OBJ Groups",
- description="Export Blender objects as OBJ groups",
- default=False,
- )
+ name="OBJ Groups",
+ description="Export Blender objects as OBJ groups",
+ default=False,
+ )
group_by_material: BoolProperty(
- name="Material Groups",
- description="Generate an OBJ group for each part of a geometry using a different material",
- default=False,
- )
+ name="Material Groups",
+ description="Generate an OBJ group for each part of a geometry using a different material",
+ default=False,
+ )
keep_vertex_order: BoolProperty(
- name="Keep Vertex Order",
- description="",
- default=False,
- )
+ name="Keep Vertex Order",
+ description="",
+ default=False,
+ )
global_scale: FloatProperty(
- name="Scale",
- min=0.01, max=1000.0,
- default=1.0,
- )
+ name="Scale",
+ min=0.01, max=1000.0,
+ default=1.0,
+ )
path_mode: path_reference_mode
@@ -358,17 +356,23 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
from . import export_obj
from mathutils import Matrix
- keywords = self.as_keywords(ignore=("axis_forward",
- "axis_up",
- "global_scale",
- "check_existing",
- "filter_glob",
- ))
-
- global_matrix = (Matrix.Scale(self.global_scale, 4) @
- axis_conversion(to_forward=self.axis_forward,
- to_up=self.axis_up,
- ).to_4x4())
+ keywords = self.as_keywords(
+ ignore=(
+ "axis_forward",
+ "axis_up",
+ "global_scale",
+ "check_existing",
+ "filter_glob",
+ ),
+ )
+
+ global_matrix = (
+ Matrix.Scale(self.global_scale, 4) @
+ axis_conversion(
+ to_forward=self.axis_forward,
+ to_up=self.axis_up,
+ ).to_4x4()
+ )
keywords["global_matrix"] = global_matrix
return export_obj.save(context, **keywords)
@@ -461,8 +465,6 @@ class OBJ_PT_export_geometry(bpy.types.Panel):
operator = sfile.active_operator
layout.prop(operator, 'use_mesh_modifiers')
- # Property definition disabled, not working in 2.8 currently.
- # 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')