Cleanup: pep8 for templates

This commit is contained in:
Campbell Barton
2019-10-15 15:20:15 +11:00
parent 46102cf4e0
commit 4fcdcbe38d
3 changed files with 17 additions and 12 deletions

View File

@@ -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',

View File

@@ -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))

View File

@@ -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()