diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-03 07:27:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-03 07:48:44 +0300 |
commit | b66aa0b0a6b123e833d4038a77a5d3f04c37a9a0 (patch) | |
tree | e47a898dbae9c74287152e57fa021ecfdff2c53d /release/scripts/modules/bpy_extras/io_utils.py | |
parent | dbe1b07e058db33a9e806d8e9808463d563d4aa5 (diff) |
Cleanup: pep8
Diffstat (limited to 'release/scripts/modules/bpy_extras/io_utils.py')
-rw-r--r-- | release/scripts/modules/bpy_extras/io_utils.py | 131 |
1 files changed, 67 insertions, 64 deletions
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index 8a516f12b17..e2c2e4c9b93 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -32,7 +32,7 @@ __all__ = ( "path_reference_copy", "path_reference_mode", "unique_name" - ) +) import bpy from bpy.props import ( @@ -53,23 +53,23 @@ def _check_axis_conversion(op): class ExportHelper: filepath = StringProperty( - name="File Path", - description="Filepath used for exporting the file", - maxlen=1024, - subtype='FILE_PATH', - ) + name="File Path", + description="Filepath used for exporting the file", + maxlen=1024, + subtype='FILE_PATH', + ) check_existing = BoolProperty( - name="Check Existing", - description="Check and warn on overwriting existing files", - default=True, - options={'HIDDEN'}, - ) + name="Check Existing", + description="Check and warn on overwriting existing files", + default=True, + options={'HIDDEN'}, + ) # needed for mix-ins order = [ "filepath", "check_existing", - ] + ] # subclasses can override with decorator # True == use ext, False == no ext, None == do nothing. @@ -113,16 +113,16 @@ class ExportHelper: class ImportHelper: filepath = StringProperty( - name="File Path", - description="Filepath used for importing the file", - maxlen=1024, - subtype='FILE_PATH', - ) + name="File Path", + description="Filepath used for importing the file", + maxlen=1024, + subtype='FILE_PATH', + ) # needed for mix-ins order = [ "filepath", - ] + ] def invoke(self, context, event): context.window_manager.fileselect_add(self) @@ -138,43 +138,45 @@ def orientation_helper_factory(name, axis_forward='Y', axis_up='Z'): def _update_axis_forward(self, context): if self.axis_forward[-1] == self.axis_up[-1]: self.axis_up = (self.axis_up[0:-1] + - 'XYZ'[('XYZ'.index(self.axis_up[-1]) + 1) % 3]) + 'XYZ'[('XYZ'.index(self.axis_up[-1]) + 1) % 3]) members['axis_forward'] = EnumProperty( - name="Forward", - items=(('X', "X Forward", ""), - ('Y', "Y Forward", ""), - ('Z', "Z Forward", ""), - ('-X', "-X Forward", ""), - ('-Y', "-Y Forward", ""), - ('-Z', "-Z Forward", ""), - ), - default=axis_forward, - update=_update_axis_forward, - ) + name="Forward", + items=( + ('X', "X Forward", ""), + ('Y', "Y Forward", ""), + ('Z', "Z Forward", ""), + ('-X', "-X Forward", ""), + ('-Y', "-Y Forward", ""), + ('-Z', "-Z Forward", ""), + ), + default=axis_forward, + update=_update_axis_forward, + ) def _update_axis_up(self, context): if self.axis_up[-1] == self.axis_forward[-1]: self.axis_forward = (self.axis_forward[0:-1] + - 'XYZ'[('XYZ'.index(self.axis_forward[-1]) + 1) % 3]) + 'XYZ'[('XYZ'.index(self.axis_forward[-1]) + 1) % 3]) members['axis_up'] = EnumProperty( - name="Up", - items=(('X', "X Up", ""), - ('Y', "Y Up", ""), - ('Z', "Z Up", ""), - ('-X', "-X Up", ""), - ('-Y', "-Y Up", ""), - ('-Z', "-Z Up", ""), - ), - default=axis_up, - update=_update_axis_up, - ) + name="Up", + items=( + ('X', "X Up", ""), + ('Y', "Y Up", ""), + ('Z', "Z Up", ""), + ('-X', "-X Up", ""), + ('-Y', "-Y Up", ""), + ('-Z', "-Z Up", ""), + ), + default=axis_up, + update=_update_axis_up, + ) members["order"] = [ "axis_forward", "axis_up", - ] + ] return type(name, (object,), members) @@ -205,7 +207,7 @@ _axis_convert_matrix = ( ((1.0, 0.0, 0.0), (0.0, -1.0, 0.0), (0.0, 0.0, -1.0)), ((1.0, 0.0, 0.0), (0.0, 0.0, 1.0), (0.0, -1.0, 0.0)), ((1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, 1.0, 0.0)), - ) +) # store args as a single int # (X Y Z -X -Y -Z) --> (0, 1, 2, 3, 4, 5) @@ -282,7 +284,7 @@ _axis_convert_lut = ( {0x408, 0x810, 0xA20, 0x228, 0x081, 0x891, 0x699, 0x2A9, 0x102, 0x50A, 0x71A, 0xB22, 0x4CB, 0x8D3, 0xAE3, 0x2EB, 0x144, 0x954, 0x75C, 0x36C, 0x045, 0x44D, 0x65D, 0xA65}, - ) +) _axis_convert_num = {'X': 0, 'Y': 1, 'Z': 2, '-X': 3, '-Y': 4, '-Z': 5} @@ -303,11 +305,11 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'): "can't use up/forward on the same axis") value = reduce(int.__or__, (_axis_convert_num[a] << (i * 3) - for i, a in enumerate((from_forward, - from_up, - to_forward, - to_up, - )))) + for i, a in enumerate((from_forward, + from_up, + to_forward, + to_up, + )))) for i, axis_lut in enumerate(_axis_convert_lut): if value in axis_lut: @@ -392,20 +394,21 @@ def unpack_face_list(list_of_tuples): path_reference_mode = EnumProperty( - name="Path Mode", - description="Method used to reference paths", - items=(('AUTO', "Auto", "Use Relative paths with subdirectories only"), - ('ABSOLUTE', "Absolute", "Always write absolute paths"), - ('RELATIVE', "Relative", "Always write relative paths " - "(where possible)"), - ('MATCH', "Match", "Match Absolute/Relative " - "setting with input path"), - ('STRIP', "Strip Path", "Filename only"), - ('COPY', "Copy", "Copy the file to the destination path " - "(or subdirectory)"), - ), - default='AUTO', - ) + name="Path Mode", + description="Method used to reference paths", + items=( + ('AUTO', "Auto", "Use Relative paths with subdirectories only"), + ('ABSOLUTE', "Absolute", "Always write absolute paths"), + ('RELATIVE', "Relative", "Always write relative paths " + "(where possible)"), + ('MATCH', "Match", "Match Absolute/Relative " + "setting with input path"), + ('STRIP', "Strip Path", "Filename only"), + ('COPY', "Copy", "Copy the file to the destination path " + "(or subdirectory)"), + ), + default='AUTO', +) def path_reference(filepath, |