diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-26 23:56:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-26 23:56:39 +0300 |
commit | a61480c27103fbf449fd14ea8061b65c29f19eae (patch) | |
tree | 8d626b465ebe17936b7551aa91cc5b9d3b192607 /release/scripts/templates_py/operator_mesh_add.py | |
parent | a3cd57ea8c57c10d4c65ddd51faa6cce14c98e10 (diff) | |
parent | 532c8ac58384309e77791e32ab78f448ad2a76a6 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'release/scripts/templates_py/operator_mesh_add.py')
-rw-r--r-- | release/scripts/templates_py/operator_mesh_add.py | 104 |
1 files changed, 54 insertions, 50 deletions
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() |