From 4fcdcbe38d2e7ce170d951e37c24b60e202919c4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Oct 2019 15:20:15 +1100 Subject: Cleanup: pep8 for templates --- release/scripts/templates_py/operator_mesh_add.py | 17 +++++++++-------- release/scripts/templates_py/operator_modal_draw.py | 1 + release/scripts/templates_py/ui_tool_simple.py | 11 +++++++---- 3 files changed, 17 insertions(+), 12 deletions(-) (limited to 'release') diff --git a/release/scripts/templates_py/operator_mesh_add.py b/release/scripts/templates_py/operator_mesh_add.py index d3df64a5501..01a9ad6160e 100644 --- a/release/scripts/templates_py/operator_mesh_add.py +++ b/release/scripts/templates_py/operator_mesh_add.py @@ -2,6 +2,7 @@ import bpy import bmesh from bpy_extras.object_utils import AddObjectHelper + def add_box(width, height, depth): """ This function takes inputs and returns vertex and face arrays. @@ -77,16 +78,16 @@ class AddBox(bpy.types.Operator): # generic transform props align_items = ( - ('WORLD', "World", "Align the new object to the world"), - ('VIEW', "View", "Align the new object to the view"), - ('CURSOR', "3D Cursor", "Use the 3D cursor orientation for the new object") + ('WORLD', "World", "Align the new object to the world"), + ('VIEW', "View", "Align the new object to the view"), + ('CURSOR', "3D Cursor", "Use the 3D cursor orientation for the new object") ) align: EnumProperty( - name="Align", - items=align_items, - default='WORLD', - update=AddObjectHelper.align_update_callback, - ) + name="Align", + items=align_items, + default='WORLD', + update=AddObjectHelper.align_update_callback, + ) location: FloatVectorProperty( name="Location", subtype='TRANSLATION', diff --git a/release/scripts/templates_py/operator_modal_draw.py b/release/scripts/templates_py/operator_modal_draw.py index 5dc72c36a8f..1e185ecfe2b 100644 --- a/release/scripts/templates_py/operator_modal_draw.py +++ b/release/scripts/templates_py/operator_modal_draw.py @@ -4,6 +4,7 @@ import blf import gpu from gpu_extras.batch import batch_for_shader + def draw_callback_px(self, context): print("mouse points", len(self.mouse_path)) diff --git a/release/scripts/templates_py/ui_tool_simple.py b/release/scripts/templates_py/ui_tool_simple.py index afda5088e69..fc239093b9c 100644 --- a/release/scripts/templates_py/ui_tool_simple.py +++ b/release/scripts/templates_py/ui_tool_simple.py @@ -3,9 +3,10 @@ import bpy from bpy.types import WorkSpaceTool + class MyTool(WorkSpaceTool): - bl_space_type='VIEW_3D' - bl_context_mode='OBJECT' + bl_space_type = 'VIEW_3D' + bl_context_mode = 'OBJECT' # The prefix of the idname should be your add-on name. bl_idname = "my_template.my_circle_select" @@ -30,8 +31,8 @@ class MyTool(WorkSpaceTool): class MyOtherTool(WorkSpaceTool): - bl_space_type='VIEW_3D' - bl_context_mode='OBJECT' + bl_space_type = 'VIEW_3D' + bl_context_mode = 'OBJECT' bl_idname = "my_template.my_other_select" bl_label = "My Lasso Tool Select" @@ -56,9 +57,11 @@ def register(): bpy.utils.register_tool(MyTool, after={"builtin.scale_cage"}, separator=True, group=True) bpy.utils.register_tool(MyOtherTool, after={MyTool.bl_idname}) + def unregister(): bpy.utils.unregister_tool(MyTool) bpy.utils.unregister_tool(MyOtherTool) + if __name__ == "__main__": register() -- cgit v1.2.3