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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-09-16 09:16:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-09-16 09:17:46 +0300
commitf97eb0e338723882215b85237d58297074607f5a (patch)
tree68374e16244d234968402ed7964682e4af97e3c0 /release/scripts/modules
parentb53ee963b16d817a6367bd7c73b866036868b2e2 (diff)
Cleanup: use fixed indent in Python
Reduce right-shift.
Diffstat (limited to 'release/scripts/modules')
-rw-r--r--release/scripts/modules/bpy_extras/image_utils.py37
-rw-r--r--release/scripts/modules/bpy_extras/io_utils.py71
-rw-r--r--release/scripts/modules/bpy_types.py82
3 files changed, 111 insertions, 79 deletions
diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py
index 03864d652e4..f4d34de5037 100644
--- a/release/scripts/modules/bpy_extras/image_utils.py
+++ b/release/scripts/modules/bpy_extras/image_utils.py
@@ -24,17 +24,18 @@ __all__ = (
# limited replacement for BPyImage.comprehensiveImageLoad
-def load_image(imagepath,
- dirname="",
- place_holder=False,
- recursive=False,
- ncase_cmp=True,
- convert_callback=None,
- verbose=False,
- relpath=None,
- check_existing=False,
- force_reload=False,
- ):
+def load_image(
+ imagepath,
+ dirname="",
+ place_holder=False,
+ recursive=False,
+ ncase_cmp=True,
+ convert_callback=None,
+ verbose=False,
+ relpath=None,
+ check_existing=False,
+ force_reload=False,
+):
"""
Return an image from the file path with options to search multiple paths
and return a placeholder if its not found.
@@ -161,15 +162,17 @@ def load_image(imagepath,
variants = [imagepath]
if dirname:
- variants += [os.path.join(dirname, imagepath),
- os.path.join(dirname, bpy.path.basename(imagepath)),
- ]
+ variants += [
+ os.path.join(dirname, imagepath),
+ os.path.join(dirname, bpy.path.basename(imagepath)),
+ ]
for filepath_test in variants:
if ncase_cmp:
- ncase_variants = (filepath_test,
- bpy.path.resolve_ncase(filepath_test),
- )
+ ncase_variants = (
+ filepath_test,
+ bpy.path.resolve_ncase(filepath_test),
+ )
else:
ncase_variants = (filepath_test, )
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index 96b9596a57d..380b63066ef 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -44,10 +44,11 @@ from bpy.props import (
def _check_axis_conversion(op):
if hasattr(op, "axis_forward") and hasattr(op, "axis_up"):
- return axis_conversion_ensure(op,
- "axis_forward",
- "axis_up",
- )
+ return axis_conversion_ensure(
+ op,
+ "axis_forward",
+ "axis_up",
+ )
return False
@@ -93,10 +94,12 @@ class ExportHelper:
if check_extension is not None:
filepath = self.filepath
if os.path.basename(filepath):
- filepath = bpy.path.ensure_ext(filepath,
- self.filename_ext
- if check_extension
- else "")
+ filepath = bpy.path.ensure_ext(
+ filepath,
+ self.filename_ext
+ if check_extension
+ else "",
+ )
if filepath != self.filepath:
self.filepath = filepath
@@ -134,8 +137,10 @@ def orientation_helper(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])
+ self.axis_up = (
+ self.axis_up[0:-1] +
+ 'XYZ'[('XYZ'.index(self.axis_up[-1]) + 1) % 3]
+ )
cls.__annotations__['axis_forward'] = EnumProperty(
name="Forward",
@@ -153,8 +158,10 @@ def orientation_helper(axis_forward='Y', axis_up='Z'):
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])
+ self.axis_forward = (
+ self.axis_forward[0:-1] +
+ 'XYZ'[('XYZ'.index(self.axis_forward[-1]) + 1) % 3]
+ )
cls.__annotations__['axis_up'] = EnumProperty(
name="Up",
@@ -405,14 +412,15 @@ path_reference_mode = EnumProperty(
)
-def path_reference(filepath,
- base_src,
- base_dst,
- mode='AUTO',
- copy_subdir="",
- copy_set=None,
- library=None,
- ):
+def path_reference(
+ filepath,
+ base_src,
+ base_dst,
+ mode='AUTO',
+ copy_subdir="",
+ copy_set=None,
+ library=None,
+):
"""
Return a filepath relative to a destination directory, for use with
exporters.
@@ -540,22 +548,29 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."):
if name_new is None:
count = 1
name_dict_values = name_dict.values()
- name_new = name_new_orig = (name if clean_func is None
- else clean_func(name))
+ name_new = name_new_orig = (
+ name if clean_func is None
+ else clean_func(name)
+ )
if name_max == -1:
while name_new in name_dict_values:
- name_new = "%s%s%03d" % (name_new_orig, sep, count)
+ name_new = "%s%s%03d" % (
+ name_new_orig,
+ sep,
+ count,
+ )
count += 1
else:
name_new = name_new[:name_max]
while name_new in name_dict_values:
count_str = "%03d" % count
- name_new = "%.*s%s%s" % (name_max - (len(count_str) + 1),
- name_new_orig,
- sep,
- count_str,
- )
+ name_new = "%.*s%s%s" % (
+ name_max - (len(count_str) + 1),
+ name_new_orig,
+ sep,
+ count_str,
+ )
count += 1
name_dict[key] = name_new
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index c97b973c9c7..6c5cd01ffc2 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -60,12 +60,14 @@ class Library(bpy_types.ID):
# See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE,
# we could make this an attribute in rna.
- attr_links = ("actions", "armatures", "brushes", "cameras",
- "curves", "grease_pencils", "collections", "images",
- "lights", "lattices", "materials", "metaballs",
- "meshes", "node_groups", "objects", "scenes",
- "sounds", "speakers", "textures", "texts",
- "fonts", "worlds")
+ attr_links = (
+ "actions", "armatures", "brushes", "cameras",
+ "curves", "grease_pencils", "collections", "images",
+ "lights", "lattices", "materials", "metaballs",
+ "meshes", "node_groups", "objects", "scenes",
+ "sounds", "speakers", "textures", "texts",
+ "fonts", "worlds",
+ )
return tuple(id_block
for attr in attr_links
@@ -90,11 +92,13 @@ class Texture(bpy_types.ID):
def users_object_modifier(self):
"""Object modifiers that use this texture"""
import bpy
- return tuple(obj for obj in bpy.data.objects if
- self in [mod.texture
- for mod in obj.modifiers
- if mod.type == 'DISPLACE']
- )
+ return tuple(
+ obj for obj in bpy.data.objects if
+ self in [
+ mod.texture
+ for mod in obj.modifiers
+ if mod.type == 'DISPLACE']
+ )
class Collection(bpy_types.ID):
@@ -122,10 +126,15 @@ class Object(bpy_types.ID):
def users_collection(self):
"""The collections this object is in. Warning: takes O(len(bpy.data.collections) + len(bpy.data.scenes)) time."""
import bpy
- return tuple(collection for collection in bpy.data.collections
- if self in collection.objects[:]) + \
- tuple(scene.collection for scene in bpy.data.scenes
- if self in scene.collection.objects[:])
+ return (
+ tuple(
+ collection for collection in bpy.data.collections
+ if self in collection.objects[:]
+ ) + tuple(
+ scene.collection for scene in bpy.data.scenes
+ if self in scene.collection.objects[:]
+ )
+ )
@property
def users_scene(self):
@@ -471,18 +480,20 @@ class MeshLoopTriangle(StructRNA):
"""The midpoint of the face."""
face_verts = self.vertices[:]
mesh_verts = self.id_data.vertices
- return (mesh_verts[face_verts[0]].co +
- mesh_verts[face_verts[1]].co +
- mesh_verts[face_verts[2]].co
- ) / 3.0
+ return (
+ mesh_verts[face_verts[0]].co +
+ mesh_verts[face_verts[1]].co +
+ mesh_verts[face_verts[2]].co
+ ) / 3.0
@property
def edge_keys(self):
verts = self.vertices[:]
- return (ord_ind(verts[0], verts[1]),
- ord_ind(verts[1], verts[2]),
- ord_ind(verts[2], verts[0]),
- )
+ return (
+ ord_ind(verts[0], verts[1]),
+ ord_ind(verts[1], verts[2]),
+ ord_ind(verts[2], verts[0]),
+ )
class MeshPolygon(StructRNA):
@@ -860,15 +871,15 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
# collect paths
files = []
for directory in searchpaths:
- files.extend(
- [(f, os.path.join(directory, f))
+ files.extend([
+ (f, os.path.join(directory, f))
for f in os.listdir(directory)
if (not f.startswith("."))
if ((filter_ext is None) or
(filter_ext(os.path.splitext(f)[1])))
if ((filter_path is None) or
(filter_path(f)))
- ])
+ ])
files.sort()
@@ -926,11 +937,13 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
ext_valid = getattr(self, "preset_extensions", {".py", ".xml"})
props_default = getattr(self, "preset_operator_defaults", None)
add_operator = getattr(self, "preset_add_operator", None)
- self.path_menu(bpy.utils.preset_paths(self.preset_subdir),
- self.preset_operator,
- props_default=props_default,
- filter_ext=lambda ext: ext.lower() in ext_valid,
- add_operator=add_operator)
+ self.path_menu(
+ bpy.utils.preset_paths(self.preset_subdir),
+ self.preset_operator,
+ props_default=props_default,
+ filter_ext=lambda ext: ext.lower() in ext_valid,
+ add_operator=add_operator,
+ )
@classmethod
def draw_collapsible(cls, context, layout):
@@ -965,9 +978,10 @@ class NodeSocket(StructRNA, metaclass=RNAMetaPropGroup):
@property
def links(self):
"""List of node links from or to this socket. Warning: takes O(len(nodetree.links)) time."""
- return tuple(link for link in self.id_data.links
- if (link.from_socket == self or
- link.to_socket == self))
+ return tuple(
+ link for link in self.id_data.links
+ if (link.from_socket == self or
+ link.to_socket == self))
class NodeSocketInterface(StructRNA, metaclass=RNAMetaPropGroup):