Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/templates_py/operator_mesh_add.py')
-rw-r--r--release/scripts/templates_py/operator_mesh_add.py104
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()