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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijenstina <lijenstina@gmail.com>2017-06-10 00:06:28 +0300
committerlijenstina <lijenstina@gmail.com>2017-06-10 00:06:28 +0300
commitaa8f255c0eaf31b2665d6adf0569da4892d8d1a4 (patch)
treec2bfef22a0c8b3329d45e93f8722b2e2f3884c90 /add_mesh_extra_objects/add_mesh_round_cube.py
parent84baf76f48e023eafde8d567490b7b0ba901e9fb (diff)
Add Mesh Extra Objects: Update, Fix crash with Wall Factory
Bumped version to 0.3.2 Wall Factory: Fix crash with Wall Factory when openings and slots are enabled (unorderable types: opening() < opening()) with the repeat option on as the sort function compared stored classes instead of the numerical values Fix the module not working properly after (F8) reload Cleanup - consistent prop definitions Remove star imports Small UI reorganization to save vertical space The code will probably need some further refactor as the usage of globals is not so clear add_mesh_triangles: cleanup, remove unused vars add missing GPL notice, some UI tweaks, add tooltip add_mesh_pyramid: indentation cleanup add_mesh_beam_builder: add an option to snap to cursor add_mesh_teapot: use defs instead of assigning lambdas (E731)
Diffstat (limited to 'add_mesh_extra_objects/add_mesh_round_cube.py')
-rw-r--r--add_mesh_extra_objects/add_mesh_round_cube.py53
1 files changed, 29 insertions, 24 deletions
diff --git a/add_mesh_extra_objects/add_mesh_round_cube.py b/add_mesh_extra_objects/add_mesh_round_cube.py
index b56ac3d3..dca438ae 100644
--- a/add_mesh_extra_objects/add_mesh_round_cube.py
+++ b/add_mesh_extra_objects/add_mesh_round_cube.py
@@ -3,7 +3,11 @@
import bpy
from bpy_extras import object_utils
from itertools import permutations
-from math import copysign, pi, sqrt
+from math import (
+ copysign, pi,
+ sqrt,
+ )
+from bpy.types import Operator
from bpy.props import (
BoolProperty,
EnumProperty,
@@ -109,12 +113,12 @@ def round_cube(radius=1.0, arcdiv=4, lindiv=0., size=(0., 0., 0.),
# Sides built left to right bottom up
# xp yp zp xd yd zd
- sides = ((0, 2, 1, (-1, 1, 1)), # Y+ Front
- (1, 2, 0, (-1, -1, 1)), # X- Left
- (0, 2, 1, ( 1, -1, 1)), # Y- Back
- (1, 2, 0, ( 1, 1, 1)), # X+ Right
- (0, 1, 2, (-1, 1, -1)), # Z- Bottom
- (0, 1, 2, (-1, -1, 1))) # Z+ Top
+ sides = ((0, 2, 1, (-1, 1, 1)), # Y+ Front
+ (1, 2, 0, (-1, -1, 1)), # X- Left
+ (0, 2, 1, (1, -1, 1)), # Y- Back
+ (1, 2, 0, (1, 1, 1)), # X+ Right
+ (0, 1, 2, (-1, 1, -1)), # Z- Bottom
+ (0, 1, 2, (-1, -1, 1))) # Z+ Top
# side vertex index table (for sphere)
svit = [[[] for i in range(steps)] for i in range(6)]
@@ -325,36 +329,34 @@ def round_cube(radius=1.0, arcdiv=4, lindiv=0., size=(0., 0., 0.),
return verts, faces
-class AddRoundCube(bpy.types.Operator, object_utils.AddObjectHelper):
+class AddRoundCube(Operator, object_utils.AddObjectHelper):
bl_idname = "mesh.primitive_round_cube_add"
bl_label = "Add Round Cube"
- bl_description = (
- "Create mesh primitives: Quadspheres, "
- "Capsules, Rounded Cuboids, 3D Grids etc"
- )
+ bl_description = ("Create mesh primitives: Quadspheres, "
+ "Capsules, Rounded Cuboids, 3D Grids etc")
bl_options = {"REGISTER", "UNDO", "PRESET"}
sanity_check_verts = 200000
vert_count = 0
radius = FloatProperty(
- name='Radius',
- description='Radius of vertices for sphere, capsule or cuboid bevel',
+ name="Radius",
+ description="Radius of vertices for sphere, capsule or cuboid bevel",
default=1.0, min=0.0, soft_min=0.01, step=10
)
size = FloatVectorProperty(
- name='Size',
- description='Size',
+ name="Size",
+ description="Size",
subtype='XYZ',
)
arc_div = IntProperty(
- name='Arc Divisions',
- description='Arc curve divisions, per quadrant; 0=derive from Linear',
+ name="Arc Divisions",
+ description="Arc curve divisions, per quadrant, 0=derive from Linear",
default=4, min=1
)
lin_div = FloatProperty(
- name='Linear Divisions',
- description='Linear unit divisions (Edges/Faces); 0=derive from Arc',
+ name="Linear Divisions",
+ description="Linear unit divisions (Edges/Faces), 0=derive from Arc",
default=0.0, min=0.0, step=100, precision=1
)
div_type = EnumProperty(
@@ -378,7 +380,8 @@ class AddRoundCube(bpy.types.Operator, object_utils.AddObjectHelper):
def execute(self, context):
if self.arc_div <= 0 and self.lin_div <= 0:
- self.report({'ERROR'}, 'Either Arc Divisions or Linear Divisions must be greater than zero!')
+ self.report({'ERROR'},
+ "Either Arc Divisions or Linear Divisions must be greater than zero")
return {'CANCELLED'}
if not self.no_limit:
@@ -397,8 +400,11 @@ class AddRoundCube(bpy.types.Operator, object_utils.AddObjectHelper):
return {'FINISHED'}
def check(self, context):
- self.arcdiv, self.lindiv, self.vert_count = round_cube(self.radius, self.arc_div, self.lin_div,
- self.size, self.div_type, self.odd_axis_align, True)
+ self.arcdiv, self.lindiv, self.vert_count = round_cube(
+ self.radius, self.arc_div, self.lin_div,
+ self.size, self.div_type, self.odd_axis_align,
+ True
+ )
return True
def invoke(self, context, event):
@@ -440,4 +446,3 @@ class AddRoundCube(bpy.types.Operator, object_utils.AddObjectHelper):
col.prop(self, 'location', expand=True)
col = layout.column(align=True)
col.prop(self, 'rotation', expand=True)
-