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>2016-12-30 22:33:05 +0300
committerlijenstina <lijenstina@gmail.com>2016-12-30 22:33:05 +0300
commitc86080a455579a8c770545e33b95513b43e1a43b (patch)
tree6c392b16b914aa3264b373022602e57ad493e7d7 /add_mesh_extra_objects/add_mesh_gemstones.py
parentc95e86bcef654c0686d3cf4d52446ff9ff8c819f (diff)
Add mesh extra objects: Update to version 0.3.1
General Pep8 cleanup Removed unused variables and imports Removed a panel from add_empty_as_parent Standardized the property definitions across all the scripts Moved scene props from third_domes_panel_271 to init for proper removal Added a Enum prop for mesh type in teapot Fixed a small issue with Geodesic domes self.reports (problem with value fields message spam) Fixed props names in Geodesic domes Consistent tooltips Reorganized menus: Mechanical Menu including Pipe joints, Mesh gear Added separators
Diffstat (limited to 'add_mesh_extra_objects/add_mesh_gemstones.py')
-rw-r--r--add_mesh_extra_objects/add_mesh_gemstones.py157
1 files changed, 93 insertions, 64 deletions
diff --git a/add_mesh_extra_objects/add_mesh_gemstones.py b/add_mesh_extra_objects/add_mesh_gemstones.py
index e6b4b67b..f99bcd43 100644
--- a/add_mesh_extra_objects/add_mesh_gemstones.py
+++ b/add_mesh_extra_objects/add_mesh_gemstones.py
@@ -1,14 +1,20 @@
# GPL # "author": "Pontiac, Fourmadmen, Dreampainter"
import bpy
-from mathutils import *
-from math import *
-from bpy.props import *
+from bpy.types import Operator
+from mathutils import Vector, Quaternion
+from math import cos, sin, pi
+from bpy.props import (
+ FloatProperty,
+ IntProperty,
+ )
+
# Create a new mesh (object) from verts/edges/faces.
# verts/edges/faces ... List of vertices/edges/faces for the
-# new mesh (as used in from_pydata).
-# name ... Name of the new mesh (& object).
+# new mesh (as used in from_pydata)
+# name ... Name of the new mesh (& object)
+
def create_mesh_object(context, verts, edges, faces, name):
# Create new mesh
@@ -23,6 +29,7 @@ def create_mesh_object(context, verts, edges, faces, name):
from bpy_extras import object_utils
return object_utils.object_data_add(context, mesh, operator=None)
+
# A very simple "bridge" tool.
def createFaces(vertIdx1, vertIdx2, closed=False, flipped=False):
@@ -44,7 +51,7 @@ def createFaces(vertIdx1, vertIdx2, closed=False, flipped=False):
total = len(vertIdx2)
if closed:
- # Bridge the start with the end.
+ # Bridge the start with the end
if flipped:
face = [
vertIdx1[0],
@@ -61,7 +68,7 @@ def createFaces(vertIdx1, vertIdx2, closed=False, flipped=False):
face.append(vertIdx2[total - 1])
faces.append(face)
- # Bridge the rest of the faces.
+ # Bridge the rest of the faces
for num in range(total - 1):
if flipped:
if fan:
@@ -80,6 +87,7 @@ def createFaces(vertIdx1, vertIdx2, closed=False, flipped=False):
return faces
+
# @todo Clean up vertex&face creation process a bit.
def add_gem(r1, r2, seg, h1, h2):
"""
@@ -139,8 +147,9 @@ def add_gem(r1, r2, seg, h1, h2):
return verts, faces
+
def add_diamond(segments, girdle_radius, table_radius,
- crown_height, pavilion_height):
+ crown_height, pavilion_height):
PI_2 = pi * 2.0
z_axis = (0.0, 0.0, -1.0)
@@ -192,37 +201,48 @@ def add_diamond(segments, girdle_radius, table_radius,
return verts, faces
-class AddDiamond(bpy.types.Operator):
- """Add a diamond mesh"""
+
+class AddDiamond(Operator):
bl_idname = "mesh.primitive_diamond_add"
bl_label = "Add Diamond"
+ bl_description = "Construct a diamond mesh"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- segments = IntProperty(name="Segments",
- description="Number of segments for the diamond",
- min=3,
- max=256,
- default=32)
- girdle_radius = FloatProperty(name="Girdle Radius",
- description="Girdle radius of the diamond",
- min=0.01,
- max=9999.0,
- default=1.0)
- table_radius = FloatProperty(name="Table Radius",
- description="Girdle radius of the diamond",
- min=0.01,
- max=9999.0,
- default=0.6)
- crown_height = FloatProperty(name="Crown Height",
- description="Crown height of the diamond",
- min=0.01,
- max=9999.0,
- default=0.35)
- pavilion_height = FloatProperty(name="Pavilion Height",
- description="Pavilion height of the diamond",
- min=0.01,
- max=9999.0,
- default=0.8)
+ segments = IntProperty(
+ name="Segments",
+ description="Number of segments for the diamond",
+ min=3,
+ max=256,
+ default=32
+ )
+ girdle_radius = FloatProperty(
+ name="Girdle Radius",
+ description="Girdle radius of the diamond",
+ min=0.01,
+ max=9999.0,
+ default=1.0
+ )
+ table_radius = FloatProperty(
+ name="Table Radius",
+ description="Girdle radius of the diamond",
+ min=0.01,
+ max=9999.0,
+ default=0.6
+ )
+ crown_height = FloatProperty(
+ name="Crown Height",
+ description="Crown height of the diamond",
+ min=0.01,
+ max=9999.0,
+ default=0.35
+ )
+ pavilion_height = FloatProperty(
+ name="Pavilion Height",
+ description="Pavilion height of the diamond",
+ min=0.01,
+ max=9999.0,
+ default=0.8
+ )
def execute(self, context):
verts, faces = add_diamond(self.segments,
@@ -235,41 +255,50 @@ class AddDiamond(bpy.types.Operator):
return {'FINISHED'}
-class AddGem(bpy.types.Operator):
- """Add a diamond gem"""
+
+class AddGem(Operator):
bl_idname = "mesh.primitive_gem_add"
bl_label = "Add Gem"
- bl_description = "Create an offset faceted gem"
+ bl_description = "Construct an offset faceted gem mesh"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- segments = IntProperty(name="Segments",
- description="Longitudial segmentation",
- min=3,
- max=265,
- default=8,)
- pavilion_radius = FloatProperty(name="Radius",
- description="Radius of the gem",
- min=0.01,
- max=9999.0,
- default=1.0)
- crown_radius = FloatProperty(name="Table Radius",
- description="Radius of the table(top)",
- min=0.01,
- max=9999.0,
- default=0.6)
- crown_height = FloatProperty(name="Table height",
- description="Height of the top half",
- min=0.01,
- max=9999.0,
- default=0.35)
- pavilion_height = FloatProperty(name="Pavilion height",
- description="Height of bottom half",
- min=0.01,
- max=9999.0,
- default=0.8)
+ segments = IntProperty(
+ name="Segments",
+ description="Longitudial segmentation",
+ min=3,
+ max=265,
+ default=8
+ )
+ pavilion_radius = FloatProperty(
+ name="Radius",
+ description="Radius of the gem",
+ min=0.01,
+ max=9999.0,
+ default=1.0
+ )
+ crown_radius = FloatProperty(
+ name="Table Radius",
+ description="Radius of the table(top)",
+ min=0.01,
+ max=9999.0,
+ default=0.6
+ )
+ crown_height = FloatProperty(
+ name="Table height",
+ description="Height of the top half",
+ min=0.01,
+ max=9999.0,
+ default=0.35
+ )
+ pavilion_height = FloatProperty(
+ name="Pavilion height",
+ description="Height of bottom half",
+ min=0.01,
+ max=9999.0,
+ default=0.8
+ )
def execute(self, context):
-
# create mesh
verts, faces = add_gem(
self.pavilion_radius,