From 432bfbf7a3b74943b1c251c12bd76616da23991f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 6 Jul 2021 12:05:27 +1000 Subject: Cleanup: pep8 --- doc/python_api/examples/bpy.app.handlers.2.py | 1 + doc/python_api/examples/bpy.app.timers.5.py | 2 ++ doc/python_api/examples/bpy.msgbus.1.py | 2 ++ doc/python_api/examples/bpy.types.Depsgraph.7.py | 2 +- doc/python_api/examples/gpu.6.py | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) (limited to 'doc/python_api') diff --git a/doc/python_api/examples/bpy.app.handlers.2.py b/doc/python_api/examples/bpy.app.handlers.2.py index aaaedeabecb..d514fa3fa4b 100644 --- a/doc/python_api/examples/bpy.app.handlers.2.py +++ b/doc/python_api/examples/bpy.app.handlers.2.py @@ -12,6 +12,7 @@ such cases, lock the interface (Render → Lock Interface or Below is an example of a mesh that is altered from a handler: """ + def frame_change_pre(scene): # A triangle that shifts in the z direction zshift = scene.frame_current * 0.1 diff --git a/doc/python_api/examples/bpy.app.timers.5.py b/doc/python_api/examples/bpy.app.timers.5.py index 821a047d7c7..dda5ea12e73 100644 --- a/doc/python_api/examples/bpy.app.timers.5.py +++ b/doc/python_api/examples/bpy.app.timers.5.py @@ -16,10 +16,12 @@ execution_queue = queue.Queue() def run_in_main_thread(function): execution_queue.put(function) + def execute_queued_functions(): while not execution_queue.empty(): function = execution_queue.get() function() return 1.0 + bpy.app.timers.register(execute_queued_functions) diff --git a/doc/python_api/examples/bpy.msgbus.1.py b/doc/python_api/examples/bpy.msgbus.1.py index 21198471ffa..8164272d521 100644 --- a/doc/python_api/examples/bpy.msgbus.1.py +++ b/doc/python_api/examples/bpy.msgbus.1.py @@ -31,11 +31,13 @@ owner = object() subscribe_to = bpy.context.object.location + def msgbus_callback(*args): # This will print: # Something changed! (1, 2, 3) print("Something changed!", args) + bpy.msgbus.subscribe_rna( key=subscribe_to, owner=owner, diff --git a/doc/python_api/examples/bpy.types.Depsgraph.7.py b/doc/python_api/examples/bpy.types.Depsgraph.7.py index 11982730fc9..afea8dfd618 100644 --- a/doc/python_api/examples/bpy.types.Depsgraph.7.py +++ b/doc/python_api/examples/bpy.types.Depsgraph.7.py @@ -44,7 +44,7 @@ class OBJECT_OT_object_to_curve(bpy.types.Operator): # Remove temporary curve. obj.to_curve_clear() # Invoke to_curve() with applying modifiers. - curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers = True) + curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers=True) self.report({'INFO'}, f"{len(curve_with_modifiers.splines)} splines in new curve with modifiers.") # Remove temporary curve. obj.to_curve_clear() diff --git a/doc/python_api/examples/gpu.6.py b/doc/python_api/examples/gpu.6.py index 334a606055a..be164a03028 100644 --- a/doc/python_api/examples/gpu.6.py +++ b/doc/python_api/examples/gpu.6.py @@ -21,6 +21,7 @@ batch = batch_for_shader( }, ) + def draw(): shader.bind() shader.uniform_sampler("image", texture) -- cgit v1.2.3