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>2018-06-26 20:41:37 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-26 20:58:56 +0300
commit532c8ac58384309e77791e32ab78f448ad2a76a6 (patch)
treecef77b98714aaed13ec8317bc9bb763d00aa1a02 /release/scripts/templates_py
parentecb56eac57e66c1c925860e05438c9f245bff505 (diff)
Cleanup: pep8 function indentation
Diffstat (limited to 'release/scripts/templates_py')
-rw-r--r--release/scripts/templates_py/addon_add_object.py25
-rw-r--r--release/scripts/templates_py/background_job.py26
-rw-r--r--release/scripts/templates_py/batch_export.py2
-rw-r--r--release/scripts/templates_py/custom_nodes.py3
-rw-r--r--release/scripts/templates_py/gamelogic.py1
-rw-r--r--release/scripts/templates_py/gamelogic_simple.py1
-rw-r--r--release/scripts/templates_py/operator_file_export.py30
-rw-r--r--release/scripts/templates_py/operator_file_import.py30
-rw-r--r--release/scripts/templates_py/operator_mesh_add.py104
-rw-r--r--release/scripts/templates_py/operator_modal_draw.py1
-rw-r--r--release/scripts/templates_py/operator_modal_view3d.py6
-rw-r--r--release/scripts/templates_py/ui_menu.py1
-rw-r--r--release/scripts/templates_py/ui_menu_simple.py1
-rw-r--r--release/scripts/templates_py/ui_previews_dynamic_enum.py18
14 files changed, 136 insertions, 113 deletions
diff --git a/release/scripts/templates_py/addon_add_object.py b/release/scripts/templates_py/addon_add_object.py
index 56e6e79b94f..b74c0f8ee25 100644
--- a/release/scripts/templates_py/addon_add_object.py
+++ b/release/scripts/templates_py/addon_add_object.py
@@ -8,7 +8,7 @@ bl_info = {
"warning": "",
"wiki_url": "",
"category": "Add Mesh",
- }
+}
import bpy
@@ -22,11 +22,12 @@ def add_object(self, context):
scale_x = self.scale.x
scale_y = self.scale.y
- verts = [Vector((-1 * scale_x, 1 * scale_y, 0)),
- Vector((1 * scale_x, 1 * scale_y, 0)),
- Vector((1 * scale_x, -1 * scale_y, 0)),
- Vector((-1 * scale_x, -1 * scale_y, 0)),
- ]
+ verts = [
+ Vector((-1 * scale_x, 1 * scale_y, 0)),
+ Vector((1 * scale_x, 1 * scale_y, 0)),
+ Vector((1 * scale_x, -1 * scale_y, 0)),
+ Vector((-1 * scale_x, -1 * scale_y, 0)),
+ ]
edges = []
faces = [[0, 1, 2, 3]]
@@ -45,11 +46,11 @@ class OBJECT_OT_add_object(Operator, AddObjectHelper):
bl_options = {'REGISTER', 'UNDO'}
scale = FloatVectorProperty(
- name="scale",
- default=(1.0, 1.0, 1.0),
- subtype='TRANSLATION',
- description="scaling",
- )
+ name="scale",
+ default=(1.0, 1.0, 1.0),
+ subtype='TRANSLATION',
+ description="scaling",
+ )
def execute(self, context):
@@ -72,7 +73,7 @@ def add_object_manual_map():
url_manual_prefix = "https://docs.blender.org/manual/en/dev/"
url_manual_mapping = (
("bpy.ops.mesh.add_object", "editors/3dview/object"),
- )
+ )
return url_manual_prefix, url_manual_mapping
diff --git a/release/scripts/templates_py/background_job.py b/release/scripts/templates_py/background_job.py
index ddd8ce1384e..2f444641a51 100644
--- a/release/scripts/templates_py/background_job.py
+++ b/release/scripts/templates_py/background_job.py
@@ -73,21 +73,27 @@ def main():
# When --help or no args are given, print this help
usage_text = (
- "Run blender in background mode with this script:"
- " blender --background --python " + __file__ + " -- [options]"
- )
+ "Run blender in background mode with this script:"
+ " blender --background --python " + __file__ + " -- [options]"
+ )
parser = argparse.ArgumentParser(description=usage_text)
# Example utility, add some text and renders or saves it (with options)
# Possible types are: string, int, long, choice, float and complex.
- parser.add_argument("-t", "--text", dest="text", type=str, required=True,
- help="This text will be used to render an image")
-
- parser.add_argument("-s", "--save", dest="save_path", metavar='FILE',
- help="Save the generated file to the specified path")
- parser.add_argument("-r", "--render", dest="render_path", metavar='FILE',
- help="Render an image to the specified path")
+ parser.add_argument(
+ "-t", "--text", dest="text", type=str, required=True,
+ help="This text will be used to render an image",
+ )
+
+ parser.add_argument(
+ "-s", "--save", dest="save_path", metavar='FILE',
+ help="Save the generated file to the specified path",
+ )
+ parser.add_argument(
+ "-r", "--render", dest="render_path", metavar='FILE',
+ help="Render an image to the specified path",
+ )
args = parser.parse_args(argv) # In this example we wont use the args
diff --git a/release/scripts/templates_py/batch_export.py b/release/scripts/templates_py/batch_export.py
index 6c77c5d6a1a..0fc888a2d4e 100644
--- a/release/scripts/templates_py/batch_export.py
+++ b/release/scripts/templates_py/batch_export.py
@@ -28,7 +28,7 @@ for obj in selection:
bpy.ops.export_scene.fbx(filepath=fn + ".fbx", use_selection=True)
- ## Can be used for multiple formats
+ # Can be used for multiple formats
# bpy.ops.export_scene.x3d(filepath=fn + ".x3d", use_selection=True)
obj.select = False
diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py
index 8ca748c1d66..23d8ee55e72 100644
--- a/release/scripts/templates_py/custom_nodes.py
+++ b/release/scripts/templates_py/custom_nodes.py
@@ -124,6 +124,8 @@ from nodeitems_utils import NodeCategory, NodeItem
# our own base class with an appropriate poll function,
# so the categories only show up in our own tree type
+
+
class MyNodeCategory(NodeCategory):
@classmethod
def poll(cls, context):
@@ -159,6 +161,7 @@ classes = (
MyCustomNode,
)
+
def register():
from bpy.utils import register_class
for cls in classes:
diff --git a/release/scripts/templates_py/gamelogic.py b/release/scripts/templates_py/gamelogic.py
index e589ad43e63..e3bb4a7bb78 100644
--- a/release/scripts/templates_py/gamelogic.py
+++ b/release/scripts/templates_py/gamelogic.py
@@ -70,4 +70,5 @@ def main():
print(own["life"])
"""
+
main()
diff --git a/release/scripts/templates_py/gamelogic_simple.py b/release/scripts/templates_py/gamelogic_simple.py
index dbfcf948b18..31cb1885717 100644
--- a/release/scripts/templates_py/gamelogic_simple.py
+++ b/release/scripts/templates_py/gamelogic_simple.py
@@ -14,4 +14,5 @@ def main():
else:
cont.deactivate(actu)
+
main()
diff --git a/release/scripts/templates_py/operator_file_export.py b/release/scripts/templates_py/operator_file_export.py
index 38c88069845..8a1eb4ae54c 100644
--- a/release/scripts/templates_py/operator_file_export.py
+++ b/release/scripts/templates_py/operator_file_export.py
@@ -26,26 +26,28 @@ class ExportSomeData(Operator, ExportHelper):
filename_ext = ".txt"
filter_glob = StringProperty(
- default="*.txt",
- options={'HIDDEN'},
- maxlen=255, # Max internal buffer length, longer would be clamped.
- )
+ default="*.txt",
+ options={'HIDDEN'},
+ maxlen=255, # Max internal buffer length, longer would be clamped.
+ )
# List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling.
use_setting = BoolProperty(
- name="Example Boolean",
- description="Example Tooltip",
- default=True,
- )
+ name="Example Boolean",
+ description="Example Tooltip",
+ default=True,
+ )
type = EnumProperty(
- name="Example Enum",
- description="Choose between two items",
- items=(('OPT_A', "First Option", "Description one"),
- ('OPT_B', "Second Option", "Description two")),
- default='OPT_A',
- )
+ name="Example Enum",
+ description="Choose between two items",
+ items=(
+ ('OPT_A', "First Option", "Description one"),
+ ('OPT_B', "Second Option", "Description two"),
+ ),
+ default='OPT_A',
+ )
def execute(self, context):
return write_some_data(context, self.filepath, self.use_setting)
diff --git a/release/scripts/templates_py/operator_file_import.py b/release/scripts/templates_py/operator_file_import.py
index 0ec57544f3d..9856b6a9040 100644
--- a/release/scripts/templates_py/operator_file_import.py
+++ b/release/scripts/templates_py/operator_file_import.py
@@ -29,26 +29,28 @@ class ImportSomeData(Operator, ImportHelper):
filename_ext = ".txt"
filter_glob = StringProperty(
- default="*.txt",
- options={'HIDDEN'},
- maxlen=255, # Max internal buffer length, longer would be clamped.
- )
+ default="*.txt",
+ options={'HIDDEN'},
+ maxlen=255, # Max internal buffer length, longer would be clamped.
+ )
# List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling.
use_setting = BoolProperty(
- name="Example Boolean",
- description="Example Tooltip",
- default=True,
- )
+ name="Example Boolean",
+ description="Example Tooltip",
+ default=True,
+ )
type = EnumProperty(
- name="Example Enum",
- description="Choose between two items",
- items=(('OPT_A', "First Option", "Description one"),
- ('OPT_B', "Second Option", "Description two")),
- default='OPT_A',
- )
+ name="Example Enum",
+ description="Choose between two items",
+ items=(
+ ('OPT_A', "First Option", "Description one"),
+ ('OPT_B', "Second Option", "Description two"),
+ ),
+ default='OPT_A',
+ )
def execute(self, context):
return read_some_data(context, self.filepath, self.use_setting)
diff --git a/release/scripts/templates_py/operator_mesh_add.py b/release/scripts/templates_py/operator_mesh_add.py
index 3231214c773..407956a0fda 100644
--- a/release/scripts/templates_py/operator_mesh_add.py
+++ b/release/scripts/templates_py/operator_mesh_add.py
@@ -8,23 +8,25 @@ def add_box(width, height, depth):
no actual mesh data creation is done here.
"""
- verts = [(+1.0, +1.0, -1.0),
- (+1.0, -1.0, -1.0),
- (-1.0, -1.0, -1.0),
- (-1.0, +1.0, -1.0),
- (+1.0, +1.0, +1.0),
- (+1.0, -1.0, +1.0),
- (-1.0, -1.0, +1.0),
- (-1.0, +1.0, +1.0),
- ]
-
- faces = [(0, 1, 2, 3),
- (4, 7, 6, 5),
- (0, 4, 5, 1),
- (1, 5, 6, 2),
- (2, 6, 7, 3),
- (4, 0, 3, 7),
- ]
+ verts = [
+ (+1.0, +1.0, -1.0),
+ (+1.0, -1.0, -1.0),
+ (-1.0, -1.0, -1.0),
+ (-1.0, +1.0, -1.0),
+ (+1.0, +1.0, +1.0),
+ (+1.0, -1.0, +1.0),
+ (-1.0, -1.0, +1.0),
+ (-1.0, +1.0, +1.0),
+ ]
+
+ faces = [
+ (0, 1, 2, 3),
+ (4, 7, 6, 5),
+ (0, 4, 5, 1),
+ (1, 5, 6, 2),
+ (2, 6, 7, 3),
+ (4, 0, 3, 7),
+ ]
# apply size
for i, v in enumerate(verts):
@@ -48,50 +50,51 @@ class AddBox(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}
width = FloatProperty(
- name="Width",
- description="Box Width",
- min=0.01, max=100.0,
- default=1.0,
- )
+ name="Width",
+ description="Box Width",
+ min=0.01, max=100.0,
+ default=1.0,
+ )
height = FloatProperty(
- name="Height",
- description="Box Height",
- min=0.01, max=100.0,
- default=1.0,
- )
+ name="Height",
+ description="Box Height",
+ min=0.01, max=100.0,
+ default=1.0,
+ )
depth = FloatProperty(
- name="Depth",
- description="Box Depth",
- min=0.01, max=100.0,
- default=1.0,
- )
+ name="Depth",
+ description="Box Depth",
+ min=0.01, max=100.0,
+ default=1.0,
+ )
layers = BoolVectorProperty(
- name="Layers",
- description="Object Layers",
- size=20,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ name="Layers",
+ description="Object Layers",
+ size=20,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
# generic transform props
view_align = BoolProperty(
- name="Align to View",
- default=False,
- )
+ name="Align to View",
+ default=False,
+ )
location = FloatVectorProperty(
- name="Location",
- subtype='TRANSLATION',
- )
+ name="Location",
+ subtype='TRANSLATION',
+ )
rotation = FloatVectorProperty(
- name="Rotation",
- subtype='EULER',
- )
+ name="Rotation",
+ subtype='EULER',
+ )
def execute(self, context):
- verts_loc, faces = add_box(self.width,
- self.height,
- self.depth,
- )
+ verts_loc, faces = add_box(
+ self.width,
+ self.height,
+ self.depth,
+ )
mesh = bpy.data.meshes.new("Box")
@@ -127,6 +130,7 @@ def unregister():
bpy.utils.unregister_class(AddBox)
bpy.types.INFO_MT_mesh_add.remove(menu_func)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/operator_modal_draw.py b/release/scripts/templates_py/operator_modal_draw.py
index d11ddf0b467..6f75d6c632e 100644
--- a/release/scripts/templates_py/operator_modal_draw.py
+++ b/release/scripts/templates_py/operator_modal_draw.py
@@ -75,5 +75,6 @@ def register():
def unregister():
bpy.utils.unregister_class(ModalDrawOperator)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/operator_modal_view3d.py b/release/scripts/templates_py/operator_modal_view3d.py
index c870bbffdcf..65bab3489b4 100644
--- a/release/scripts/templates_py/operator_modal_view3d.py
+++ b/release/scripts/templates_py/operator_modal_view3d.py
@@ -9,9 +9,9 @@ class ViewOperator(bpy.types.Operator):
bl_label = "Simple View Operator"
offset = FloatVectorProperty(
- name="Offset",
- size=3,
- )
+ name="Offset",
+ size=3,
+ )
def execute(self, context):
v3d = context.space_data
diff --git a/release/scripts/templates_py/ui_menu.py b/release/scripts/templates_py/ui_menu.py
index a21e5ed86c8..36391a54f4e 100644
--- a/release/scripts/templates_py/ui_menu.py
+++ b/release/scripts/templates_py/ui_menu.py
@@ -42,6 +42,7 @@ def unregister():
bpy.types.INFO_HT_header.remove(draw_item)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/ui_menu_simple.py b/release/scripts/templates_py/ui_menu_simple.py
index 2129dfd81a4..aaad92d0e19 100644
--- a/release/scripts/templates_py/ui_menu_simple.py
+++ b/release/scripts/templates_py/ui_menu_simple.py
@@ -19,6 +19,7 @@ def register():
def unregister():
bpy.utils.unregister_class(SimpleCustomMenu)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/ui_previews_dynamic_enum.py b/release/scripts/templates_py/ui_previews_dynamic_enum.py
index 0cfa232116d..39a3750bfee 100644
--- a/release/scripts/templates_py/ui_previews_dynamic_enum.py
+++ b/release/scripts/templates_py/ui_previews_dynamic_enum.py
@@ -89,19 +89,19 @@ preview_collections = {}
def register():
from bpy.types import WindowManager
from bpy.props import (
- StringProperty,
- EnumProperty,
- )
+ StringProperty,
+ EnumProperty,
+ )
WindowManager.my_previews_dir = StringProperty(
- name="Folder Path",
- subtype='DIR_PATH',
- default=""
- )
+ name="Folder Path",
+ subtype='DIR_PATH',
+ default=""
+ )
WindowManager.my_previews = EnumProperty(
- items=enum_previews_from_directory_items,
- )
+ items=enum_previews_from_directory_items,
+ )
# Note that preview collections returned by bpy.utils.previews
# are regular Python objects - you can use them to store custom data.