diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-26 20:41:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-26 20:58:56 +0300 |
commit | 532c8ac58384309e77791e32ab78f448ad2a76a6 (patch) | |
tree | cef77b98714aaed13ec8317bc9bb763d00aa1a02 /doc | |
parent | ecb56eac57e66c1c925860e05438c9f245bff505 (diff) |
Cleanup: pep8 function indentation
Diffstat (limited to 'doc')
24 files changed, 98 insertions, 74 deletions
diff --git a/doc/python_api/examples/bge.texture.2.py b/doc/python_api/examples/bge.texture.2.py index 96619007fba..5125c3d1957 100644 --- a/doc/python_api/examples/bge.texture.2.py +++ b/doc/python_api/examples/bge.texture.2.py @@ -185,16 +185,16 @@ FragmentShader_v210 = """ # Only use those for greater efficiency and compatiblity. # fg_shaders = { - '2vuy' :FragmentShader_2vuy, - '8BitYUV' :FragmentShader_2vuy, - 'v210' :FragmentShader_v210, - '10BitYUV' :FragmentShader_v210, - '8BitBGRA' :FragmentShader_R10l, - 'BGRA' :FragmentShader_R10l, - '8BitARGB' :FragmentShader_R10l, - '10BitRGBXLE':FragmentShader_R10l, - 'R10l' :FragmentShader_R10l - } + '2vuy': FragmentShader_2vuy, + '8BitYUV': FragmentShader_2vuy, + 'v210': FragmentShader_v210, + '10BitYUV': FragmentShader_v210, + '8BitBGRA': FragmentShader_R10l, + 'BGRA': FragmentShader_R10l, + '8BitARGB': FragmentShader_R10l, + '10BitRGBXLE': FragmentShader_R10l, + 'R10l': FragmentShader_R10l +} # @@ -220,6 +220,8 @@ def config_video(obj, format, pixel, is3D=False, mat=0, card=0): # Attach this function to an object that has a material with texture # and call it once to initialize the object # + + def init(cont): # config_video(cont.owner, 'HD720p5994', '8BitBGRA') # config_video(cont.owner, 'HD720p5994', '8BitYUV') diff --git a/doc/python_api/examples/bge.texture.py b/doc/python_api/examples/bge.texture.py index 8b24530b10a..510736805a2 100644 --- a/doc/python_api/examples/bge.texture.py +++ b/doc/python_api/examples/bge.texture.py @@ -34,7 +34,7 @@ if not hasattr(logic, 'video'): logic.mySources[0] = texture.VideoFFmpeg('movie1.avi') logic.mySources[1] = texture.VideoFFmpeg('movie2.avi') - #And then assign (and reassign) the source during the game + # And then assign (and reassign) the source during the game logic.video.source = logic.mySources[movieSel] # quick off the movie, but it wont play in the background diff --git a/doc/python_api/examples/blf.py b/doc/python_api/examples/blf.py index e288ac9db66..5e1a2ef64a7 100644 --- a/doc/python_api/examples/blf.py +++ b/doc/python_api/examples/blf.py @@ -15,6 +15,7 @@ font_info = { "handler": None, } + def init(): """init function - runs once""" import os diff --git a/doc/python_api/examples/bmesh.ops.1.py b/doc/python_api/examples/bmesh.ops.1.py index b307624467f..d6a5b1222d8 100644 --- a/doc/python_api/examples/bmesh.ops.1.py +++ b/doc/python_api/examples/bmesh.ops.1.py @@ -10,22 +10,22 @@ bm = bmesh.new() # Add a circle XXX, should return all geometry created, not just verts. bmesh.ops.create_circle( - bm, - cap_ends=False, - radius=0.2, - segments=8) + bm, + cap_ends=False, + radius=0.2, + segments=8) # Spin and deal with geometry on side 'a' edges_start_a = bm.edges[:] geom_start_a = bm.verts[:] + edges_start_a ret = bmesh.ops.spin( - bm, - geom=geom_start_a, - angle=math.radians(180.0), - steps=8, - axis=(1.0, 0.0, 0.0), - cent=(0.0, 1.0, 0.0)) + bm, + geom=geom_start_a, + angle=math.radians(180.0), + steps=8, + axis=(1.0, 0.0, 0.0), + cent=(0.0, 1.0, 0.0)) edges_end_a = [ele for ele in ret["geom_last"] if isinstance(ele, bmesh.types.BMEdge)] del ret @@ -33,8 +33,8 @@ del ret # Extrude and create geometry on side 'b' ret = bmesh.ops.extrude_edge_only( - bm, - edges=edges_start_a) + bm, + edges=edges_start_a) geom_extrude_mid = ret["geom"] del ret @@ -45,19 +45,19 @@ verts_extrude_b = [ele for ele in geom_extrude_mid edges_extrude_b = [ele for ele in geom_extrude_mid if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary] bmesh.ops.translate( - bm, - verts=verts_extrude_b, - vec=(0.0, 0.0, 1.0)) + bm, + verts=verts_extrude_b, + vec=(0.0, 0.0, 1.0)) # Create the circle on side 'b' ret = bmesh.ops.spin( - bm, - geom=verts_extrude_b + edges_extrude_b, - angle=-math.radians(180.0), - steps=8, - axis=(1.0, 0.0, 0.0), - cent=(0.0, 1.0, 1.0)) + bm, + geom=verts_extrude_b + edges_extrude_b, + angle=-math.radians(180.0), + steps=8, + axis=(1.0, 0.0, 0.0), + cent=(0.0, 1.0, 1.0)) edges_end_b = [ele for ele in ret["geom_last"] if isinstance(ele, bmesh.types.BMEdge)] del ret @@ -65,30 +65,30 @@ del ret # Bridge the resulting edge loops of both spins 'a & b' bmesh.ops.bridge_loops( - bm, - edges=edges_end_a + edges_end_b) + bm, + edges=edges_end_a + edges_end_b) # Now we have made a links of the chain, make a copy and rotate it # (so this looks something like a chain) ret = bmesh.ops.duplicate( - bm, - geom=bm.verts[:] + bm.edges[:] + bm.faces[:]) + bm, + geom=bm.verts[:] + bm.edges[:] + bm.faces[:]) geom_dupe = ret["geom"] verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)] del ret # position the new link bmesh.ops.translate( - bm, - verts=verts_dupe, - vec=(0.0, 0.0, 2.0)) + bm, + verts=verts_dupe, + vec=(0.0, 0.0, 2.0)) bmesh.ops.rotate( - bm, - verts=verts_dupe, - cent=(0.0, 1.0, 0.0), - matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z')) + bm, + verts=verts_dupe, + cent=(0.0, 1.0, 0.0), + matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z')) # Done with creating the mesh, simply link it into the scene so we can see it diff --git a/doc/python_api/examples/bpy.app.handlers.1.py b/doc/python_api/examples/bpy.app.handlers.1.py index 245ac199d58..34b16c27b86 100644 --- a/doc/python_api/examples/bpy.app.handlers.1.py +++ b/doc/python_api/examples/bpy.app.handlers.1.py @@ -17,4 +17,5 @@ from bpy.app.handlers import persistent def load_handler(dummy): print("Load Handler:", bpy.data.filepath) + bpy.app.handlers.load_post.append(load_handler) diff --git a/doc/python_api/examples/bpy.app.handlers.py b/doc/python_api/examples/bpy.app.handlers.py index 078f9df77f2..808115119b9 100644 --- a/doc/python_api/examples/bpy.app.handlers.py +++ b/doc/python_api/examples/bpy.app.handlers.py @@ -11,4 +11,5 @@ import bpy def my_handler(scene): print("Frame Change", scene.frame_current) + bpy.app.handlers.frame_change_pre.append(my_handler) diff --git a/doc/python_api/examples/bpy.app.translations.py b/doc/python_api/examples/bpy.app.translations.py index 4256147ef31..d18344f43be 100644 --- a/doc/python_api/examples/bpy.app.translations.py +++ b/doc/python_api/examples/bpy.app.translations.py @@ -54,19 +54,19 @@ translations_tuple = ( "Copyright (C) 2013 The Blender Foundation.", "This file is distributed under the same license as the Blender package.", "FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))), - ), + ), (("Operator", "Render: Copy Settings"), (("bpy.types.SCENE_OT_render_copy_settings",), ()), ("fr_FR", "Rendu : copier réglages", (False, ())), - ), + ), (("*", "Copy render settings from current scene to others"), (("bpy.types.SCENE_OT_render_copy_settings",), ()), ("fr_FR", "Copier les réglages de rendu depuis la scène courante vers d’autres", (False, ())), - ), + ), # ... etc, all messages from your addon. ) @@ -81,6 +81,7 @@ for msg in translations_tuple: # Define remaining addon (operators, UI...) here. + def register(): # Usual operator/UI/etc. registration... diff --git a/doc/python_api/examples/bpy.props.2.py b/doc/python_api/examples/bpy.props.2.py index ec9c838f5f2..aeb3bab65b4 100644 --- a/doc/python_api/examples/bpy.props.2.py +++ b/doc/python_api/examples/bpy.props.2.py @@ -14,6 +14,7 @@ class MaterialSettings(bpy.types.PropertyGroup): my_float = bpy.props.FloatProperty() my_string = bpy.props.StringProperty() + bpy.utils.register_class(MaterialSettings) bpy.types.Material.my_settings = \ diff --git a/doc/python_api/examples/bpy.props.3.py b/doc/python_api/examples/bpy.props.3.py index 807edde8f58..340618e5ca4 100644 --- a/doc/python_api/examples/bpy.props.3.py +++ b/doc/python_api/examples/bpy.props.3.py @@ -14,6 +14,7 @@ class SceneSettingItem(bpy.types.PropertyGroup): name = bpy.props.StringProperty(name="Test Prop", default="Unknown") value = bpy.props.IntProperty(name="Test Prop", default=22) + bpy.utils.register_class(SceneSettingItem) bpy.types.Scene.my_settings = \ diff --git a/doc/python_api/examples/bpy.props.4.py b/doc/python_api/examples/bpy.props.4.py index 2b44d94f72a..daab18c8986 100644 --- a/doc/python_api/examples/bpy.props.4.py +++ b/doc/python_api/examples/bpy.props.4.py @@ -14,6 +14,7 @@ import bpy def update_func(self, context): print("my test function", self) + bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func) bpy.context.scene.testprop = 11.0 diff --git a/doc/python_api/examples/bpy.props.5.py b/doc/python_api/examples/bpy.props.5.py index a9e79fa0272..c428b4743f8 100644 --- a/doc/python_api/examples/bpy.props.5.py +++ b/doc/python_api/examples/bpy.props.5.py @@ -19,6 +19,7 @@ def get_float(self): def set_float(self, value): self["testprop"] = value + bpy.types.Scene.test_float = bpy.props.FloatProperty(get=get_float, set=set_float) @@ -27,6 +28,7 @@ def get_date(self): import datetime return str(datetime.datetime.now()) + bpy.types.Scene.test_date = bpy.props.StringProperty(get=get_date) @@ -40,6 +42,7 @@ def get_array(self): def set_array(self, values): self["somebool"] = values[0] and values[1] + bpy.types.Scene.test_array = bpy.props.BoolVectorProperty(size=2, get=get_array, set=set_array) @@ -50,7 +53,7 @@ test_items = [ ("GREEN", "Green", "", 2), ("BLUE", "Blue", "", 3), ("YELLOW", "Yellow", "", 4), - ] +] def get_enum(self): @@ -61,6 +64,7 @@ def get_enum(self): def set_enum(self, value): print("setting value", value) + bpy.types.Scene.test_enum = bpy.props.EnumProperty(items=test_items, get=get_enum, set=set_enum) diff --git a/doc/python_api/examples/bpy.types.AddonPreferences.1.py b/doc/python_api/examples/bpy.types.AddonPreferences.1.py index e478ba9b19a..e6c720e0fad 100644 --- a/doc/python_api/examples/bpy.types.AddonPreferences.1.py +++ b/doc/python_api/examples/bpy.types.AddonPreferences.1.py @@ -9,7 +9,7 @@ bl_info = { "wiki_url": "", "tracker_url": "", "category": "Object", - } +} import bpy @@ -23,17 +23,17 @@ class ExampleAddonPreferences(AddonPreferences): bl_idname = __name__ filepath = StringProperty( - name="Example File Path", - subtype='FILE_PATH', - ) + name="Example File Path", + subtype='FILE_PATH', + ) number = IntProperty( - name="Example Number", - default=4, - ) + name="Example Number", + default=4, + ) boolean = BoolProperty( - name="Example Boolean", - default=False, - ) + name="Example Boolean", + default=False, + ) def draw(self, context): layout = self.layout diff --git a/doc/python_api/examples/bpy.types.Menu.2.py b/doc/python_api/examples/bpy.types.Menu.2.py index 50460f65b3d..a1cce0c3ce2 100644 --- a/doc/python_api/examples/bpy.types.Menu.2.py +++ b/doc/python_api/examples/bpy.types.Menu.2.py @@ -14,4 +14,5 @@ import bpy def menu_draw(self, context): self.layout.operator("wm.save_homefile") + bpy.types.INFO_MT_file.append(menu_draw) diff --git a/doc/python_api/examples/bpy.types.Menu.3.py b/doc/python_api/examples/bpy.types.Menu.3.py index 47c81366db4..9fe39535bbf 100644 --- a/doc/python_api/examples/bpy.types.Menu.3.py +++ b/doc/python_api/examples/bpy.types.Menu.3.py @@ -32,7 +32,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator): # variable used for all preset values preset_defines = [ "obj = bpy.context.object" - ] + ] # properties to store in the preset preset_values = [ @@ -42,7 +42,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator): "obj.show_name", "obj.show_axis", "obj.show_wire", - ] + ] # where to store the preset preset_subdir = "object/draw" @@ -61,7 +61,7 @@ def panel_func(self, context): classes = ( OBJECT_MT_draw_presets, AddPresetObjectDraw, - ) +) def register(): diff --git a/doc/python_api/examples/bpy.types.Menu.4.py b/doc/python_api/examples/bpy.types.Menu.4.py index 04ceb6654da..869def8bfe0 100644 --- a/doc/python_api/examples/bpy.types.Menu.4.py +++ b/doc/python_api/examples/bpy.types.Menu.4.py @@ -60,6 +60,7 @@ def menu_func(self, context): layout.separator() layout.operator(WM_OT_button_context_test.bl_idname) + classes = ( WM_OT_button_context_test, WM_MT_button_context, @@ -77,5 +78,6 @@ def unregister(): bpy.utils.unregister_class(cls) bpy.types.WM_MT_button_context.remove(menu_func) + if __name__ == "__main__": register() diff --git a/doc/python_api/examples/bpy.types.NodeTree.py b/doc/python_api/examples/bpy.types.NodeTree.py index da2986636ea..e969c1a41dc 100644 --- a/doc/python_api/examples/bpy.types.NodeTree.py +++ b/doc/python_api/examples/bpy.types.NodeTree.py @@ -21,4 +21,5 @@ class CyclesNodeTree(bpy.types.NodeTree): def poll(cls, context): return context.scene.render.engine == 'CYCLES' + bpy.utils.register_class(CyclesNodeTree) diff --git a/doc/python_api/examples/bpy.types.Operator.1.py b/doc/python_api/examples/bpy.types.Operator.1.py index 1ba13c040ba..f09ae969001 100644 --- a/doc/python_api/examples/bpy.types.Operator.1.py +++ b/doc/python_api/examples/bpy.types.Operator.1.py @@ -42,6 +42,7 @@ class SimpleMouseOperator(bpy.types.Operator): self.y = event.mouse_y return self.execute(context) + bpy.utils.register_class(SimpleMouseOperator) # Test call to the newly defined operator. diff --git a/doc/python_api/examples/bpy.types.Operator.2.py b/doc/python_api/examples/bpy.types.Operator.2.py index e2f9a3a84c4..d1f0edf15aa 100644 --- a/doc/python_api/examples/bpy.types.Operator.2.py +++ b/doc/python_api/examples/bpy.types.Operator.2.py @@ -42,6 +42,7 @@ def menu_func(self, context): self.layout.operator_context = 'INVOKE_DEFAULT' self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator") + # Register and add to the file selector bpy.utils.register_class(ExportSomeData) bpy.types.INFO_MT_file_export.append(menu_func) diff --git a/doc/python_api/examples/bpy.types.Operator.4.py b/doc/python_api/examples/bpy.types.Operator.4.py index e5bc6e5c70d..90d1157343d 100644 --- a/doc/python_api/examples/bpy.types.Operator.4.py +++ b/doc/python_api/examples/bpy.types.Operator.4.py @@ -41,6 +41,7 @@ class CustomDrawOperator(bpy.types.Operator): col.prop(self, "my_string") + bpy.utils.register_class(CustomDrawOperator) # test call diff --git a/doc/python_api/examples/bpy.types.Operator.py b/doc/python_api/examples/bpy.types.Operator.py index 4baa9380aa6..c9bf169f73e 100644 --- a/doc/python_api/examples/bpy.types.Operator.py +++ b/doc/python_api/examples/bpy.types.Operator.py @@ -22,6 +22,7 @@ class HelloWorldOperator(bpy.types.Operator): print("Hello World") return {'FINISHED'} + bpy.utils.register_class(HelloWorldOperator) # test call to the newly defined operator diff --git a/doc/python_api/examples/bpy.types.PropertyGroup.py b/doc/python_api/examples/bpy.types.PropertyGroup.py index 2c2aa6d9b11..974142a79b2 100644 --- a/doc/python_api/examples/bpy.types.PropertyGroup.py +++ b/doc/python_api/examples/bpy.types.PropertyGroup.py @@ -31,6 +31,7 @@ class MyPropertyGroup(bpy.types.PropertyGroup): custom_1 = bpy.props.FloatProperty(name="My Float") custom_2 = bpy.props.IntProperty(name="My Int") + bpy.utils.register_class(MyPropertyGroup) bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=MyPropertyGroup) diff --git a/doc/python_api/examples/bpy.types.WindowManager.popup_menu.py b/doc/python_api/examples/bpy.types.WindowManager.popup_menu.py index 8d2e101be5f..e6329f677f7 100644 --- a/doc/python_api/examples/bpy.types.WindowManager.popup_menu.py +++ b/doc/python_api/examples/bpy.types.WindowManager.popup_menu.py @@ -10,4 +10,5 @@ import bpy def draw(self, context): self.layout.label("Hello World") + bpy.context.window_manager.popup_menu(draw, title="Greeting", icon='INFO') diff --git a/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py b/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py index 6889fe75277..d46ffcc8373 100644 --- a/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py +++ b/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py @@ -12,6 +12,7 @@ from bpy.props import PointerProperty class MyPropGroup(bpy.types.PropertyGroup): nested = bpy.props.FloatProperty(name="Nested", default=0.0) + # register it so its available for all bones bpy.utils.register_class(MyPropGroup) bpy.types.Bone.my_prop = PointerProperty(type=MyPropGroup, diff --git a/doc/python_api/examples/gpu.offscreen.1.py b/doc/python_api/examples/gpu.offscreen.1.py index 75ddf804e70..b4eb7452ca1 100644 --- a/doc/python_api/examples/gpu.offscreen.1.py +++ b/doc/python_api/examples/gpu.offscreen.1.py @@ -23,9 +23,9 @@ class OffScreenDraw(bpy.types.Operator): @staticmethod def handle_add(self, context): OffScreenDraw._handle_draw = bpy.types.SpaceView3D.draw_handler_add( - self.draw_callback_px, (self, context), - 'WINDOW', 'POST_PIXEL', - ) + self.draw_callback_px, (self, context), + 'WINDOW', 'POST_PIXEL', + ) @staticmethod def handle_remove(): @@ -57,19 +57,19 @@ class OffScreenDraw(bpy.types.Operator): modelview_matrix = camera.matrix_world.inverted() projection_matrix = camera.calc_matrix_camera( - render.resolution_x, - render.resolution_y, - render.pixel_aspect_x, - render.pixel_aspect_y, - ) + render.resolution_x, + render.resolution_y, + render.pixel_aspect_x, + render.pixel_aspect_y, + ) offscreen.draw_view3d( - scene, - context.space_data, - context.region, - projection_matrix, - modelview_matrix, - ) + scene, + context.space_data, + context.region, + projection_matrix, + modelview_matrix, + ) @staticmethod def _opengl_draw(context, texture, aspect_ratio, scale): |