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:
authorSpivak Vladimir (cwolf3d) <cwolf3d@gmail.com>2018-12-19 03:35:52 +0300
committerSpivak Vladimir (cwolf3d) <cwolf3d@gmail.com>2018-12-19 03:35:52 +0300
commit156c5ea6a45d0549d8422e3ea295972dec7766c3 (patch)
tree6966bff1fed7789294f93ce953aa852fc55cb277 /add_curve_extra_objects
parentbf867f50228505710c51eb7d76832415c36d9f74 (diff)
Update addon to Blender 2.8
Diffstat (limited to 'add_curve_extra_objects')
-rw-r--r--add_curve_extra_objects/__init__.py88
-rw-r--r--add_curve_extra_objects/add_curve_aceous_galore.py189
-rw-r--r--add_curve_extra_objects/add_curve_braid.py40
-rw-r--r--add_curve_extra_objects/add_curve_celtic_links.py20
-rw-r--r--add_curve_extra_objects/add_curve_curly.py20
-rw-r--r--add_curve_extra_objects/add_curve_simple.py627
-rw-r--r--add_curve_extra_objects/add_curve_spirals.py65
-rw-r--r--add_curve_extra_objects/add_curve_spirofit_bouncespline.py160
-rw-r--r--add_curve_extra_objects/add_curve_torus_knots.py127
-rw-r--r--add_curve_extra_objects/add_surface_plane_cone.py51
-rw-r--r--add_curve_extra_objects/beveltaper_curve.py38
11 files changed, 565 insertions, 860 deletions
diff --git a/add_curve_extra_objects/__init__.py b/add_curve_extra_objects/__init__.py
index 5c093af4..2622401b 100644
--- a/add_curve_extra_objects/__init__.py
+++ b/add_curve_extra_objects/__init__.py
@@ -23,8 +23,8 @@
bl_info = {
"name": "Extra Objects",
"author": "Multiple Authors",
- "version": (0, 1, 2),
- "blender": (2, 76, 0),
+ "version": (0, 1, 3),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Curve > Extra Objects",
"description": "Add extra curve object types",
"warning": "",
@@ -140,10 +140,10 @@ class CurveExtraObjectsAddonPreferences(AddonPreferences):
"curve_type": ['POLY', 'NURBS'],
"spiral_direction": ['COUNTER_CLOCKWISE', 'CLOCKWISE']
}
- update_spiral_presets_msg = StringProperty(
+ update_spiral_presets_msg : StringProperty(
default="Nothing to do"
)
- update_spiral_presets = BoolProperty(
+ update_spiral_presets : BoolProperty(
name="Update Old Presets",
description="Update presets to reflect data changes",
default=False,
@@ -155,12 +155,12 @@ class CurveExtraObjectsAddonPreferences(AddonPreferences):
fixdic=spiral_fixdic
)
)
- show_menu_list = BoolProperty(
+ show_menu_list : BoolProperty(
name="Menu List",
description="Show/Hide the Add Menu items",
default=False
)
- show_panel_list = BoolProperty(
+ show_panel_list : BoolProperty(
name="Panels List",
description="Show/Hide the Panel items",
default=False
@@ -225,9 +225,9 @@ class CurveExtraObjectsAddonPreferences(AddonPreferences):
icon="LAYER_USED")
-class VIEW3D_MT_curve_knots_add(Menu):
+class INFO_MT_curve_knots_add(Menu):
# Define the "Extras" menu
- bl_idname = "VIEW3D_MT_curve_knots_add"
+ bl_idname = "INFO_MT_curve_knots_add"
bl_label = "Plants"
def draw(self, context):
@@ -236,7 +236,10 @@ class VIEW3D_MT_curve_knots_add(Menu):
layout.operator("curve.torus_knot_plus", text="Torus Knot Plus")
layout.operator("curve.celtic_links", text="Celtic Links")
- layout.operator("mesh.add_braid", text="Braid Knot")
+ layout.operator("curve.add_braid", text="Braid Knot")
+ layout.operator("object.add_spirofit_spline", icon="FORCE_MAGNETIC")
+ layout.operator("object.add_bounce_spline", icon="FORCE_HARMONIC")
+ layout.operator("object.add_catenary_curve", icon="FORCE_CURVE")
# Define "Extras" menus
@@ -247,40 +250,47 @@ def menu_func(self, context):
layout = self.layout
- layout.operator_menu_enum("mesh.curveaceous_galore", "ProfileType",
- icon='CURVE_DATA')
- layout.operator_menu_enum("curve.spirals", "spiral_type",
- icon='CURVE_DATA')
+ layout.operator_menu_enum("curve.curveaceous_galore", "ProfileType", icon='CURVE_DATA')
+ layout.operator_menu_enum("curve.spirals", "spiral_type", icon='CURVE_DATA')
layout.separator()
- layout.menu(VIEW3D_MT_curve_knots_add.bl_idname, text="Knots", icon='CURVE_DATA')
+ layout.menu(INFO_MT_curve_knots_add.bl_idname, text="Knots", icon='CURVE_DATA')
layout.separator()
- layout.operator("curve.curlycurve", text="Curly Curve",
- icon='CURVE_DATA')
- layout.menu("OBJECT_MT_bevel_taper_curve_menu", text="Bevel/Taper",
- icon='CURVE_DATA')
+ layout.operator("curve.curlycurve", text="Curly Curve", icon='CURVE_DATA')
+ #layout.menu(VIEW3D_MT_bevel_taper_curve_menu, text="Bevel/Taper", icon='CURVE_DATA')
def menu_surface(self, context):
self.layout.separator()
if context.mode == 'EDIT_SURFACE':
- self.layout.operator("curve.smooth_x_times",
- text="Special Smooth", icon="MOD_CURVE")
+ self.layout.operator("curve.smooth_x_times", text="Special Smooth", icon="MOD_CURVE")
elif context.mode == 'OBJECT':
- self.layout.operator("object.add_surface_wedge", text="Wedge",
- icon="SURFACE_DATA")
- self.layout.operator("object.add_surface_cone", text="Cone",
- icon="SURFACE_DATA")
- self.layout.operator("object.add_surface_star", text="Star",
- icon="SURFACE_DATA")
- self.layout.operator("object.add_surface_plane", text="Plane",
- icon="SURFACE_DATA")
+ self.layout.operator("object.add_surface_wedge", text="Wedge", icon="SURFACE_DATA")
+ self.layout.operator("object.add_surface_cone", text="Cone", icon="SURFACE_DATA")
+ self.layout.operator("object.add_surface_star", text="Star", icon="SURFACE_DATA")
+ self.layout.operator("object.add_surface_plane", text="Plane", icon="SURFACE_DATA")
+# Register
+classes = [
+ CurveExtraObjectsAddonPreferences,
+ INFO_MT_curve_knots_add
+]
def register():
+ from bpy.utils import register_class
+ for cls in classes:
+ register_class(cls)
+
add_curve_simple.register()
- bpy.utils.register_module(__name__)
-
+ add_curve_spirals.register()
+ add_curve_aceous_galore.register()
+ add_curve_torus_knots.register()
+ add_curve_braid.register()
+ add_curve_celtic_links.register()
+ add_curve_curly.register()
+ add_curve_spirofit_bouncespline.register()
+ add_surface_plane_cone.register()
+
# Add "Extras" menu to the "Add Curve" menu
bpy.types.VIEW3D_MT_curve_add.append(menu_func)
# Add "Extras" menu to the "Add Surface" menu
@@ -288,14 +298,24 @@ def register():
def unregister():
- add_curve_simple.unregister()
# Remove "Extras" menu from the "Add Curve" menu.
bpy.types.VIEW3D_MT_curve_add.remove(menu_func)
# Remove "Extras" menu from the "Add Surface" menu.
bpy.types.VIEW3D_MT_surface_add.remove(menu_surface)
-
- bpy.utils.unregister_module(__name__)
-
+
+ add_surface_plane_cone.unregister()
+ add_curve_spirofit_bouncespline.unregister()
+ add_curve_curly.unregister()
+ add_curve_celtic_links.unregister()
+ add_curve_braid.unregister()
+ add_curve_torus_knots.unregister()
+ add_curve_aceous_galore.unregister()
+ add_curve_spirals.unregister()
+ add_curve_simple.unregister()
+
+ from bpy.utils import unregister_class
+ for cls in reversed(classes):
+ unregister_class(cls)
if __name__ == "__main__":
register()
diff --git a/add_curve_extra_objects/add_curve_aceous_galore.py b/add_curve_extra_objects/add_curve_aceous_galore.py
index d823cbb5..246e0551 100644
--- a/add_curve_extra_objects/add_curve_aceous_galore.py
+++ b/add_curve_extra_objects/add_curve_aceous_galore.py
@@ -20,8 +20,8 @@
bl_info = {
"name": "Curveaceous Galore!",
"author": "Jimmy Hazevoet, testscreenings",
- "version": (0, 2, 1),
- "blender": (2, 59),
+ "version": (0, 2, 2),
+ "blender": (2, 80),
"location": "View3D > Add > Curve",
"description": "Adds many different types of Curves",
"warning": "",
@@ -38,7 +38,7 @@ from bpy.props import (
FloatProperty,
IntProperty,
)
-from mathutils import Matrix
+from mathutils import Matrix, Vector
from bpy.types import Operator
from math import (
sin, cos, pi
@@ -78,7 +78,7 @@ def randnum(low=0.0, high=1.0, seed=0):
# ------------------------------------------------------------
# Make some noise:
-def vTurbNoise(x, y, z, iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0):
+def vTurbNoise(x, y, z, iScale=0.25, Size=1.0, Depth=6, Hard=False, Basis=0, Seed=0):
"""
vTurbNoise((x,y,z), iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0 )
@@ -93,7 +93,7 @@ def vTurbNoise(x, y, z, iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0)
(type=float)
Depth - number of noise values added.
(type=int)
- Hard - noise hardness: 0 - soft noise; 1 - hard noise
+ Hard - noise hardness: True - soft noise; False - hard noise
(type=int)
basis - type of noise used for turbulence
(type=int)
@@ -106,8 +106,9 @@ def vTurbNoise(x, y, z, iScale=0.25, Size=1.0, Depth=6, Hard=0, Basis=0, Seed=0)
rand = randnum(-100, 100, Seed)
if Basis is 9:
Basis = 14
- vTurb = Noise.turbulence_vector((x / Size + rand, y / Size + rand, z / Size + rand),
- Depth, Hard, Basis)
+ vec = Vector((x / Size + rand, y / Size + rand, z / Size + rand))
+ vTurb = Noise.turbulence_vector(vec, Depth, Hard)
+ #mathutils.noise.turbulence_vector(position, octaves, hard, noise_basis='PERLIN_ORIGINAL', amplitude_scale=0.5, frequency_scale=2.0)
tx = vTurb[0] * iScale
ty = vTurb[1] * iScale
tz = vTurb[2] * iScale
@@ -533,7 +534,7 @@ def SplatCurve(sides=24, scale=1.0, seed=0, basis=0, radius=1.0):
i = 0
while i < sides:
t = i * step
- turb = vTurbNoise(t, t, t, 1.0, scale, 6, 0, basis, seed)
+ turb = vTurbNoise(t, t, t, 1.0, scale, 6, False, basis, seed)
turb = turb[2] * 0.5 + 0.5
x = sin(t * pi) * radius * turb
y = cos(t * pi) * radius * turb
@@ -684,7 +685,7 @@ def NoiseCurve(type=0, number=100, length=2.0, size=0.5,
# noise circle
while i < number:
t = i * step
- v = vTurbNoise(t, t, t, 1.0, size, octaves, 0, basis, seed)
+ v = vTurbNoise(t, t, t, 1.0, size, octaves, False, basis, seed)
x = sin(t * pi) + (v[0] * scale[0])
y = cos(t * pi) + (v[1] * scale[1])
z = v[2] * scale[2]
@@ -694,7 +695,7 @@ def NoiseCurve(type=0, number=100, length=2.0, size=0.5,
# noise knot / ball
while i < number:
t = i * step
- v = vTurbNoise(t, t, t, 1.0, 1.0, octaves, 0, basis, seed)
+ v = vTurbNoise(t, t, t, 1.0, 1.0, octaves, False, basis, seed)
x = v[0] * scale[0] * size
y = v[1] * scale[1] * size
z = v[2] * scale[2] * size
@@ -704,7 +705,7 @@ def NoiseCurve(type=0, number=100, length=2.0, size=0.5,
# noise linear
while i < number:
t = i * step
- v = vTurbNoise(t, t, t, 1.0, size, octaves, 0, basis, seed)
+ v = vTurbNoise(t, t, t, 1.0, size, octaves, False, basis, seed)
x = t + v[0] * scale[0]
y = v[1] * scale[1]
z = v[2] * scale[2]
@@ -727,24 +728,24 @@ def align_matrix(context):
else:
rot = Matrix()
- align_matrix = loc * rot
+ align_matrix = loc @ rot
return align_matrix
# ------------------------------------------------------------
# Curve creation functions, sets bezierhandles to auto
-def setBezierHandles(obj, mode='AUTOMATIC'):
+def setBezierHandles(obj, mode='AUTO'):
scene = bpy.context.scene
if obj.type != 'CURVE':
return
- scene.objects.active = obj
- bpy.ops.object.mode_set(mode='EDIT', toggle=True)
- bpy.ops.curve.select_all(action='SELECT')
- bpy.ops.curve.handle_type_set(type=mode)
- bpy.ops.object.mode_set(mode='OBJECT', toggle=True)
-
+ #scene.objects.active = obj
+ #bpy.ops.object.mode_set(mode='EDIT', toggle=True)
+ #bpy.ops.curve.select_all(action='SELECT')
+ #obj.select_set(action='SELECT')
+ #bpy.ops.curve.handle_type_set(type=mode)
+ #bpy.ops.object.mode_set(mode='OBJECT', toggle=True)
# get array of vertcoordinates according to splinetype
def vertsToPoints(Verts, splineType):
@@ -772,7 +773,7 @@ def vertsToPoints(Verts, splineType):
# create new CurveObject from vertarray and splineType
def createCurve(context, vertArray, self, align_matrix):
- scene = context.scene
+ scene = bpy.context.scene
# output splineType 'POLY' 'NURBS' 'BEZIER'
splineType = self.outputType
@@ -788,6 +789,9 @@ def createCurve(context, vertArray, self, align_matrix):
if splineType == 'BEZIER':
newSpline.bezier_points.add(int(len(vertArray) * 0.33))
newSpline.bezier_points.foreach_set('co', vertArray)
+ for point in newSpline.bezier_points:
+ point.handle_right_type = self.handleType
+ point.handle_left_type = self.handleType
else:
newSpline.points.add(int(len(vertArray) * 0.25 - 1))
newSpline.points.foreach_set('co', vertArray)
@@ -801,14 +805,15 @@ def createCurve(context, vertArray, self, align_matrix):
# create object with newCurve
new_obj = bpy.data.objects.new(name, newCurve)
- scene.objects.link(new_obj)
- new_obj.select = True
- scene.objects.active = new_obj
+ scene.collection.objects.link(new_obj)
+ new_obj.select_set(True)
+ #scene.objects.active = new_obj
new_obj.matrix_world = align_matrix
# set bezierhandles
- if splineType == 'BEZIER':
- setBezierHandles(new_obj, self.handleType)
+ #if splineType == 'BEZIER':
+ #bpy.ops.curve.handle_type_set(type='AUTO')
+ #setBezierHandles(new_obj, self.handleType)
return
@@ -817,7 +822,7 @@ def createCurve(context, vertArray, self, align_matrix):
# Main Function
def main(context, self, align_matrix):
# deselect all objects
- bpy.ops.object.select_all(action='DESELECT')
+ #bpy.ops.object.select_all(action='DESELECT')
# options
proType = self.ProfileType
@@ -930,7 +935,7 @@ def main(context, self, align_matrix):
class Curveaceous_galore(Operator):
- bl_idname = "mesh.curveaceous_galore"
+ bl_idname = "curve.curveaceous_galore"
bl_label = "Curve Profiles"
bl_description = "Construct many types of curves"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
@@ -939,7 +944,7 @@ class Curveaceous_galore(Operator):
align_matrix = None
# general properties
- ProfileType = EnumProperty(
+ ProfileType : EnumProperty(
name="Type",
description="Form of Curve to create",
items=[
@@ -956,7 +961,7 @@ class Curveaceous_galore(Operator):
('Splat', "Splat", "Splat"),
('Star', "Star", "Star")]
)
- outputType = EnumProperty(
+ outputType : EnumProperty(
name="Output splines",
description="Type of splines to output",
items=[
@@ -965,7 +970,7 @@ class Curveaceous_galore(Operator):
('BEZIER', "Bezier", "Bezier Spline type")]
)
# Curve Options
- shape = EnumProperty(
+ shape : EnumProperty(
name="2D / 3D",
description="2D or 3D Curve",
items=[
@@ -973,135 +978,135 @@ class Curveaceous_galore(Operator):
('3D', "3D", "3D")
]
)
- use_cyclic_u = BoolProperty(
+ use_cyclic_u : BoolProperty(
name="Cyclic",
default=True,
description="make curve closed"
)
- endp_u = BoolProperty(
+ endp_u : BoolProperty(
name="Use endpoint u",
default=True,
description="stretch to endpoints"
)
- order_u = IntProperty(
+ order_u : IntProperty(
name="Order u",
default=4,
min=2, soft_min=2,
max=6, soft_max=6,
description="Order of nurbs spline"
)
- handleType = EnumProperty(
+ handleType : EnumProperty(
name="Handle type",
- default='AUTOMATIC',
+ default='AUTO',
description="Bezier handles type",
items=[
('VECTOR', "Vector", "Vector type Bezier handles"),
- ('AUTOMATIC', "Auto", "Automatic type Bezier handles")]
+ ('AUTO', "Auto", "Automatic type Bezier handles")]
)
# ProfileCurve properties
- ProfileCurveType = IntProperty(
+ ProfileCurveType : IntProperty(
name="Type",
min=1,
max=5,
default=1,
description="Type of Curve's Profile"
)
- ProfileCurvevar1 = FloatProperty(
+ ProfileCurvevar1 : FloatProperty(
name="Variable 1",
default=0.25,
description="Variable 1 of Curve's Profile"
)
- ProfileCurvevar2 = FloatProperty(
+ ProfileCurvevar2 : FloatProperty(
name="Variable 2",
default=0.25,
description="Variable 2 of Curve's Profile"
)
# Arrow, Rectangle, MiscCurve properties
- MiscCurveType = IntProperty(
+ MiscCurveType : IntProperty(
name="Type",
min=0,
max=3,
default=0,
description="Type of Curve"
)
- MiscCurvevar1 = FloatProperty(
+ MiscCurvevar1 : FloatProperty(
name="Variable 1",
default=1.0,
description="Variable 1 of Curve"
)
- MiscCurvevar2 = FloatProperty(
+ MiscCurvevar2 : FloatProperty(
name="Variable 2",
default=0.5,
description="Variable 2 of Curve"
)
- MiscCurvevar3 = FloatProperty(
+ MiscCurvevar3 : FloatProperty(
name="Variable 3",
default=0.1,
min=0,
description="Variable 3 of Curve"
)
# Common properties
- innerRadius = FloatProperty(
+ innerRadius : FloatProperty(
name="Inner radius",
default=0.5,
min=0,
description="Inner radius"
)
- middleRadius = FloatProperty(
+ middleRadius : FloatProperty(
name="Middle radius",
default=0.95,
min=0,
description="Middle radius"
)
- outerRadius = FloatProperty(
+ outerRadius : FloatProperty(
name="Outer radius",
default=1.0,
min=0,
description="Outer radius"
)
# Flower properties
- petals = IntProperty(
+ petals : IntProperty(
name="Petals",
default=8,
min=2,
description="Number of petals"
)
- petalWidth = FloatProperty(
+ petalWidth : FloatProperty(
name="Petal width",
default=2.0,
min=0.01,
description="Petal width"
)
# Star properties
- starPoints = IntProperty(
+ starPoints : IntProperty(
name="Star points",
default=8,
min=2,
description="Number of star points"
)
- starTwist = FloatProperty(
+ starTwist : FloatProperty(
name="Twist",
default=0.0,
description="Twist"
)
# Arc properties
- arcSides = IntProperty(
+ arcSides : IntProperty(
name="Arc sides",
default=6,
min=1,
description="Sides of arc"
)
- startAngle = FloatProperty(
+ startAngle : FloatProperty(
name="Start angle",
default=0.0,
description="Start angle"
)
- endAngle = FloatProperty(
+ endAngle : FloatProperty(
name="End angle",
default=90.0,
description="End angle"
)
- arcType = IntProperty(
+ arcType : IntProperty(
name="Arc type",
default=3,
min=1,
@@ -1109,13 +1114,13 @@ class Curveaceous_galore(Operator):
description="Sides of arc"
)
# Cogwheel properties
- teeth = IntProperty(
+ teeth : IntProperty(
name="Teeth",
default=8,
min=2,
description="number of teeth"
)
- bevel = FloatProperty(
+ bevel : FloatProperty(
name="Bevel",
default=0.5,
min=0,
@@ -1123,32 +1128,32 @@ class Curveaceous_galore(Operator):
description="Bevel"
)
# Nsided property
- Nsides = IntProperty(
+ Nsides : IntProperty(
name="Sides",
default=8,
min=3,
description="Number of sides"
)
# Splat properties
- splatSides = IntProperty(
+ splatSides : IntProperty(
name="Splat sides",
default=24,
min=3,
description="Splat sides"
)
- splatScale = FloatProperty(
+ splatScale : FloatProperty(
name="Splat scale",
default=1.0,
min=0.0001,
description="Splat scale"
)
- seed = IntProperty(
+ seed : IntProperty(
name="Seed",
default=0,
min=0,
description="Seed"
)
- basis = IntProperty(
+ basis : IntProperty(
name="Basis",
default=0,
min=0,
@@ -1156,134 +1161,134 @@ class Curveaceous_galore(Operator):
description="Basis"
)
# Helix properties
- helixPoints = IntProperty(
+ helixPoints : IntProperty(
name="Resolution",
default=100,
min=3,
description="Resolution"
)
- helixHeight = FloatProperty(
+ helixHeight : FloatProperty(
name="Height",
default=2.0,
min=0,
description="Helix height"
)
- helixStart = FloatProperty(
+ helixStart : FloatProperty(
name="Start angle",
default=0.0,
description="Helix start angle"
)
- helixEnd = FloatProperty(
+ helixEnd : FloatProperty(
name="Endangle",
default=360.0,
description="Helix end angle"
)
- helixWidth = FloatProperty(
+ helixWidth : FloatProperty(
name="Width",
default=1.0,
description="Helix width"
)
- helix_a = FloatProperty(
+ helix_a : FloatProperty(
name="Variable 1",
default=0.0,
description="Helix Variable 1"
)
- helix_b = FloatProperty(
+ helix_b : FloatProperty(
name="Variable 2",
default=0.0,
description="Helix Variable 2"
)
# Cycloid properties
- cycloPoints = IntProperty(
+ cycloPoints : IntProperty(
name="Resolution",
default=100,
min=3,
soft_min=3,
description="Resolution"
)
- cycloType = IntProperty(
+ cycloType : IntProperty(
name="Type",
default=1,
min=0,
max=2,
description="Type: Cycloid , Hypocycloid / Hypotrochoid , Epicycloid / Epitrochoid"
)
- cyclo_a = FloatProperty(
+ cyclo_a : FloatProperty(
name="R",
default=1.0,
min=0.01,
description="Cycloid: R radius a"
)
- cyclo_b = FloatProperty(
+ cyclo_b : FloatProperty(
name="r",
default=0.25,
min=0.01,
description="Cycloid: r radius b"
)
- cyclo_d = FloatProperty(
+ cyclo_d : FloatProperty(
name="d",
default=0.25,
description="Cycloid: d distance"
)
# Noise properties
- noiseType = IntProperty(
+ noiseType : IntProperty(
name="Type",
default=0,
min=0,
max=2,
description="Noise curve type: Linear, Circular or Knot"
)
- noisePoints = IntProperty(
+ noisePoints : IntProperty(
name="Resolution",
default=100,
min=3,
description="Resolution"
)
- noiseLength = FloatProperty(
+ noiseLength : FloatProperty(
name="Length",
default=2.0,
min=0.01,
description="Curve Length"
)
- noiseSize = FloatProperty(
+ noiseSize : FloatProperty(
name="Noise size",
default=1.0,
min=0.0001,
description="Noise size"
)
- noiseScaleX = FloatProperty(
+ noiseScaleX : FloatProperty(
name="Noise x",
default=1.0,
min=0.0001,
description="Noise x"
)
- noiseScaleY = FloatProperty(
+ noiseScaleY : FloatProperty(
name="Noise y",
default=1.0,
min=0.0001,
description="Noise y"
)
- noiseScaleZ = FloatProperty(
+ noiseScaleZ : FloatProperty(
name="Noise z",
default=1.0,
min=0.0001,
description="Noise z"
)
- noiseOctaves = IntProperty(
+ noiseOctaves : IntProperty(
name="Octaves",
default=2,
min=1,
max=16,
description="Basis"
)
- noiseBasis = IntProperty(
+ noiseBasis : IntProperty(
name="Basis",
default=0,
min=0,
max=9,
description="Basis"
)
- noiseSeed = IntProperty(
+ noiseSeed : IntProperty(
name="Seed",
default=1,
min=0,
@@ -1460,3 +1465,21 @@ class Curveaceous_galore(Operator):
self.execute(context)
return {'FINISHED'}
+
+# Register
+classes = [
+ Curveaceous_galore
+]
+
+def register():
+ from bpy.utils import register_class
+ for cls in classes:
+ register_class(cls)
+
+def unregister():
+ from bpy.utils import unregister_class
+ for cls in reversed(classes):
+ unregister_class(cls)
+
+if __name__ == "__main__":
+ register() \ No newline at end of file
diff --git a/add_curve_extra_objects/add_curve_braid.py b/add_curve_extra_objects/add_curve_braid.py
index 90b41e5f..fcaaf15e 100644
--- a/add_curve_extra_objects/add_curve_braid.py
+++ b/add_curve_extra_objects/add_curve_braid.py
@@ -4,8 +4,8 @@
bl_info = {
"name": "New Braid",
"author": "Jared Forsyth <github.com/jaredly>",
- "version": (1, 0, 2),
- "blender": (2, 6, 0),
+ "version": (1, 0, 3),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Mesh > New Braid",
"description": "Adds a new Braid",
"warning": "",
@@ -134,13 +134,13 @@ def star_pts(r=1, ir=None, points=5, center=(0, 0)):
def defaultCircle(w=.6):
circle = nurbs_circle('braid_circle', w, w)
- circle.hide = True
+ circle.hide_select = True
return circle
def defaultStar():
star = poly_lines('star', 'staz', [tuple(star_pts(points=5, r=.5, ir=.05))], type='NURBS')
- star.hide = True
+ star.hide_select = True
return star
@@ -151,46 +151,46 @@ def awesome_braid(strands=3, sides=5, bevel='braid_circle', pointy=False, **kwds
class Braid(Operator):
- bl_idname = "mesh.add_braid"
+ bl_idname = "curve.add_braid"
bl_label = "New Braid"
bl_description = ("Construct a new Braid\n"
"Creates two objects - the hidden one is used as the Bevel control")
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- strands = IntProperty(
+ strands : IntProperty(
name="Strands",
description="Number of Strands",
min=2, max=100,
default=3
)
- sides = IntProperty(
+ sides : IntProperty(
name="Sides",
description="Number of Knot sides",
min=2, max=100,
default=5
)
- radius = FloatProperty(
+ radius : FloatProperty(
name="Radius",
description="Increase / decrease the diameter in X,Y axis",
default=1
)
- thickness = FloatProperty(
+ thickness : FloatProperty(
name="Thickness",
description="The ratio between inner and outside diameters",
default=.3
)
- strandsize = FloatProperty(
+ strandsize : FloatProperty(
name="Bevel Depth",
description="Individual strand diameter (similar to Curve's Bevel depth)",
default=.3,
min=.01, max=10
)
- width = FloatProperty(
+ width : FloatProperty(
name="Width",
description="Stretch the Braids along the Z axis",
default=.2
)
- resolution = IntProperty(
+ resolution : IntProperty(
name="Bevel Resolution",
description="Resolution of the Created curve\n"
"Increasing this value, will produce heavy geometry",
@@ -198,7 +198,7 @@ class Braid(Operator):
max=100, soft_max=24,
default=2
)
- pointy = BoolProperty(
+ pointy : BoolProperty(
name="Pointy",
description="Switch between round and sharp corners",
default=False
@@ -209,7 +209,7 @@ class Braid(Operator):
box = layout.box()
col = box.column(align=True)
- col.label("Settings:")
+ col.label(text="Settings:")
col.prop(self, "strands")
col.prop(self, "sides")
@@ -223,13 +223,13 @@ class Braid(Operator):
box = layout.box()
col = box.column(align=True)
- col.label("Geometry Options:")
+ col.label(text="Geometry Options:")
col.prop(self, "strandsize")
col.prop(self, "resolution")
def execute(self, context):
circle = defaultCircle(self.strandsize)
- context.scene.objects.link(circle)
+ context.scene.collection.objects.link(circle)
braid = awesome_braid(
self.strands, self.sides,
bevel=circle.name,
@@ -239,12 +239,12 @@ class Braid(Operator):
mz=self.width,
resolution=self.resolution
)
- base = context.scene.objects.link(braid)
+ base = context.scene.collection.objects.link(braid)
for ob in context.scene.objects:
- ob.select = False
- base.select = True
- context.scene.objects.active = braid
+ ob.select_set(False)
+ #base.select_set(True)
+ #context.scene.objects.active = braid
return {'FINISHED'}
diff --git a/add_curve_extra_objects/add_curve_celtic_links.py b/add_curve_extra_objects/add_curve_celtic_links.py
index f4313c85..c5b581fa 100644
--- a/add_curve_extra_objects/add_curve_celtic_links.py
+++ b/add_curve_extra_objects/add_curve_celtic_links.py
@@ -26,8 +26,8 @@ bl_info = {
"name": "Celtic Knot",
"description": "",
"author": "Adam Newgas",
- "version": (0, 1, 2),
- "blender": (2, 74, 0),
+ "version": (0, 1, 3),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Curve",
"warning": "",
"wiki_url": "https://github.com/BorisTheBrave/celtic-knot/wiki",
@@ -53,13 +53,13 @@ class CelticKnotOperator(Operator):
bl_description = "Select a low poly Mesh Object to cover with Knitted Links"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- weave_up = FloatProperty(
+ weave_up : FloatProperty(
name="Weave Up",
description="Distance to shift curve upwards over knots",
subtype="DISTANCE",
unit="LENGTH"
)
- weave_down = FloatProperty(
+ weave_down : FloatProperty(
name="Weave Down",
description="Distance to shift curve downward under knots",
subtype="DISTANCE",
@@ -69,7 +69,7 @@ class CelticKnotOperator(Operator):
('ALIGNED', "Aligned", "Points at a fixed crossing angle"),
('AUTO', "Auto", "Automatic control points")
]
- handle_type = EnumProperty(
+ handle_type : EnumProperty(
items=handle_types,
name="Handle Type",
description="Controls what type the bezier control points use",
@@ -78,7 +78,7 @@ class CelticKnotOperator(Operator):
handle_type_map = {"AUTO": "AUTOMATIC", "ALIGNED": "ALIGNED"}
- crossing_angle = FloatProperty(
+ crossing_angle : FloatProperty(
name="Crossing Angle",
description="Aligned only: the angle between curves in a knot",
default=pi / 4,
@@ -86,14 +86,14 @@ class CelticKnotOperator(Operator):
subtype="ANGLE",
unit="ROTATION"
)
- crossing_strength = FloatProperty(
+ crossing_strength : FloatProperty(
name="Crossing Strength",
description="Aligned only: strength of bezier control points",
soft_min=0,
subtype="DISTANCE",
unit="LENGTH"
)
- geo_bDepth = FloatProperty(
+ geo_bDepth : FloatProperty(
name="Bevel Depth",
default=0.04,
min=0, soft_min=0,
@@ -211,7 +211,7 @@ class CelticKnotOperator(Operator):
forward = loop.vert.index == v
if not first:
- current_spline.bezier_points.add()
+ current_spline.bezier_points.add(1)
first = False
midpoint = midpoints[loop.edge.index]
normal = loop.calc_normal() + prev_loop.calc_normal()
@@ -267,7 +267,7 @@ class CelticKnotOperator(Operator):
curve_obj.data.bevel_depth = self.geo_bDepth
except:
pass
- context.scene.objects.active = orig_obj
+ #context.scene.objects.active = orig_obj
return {'FINISHED'}
diff --git a/add_curve_extra_objects/add_curve_curly.py b/add_curve_extra_objects/add_curve_curly.py
index d3950787..8cd7d8b9 100644
--- a/add_curve_extra_objects/add_curve_curly.py
+++ b/add_curve_extra_objects/add_curve_curly.py
@@ -5,8 +5,8 @@
bl_info = {
"name": "Curly Curves",
"author": "Cmomoney",
- "version": (1, 1, 8),
- "blender": (2, 69, 0),
+ "version": (1, 1, 9),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Curve > Curly Curve",
"description": "Adds a new Curly Curve",
"warning": "",
@@ -405,20 +405,20 @@ class add_curlycurve(Operator, AddObjectHelper):
bl_idname = "curve.curlycurve"
bl_label = "Add Curly Curve"
bl_description = "Create a Curly Curve"
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- types = IntProperty(
+ types : IntProperty(
name="Type",
description="Type of curly curve",
default=1,
min=1, max=10
)
- scale_x = FloatProperty(
+ scale_x : FloatProperty(
name="Scale X",
description="Scale on X axis",
default=1.0
)
- scale_y = FloatProperty(
+ scale_y : FloatProperty(
name="Scale Y",
description="Scale on Y axis",
default=1.0
@@ -434,11 +434,11 @@ class add_curlycurve(Operator, AddObjectHelper):
col.prop(self, "rotation")
col = layout.column()
- col.label("Curve:")
+ col.label(text = "Curve:")
col.prop(self, "types")
col = layout.column(align=True)
- col.label("Resize:")
+ col.label(text = "Resize:")
col.prop(self, "scale_x")
col.prop(self, "scale_y")
@@ -479,12 +479,12 @@ def add_curlycurve_button(self, context):
def register():
bpy.utils.register_class(add_curlycurve)
- bpy.types.VIEW3D_MT_curve_add.append(add_curlycurve_button)
+ #bpy.types.INFO_MT_curve_add.append(add_curlycurve_button)
def unregister():
bpy.utils.unregister_class(add_curlycurve)
- bpy.types.VIEW3D_MT_curve_add.remove(add_curlycurve_button)
+ #bpy.types.INFO_MT_curve_add.remove(add_curlycurve_button)
if __name__ == "__main__":
diff --git a/add_curve_extra_objects/add_curve_simple.py b/add_curve_extra_objects/add_curve_simple.py
index cdf91717..0d4b9224 100644
--- a/add_curve_extra_objects/add_curve_simple.py
+++ b/add_curve_extra_objects/add_curve_simple.py
@@ -19,8 +19,8 @@
bl_info = {
"name": "Simple Curve",
"author": "Spivak Vladimir (http://cwolf3d.korostyshev.net)",
- "version": (1, 5, 3),
- "blender": (2, 6, 9),
+ "version": (1, 5, 4),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Curve",
"description": "Adds Simple Curve",
"warning": "",
@@ -388,7 +388,7 @@ def align_matrix(context, location):
rot = context.space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
else:
rot = Matrix()
- align_matrix = loc * rot
+ align_matrix = loc @ rot
return align_matrix
@@ -397,19 +397,30 @@ def align_matrix(context, location):
# Main Function
def main(context, self, align_matrix):
- # deselect all objects
- bpy.ops.object.select_all(action='DESELECT')
-
# create object
- name = self.Simple_Type # Type as name
-
- # create curve
scene = bpy.context.scene
- newCurve = bpy.data.curves.new(name, type='CURVE') # curvedatablock
- newSpline = newCurve.splines.new('BEZIER') # spline
+
+ if bpy.context.mode == 'EDIT_CURVE':
+ newCurve = context.active_object.data
+ newSpline = newCurve.splines.new('BEZIER') # spline
+ else:
+ name = self.Simple_Type # Type as name
+ # create curve
+
+ newCurve = bpy.data.curves.new(name, type='CURVE') # curvedatablock
+ newSpline = newCurve.splines.new('BEZIER') # spline
+
+ # set curveOptions
+ newCurve.dimensions = self.shape
+
+ # create object with newCurve
+ SimpleCurve = bpy.data.objects.new(name, newCurve) # object
+ scene.collection.objects.link(SimpleCurve) # place in active scene
+ SimpleCurve.select_set(True)
+ SimpleCurve.matrix_world = align_matrix # apply matrix
+ SimpleCurve.rotation_euler = self.Simple_rotation_euler
- # set curveOptions
- newCurve.dimensions = self.shape
+
newSpline.use_endpoint_u = True
sides = abs(int((self.Simple_endangle - self.Simple_startangle) / 90))
@@ -525,14 +536,6 @@ def main(context, self, align_matrix):
newSpline.bezier_points.add(int(len(vertArray) * 0.333333333))
newSpline.bezier_points.foreach_set('co', vertArray)
- # create object with newCurve
- SimpleCurve = bpy.data.objects.new(name, newCurve) # object
- scene.objects.link(SimpleCurve) # place in active scene
- SimpleCurve.select = True # set as selected
- scene.objects.active = SimpleCurve # set as active
- SimpleCurve.matrix_world = align_matrix # apply matrix
- SimpleCurve.rotation_euler = self.Simple_rotation_euler
-
all_points = [p for p in newSpline.bezier_points]
d = 2 * 0.27606262
n = 0
@@ -761,45 +764,73 @@ def main(context, self, align_matrix):
all_points[int(n / 2) - 1].handle_right_type = 'VECTOR'
all_points[int(n / 2)].handle_left_type = 'VECTOR'
- SimpleCurve.s_curve.Simple = True
- SimpleCurve.s_curve.Simple_Change = False
- SimpleCurve.s_curve.Simple_Type = self.Simple_Type
- SimpleCurve.s_curve.Simple_startlocation = self.Simple_startlocation
- SimpleCurve.s_curve.Simple_endlocation = self.Simple_endlocation
- SimpleCurve.s_curve.Simple_a = self.Simple_a
- SimpleCurve.s_curve.Simple_b = self.Simple_b
- SimpleCurve.s_curve.Simple_h = self.Simple_h
- SimpleCurve.s_curve.Simple_angle = self.Simple_angle
- SimpleCurve.s_curve.Simple_startangle = self.Simple_startangle
- SimpleCurve.s_curve.Simple_endangle = self.Simple_endangle
- SimpleCurve.s_curve.Simple_rotation_euler = self.Simple_rotation_euler
- SimpleCurve.s_curve.Simple_sides = self.Simple_sides
- SimpleCurve.s_curve.Simple_radius = self.Simple_radius
- SimpleCurve.s_curve.Simple_center = self.Simple_center
- SimpleCurve.s_curve.Simple_width = self.Simple_width
- SimpleCurve.s_curve.Simple_length = self.Simple_length
- SimpleCurve.s_curve.Simple_rounded = self.Simple_rounded
-
- bpy.ops.object.mode_set(mode='EDIT', toggle=True)
- bpy.ops.curve.select_all(action='SELECT')
- bpy.ops.object.mode_set(mode='OBJECT', toggle=True)
-
return
+# ### MENU append ###
+def Simple_curve_edit_menu(self, context):
+ bl_label = 'Simple edit'
+
+ self.layout.operator("curve.bezier_points_fillet", text="Fillet")
+ self.layout.operator("curve.bezier_spline_divide", text="Divide")
+ self.layout.separator()
-# ------------------------------------------------------------
-# Delete simple curve
+def menu(self, context):
+ oper1 = self.layout.operator(Simple.bl_idname, text="Angle", icon="MOD_CURVE")
+ oper1.Simple_Change = False
+ oper1.Simple_Type = "Angle"
-def SimpleDelete(name):
- if bpy.ops.object.mode_set.poll():
- bpy.ops.object.mode_set(mode='OBJECT')
+ oper2 = self.layout.operator(Simple.bl_idname, text="Arc", icon="MOD_CURVE")
+ oper2.Simple_Change = False
+ oper2.Simple_Type = "Arc"
- bpy.context.scene.objects.active = bpy.data.objects[name]
- bpy.ops.object.delete()
+ oper3 = self.layout.operator(Simple.bl_idname, text="Circle", icon="MOD_CURVE")
+ oper3.Simple_Change = False
+ oper3.Simple_Type = "Circle"
- return
+ oper4 = self.layout.operator(Simple.bl_idname, text="Distance", icon="MOD_CURVE")
+ oper4.Simple_Change = False
+ oper4.Simple_Type = "Distance"
+
+ oper5 = self.layout.operator(Simple.bl_idname, text="Ellipse", icon="MOD_CURVE")
+ oper5.Simple_Change = False
+ oper5.Simple_Type = "Ellipse"
+ oper6 = self.layout.operator(Simple.bl_idname, text="Line", icon="MOD_CURVE")
+ oper6.Simple_Change = False
+ oper6.Simple_Type = "Line"
+ oper7 = self.layout.operator(Simple.bl_idname, text="Point", icon="MOD_CURVE")
+ oper7.Simple_Change = False
+ oper7.Simple_Type = "Point"
+
+ oper8 = self.layout.operator(Simple.bl_idname, text="Polygon", icon="MOD_CURVE")
+ oper8.Simple_Change = False
+ oper8.Simple_Type = "Polygon"
+
+ oper9 = self.layout.operator(Simple.bl_idname, text="Polygon ab", icon="MOD_CURVE")
+ oper9.Simple_Change = False
+ oper9.Simple_Type = "Polygon_ab"
+
+ oper10 = self.layout.operator(Simple.bl_idname, text="Rectangle", icon="MOD_CURVE")
+ oper10.Simple_Change = False
+ oper10.Simple_Type = "Rectangle"
+
+ oper11 = self.layout.operator(Simple.bl_idname, text="Rhomb", icon="MOD_CURVE")
+ oper11.Simple_Change = False
+ oper11.Simple_Type = "Rhomb"
+
+ oper12 = self.layout.operator(Simple.bl_idname, text="Sector", icon="MOD_CURVE")
+ oper12.Simple_Change = False
+ oper12.Simple_Type = "Sector"
+
+ oper13 = self.layout.operator(Simple.bl_idname, text="Segment", icon="MOD_CURVE")
+ oper13.Simple_Change = False
+ oper13.Simple_Type = "Segment"
+
+ oper14 = self.layout.operator(Simple.bl_idname, text="Trapezoid", icon="MOD_CURVE")
+ oper14.Simple_Change = False
+ oper14.Simple_Type = "Trapezoid"
+
# ------------------------------------------------------------
# Simple operator
@@ -810,20 +841,20 @@ class Simple(Operator):
bl_options = {'REGISTER', 'UNDO'}
# align_matrix for the invoke
- align_matrix = Matrix()
+ align_matrix : Matrix()
# change properties
- Simple = BoolProperty(
+ Simple : BoolProperty(
name="Simple",
default=True,
description="Simple Curve"
)
- Simple_Change = BoolProperty(
+ Simple_Change : BoolProperty(
name="Change",
default=False,
description="Change Simple Curve"
)
- Simple_Delete = StringProperty(
+ Simple_Delete : StringProperty(
name="Delete",
description="Delete Simple Curve"
)
@@ -843,84 +874,84 @@ class Simple(Operator):
('Polygon_ab', "Polygon ab", "Construct a Polygon ab"),
('Trapezoid', "Trapezoid", "Construct a Trapezoid")
]
- Simple_Type = EnumProperty(
+ Simple_Type : EnumProperty(
name="Type",
description="Form of Curve to create",
items=Types
)
# Line properties
- Simple_startlocation = FloatVectorProperty(
+ Simple_startlocation : FloatVectorProperty(
name="",
description="Start location",
default=(0.0, 0.0, 0.0),
subtype='TRANSLATION'
)
- Simple_endlocation = FloatVectorProperty(
+ Simple_endlocation : FloatVectorProperty(
name="",
description="End location",
default=(2.0, 2.0, 2.0),
subtype='TRANSLATION'
)
- Simple_rotation_euler = FloatVectorProperty(
+ Simple_rotation_euler : FloatVectorProperty(
name="",
description="Rotation",
default=(0.0, 0.0, 0.0),
subtype='EULER'
)
# Trapezoid properties
- Simple_a = FloatProperty(
+ Simple_a : FloatProperty(
name="Side a",
default=2.0,
min=0.0, soft_min=0.0,
unit='LENGTH',
description="a side Value"
)
- Simple_b = FloatProperty(
+ Simple_b : FloatProperty(
name="Side b",
default=1.0,
min=0.0, soft_min=0.0,
unit='LENGTH',
description="b side Value"
)
- Simple_h = FloatProperty(
+ Simple_h : FloatProperty(
name="Height",
default=1.0,
unit='LENGTH',
description="Height of the Trapezoid - distance between a and b"
)
- Simple_angle = FloatProperty(
+ Simple_angle : FloatProperty(
name="Angle",
default=45.0,
description="Angle"
)
- Simple_startangle = FloatProperty(
+ Simple_startangle : FloatProperty(
name="Start angle",
default=0.0,
min=-360.0, soft_min=-360.0,
max=360.0, soft_max=360.0,
description="Start angle"
)
- Simple_endangle = FloatProperty(
+ Simple_endangle : FloatProperty(
name="End angle",
default=45.0,
min=-360.0, soft_min=-360.0,
max=360.0, soft_max=360.0,
description="End angle"
)
- Simple_sides = IntProperty(
+ Simple_sides : IntProperty(
name="Sides",
default=3,
min=0, soft_min=0,
description="Sides"
)
- Simple_radius = FloatProperty(
+ Simple_radius : FloatProperty(
name="Radius",
default=1.0,
min=0.0, soft_min=0.0,
unit='LENGTH',
description="Radius"
)
- Simple_center = BoolProperty(
+ Simple_center : BoolProperty(
name="Length center",
default=True,
description="Length center"
@@ -928,27 +959,27 @@ class Simple(Operator):
Angle_types = [('Degrees', "Degrees", "Use Degrees"),
('Radians', "Radians", "Use Radians")]
- Simple_degrees_or_radians = EnumProperty(
+ Simple_degrees_or_radians : EnumProperty(
name="Degrees or radians",
description="Degrees or radians",
items=Angle_types
)
# Rectangle properties
- Simple_width = FloatProperty(
+ Simple_width : FloatProperty(
name="Width",
default=2.0,
min=0.0, soft_min=0,
unit='LENGTH',
description="Width"
)
- Simple_length = FloatProperty(
+ Simple_length : FloatProperty(
name="Length",
default=2.0,
min=0.0, soft_min=0.0,
unit='LENGTH',
description="Length"
)
- Simple_rounded = FloatProperty(
+ Simple_rounded : FloatProperty(
name="Rounded",
default=0.0,
min=0.0, soft_min=0.0,
@@ -959,7 +990,7 @@ class Simple(Operator):
shapeItems = [
('2D', "2D", "2D shape Curve"),
('3D', "3D", "3D shape Curve")]
- shape = EnumProperty(
+ shape : EnumProperty(
name="2D / 3D",
items=shapeItems,
description="2D or 3D Curve"
@@ -1140,10 +1171,10 @@ class Simple(Operator):
row = layout.row()
row.prop(self, "shape", expand=True)
box = layout.box()
- box.label("Location:")
+ box.label(text="Location:")
box.prop(self, "Simple_startlocation")
box = layout.box()
- box.label("Rotation:")
+ box.label(text="Rotation:")
box.prop(self, "Simple_rotation_euler")
if l != 0 or s != 0:
@@ -1151,49 +1182,22 @@ class Simple(Operator):
box.label(text="Statistics:", icon="INFO")
if l != 0:
l_str = str(round(l, 4))
- box.label("Length: " + l_str)
+ box.label(text="Length: " + l_str)
if s != 0:
s_str = str(round(s, 4))
- box.label("Area: " + s_str)
+ box.label(text="Area: " + s_str)
@classmethod
def poll(cls, context):
return context.scene is not None
def execute(self, context):
- if self.Simple_Change:
- SimpleDelete(self.Simple_Delete)
-
- # go to object mode
- if bpy.ops.object.mode_set.poll():
- bpy.ops.object.mode_set(mode='OBJECT')
-
- # turn off undo
- undo = bpy.context.user_preferences.edit.use_global_undo
- bpy.context.user_preferences.edit.use_global_undo = False
-
# main function
self.align_matrix = align_matrix(context, self.Simple_startlocation)
main(context, self, self.align_matrix)
- # restore pre operator undo state
- bpy.context.user_preferences.edit.use_global_undo = undo
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
- # store creation_matrix
- if self.Simple_Change:
- bpy.context.scene.cursor_location = self.Simple_startlocation
- else:
- self.Simple_startlocation = bpy.context.scene.cursor_location
-
- self.align_matrix = align_matrix(context, self.Simple_startlocation)
- self.execute(context)
-
return {'FINISHED'}
-
# ------------------------------------------------------------
# Fillet
@@ -1201,9 +1205,9 @@ class BezierPointsFillet(Operator):
bl_idname = "curve.bezier_points_fillet"
bl_label = "Bezier points Fillet"
bl_description = "Bezier points Fillet"
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- Fillet_radius = FloatProperty(
+ Fillet_radius : FloatProperty(
name="Radius",
default=0.25,
unit='LENGTH',
@@ -1211,7 +1215,7 @@ class BezierPointsFillet(Operator):
)
Types = [('Round', "Round", "Round"),
('Chamfer', "Chamfer", "Chamfer")]
- Fillet_Type = EnumProperty(
+ Fillet_Type : EnumProperty(
name="Type",
description="Fillet type",
items=Types
@@ -1230,15 +1234,6 @@ class BezierPointsFillet(Operator):
return context.scene is not None
def execute(self, context):
- # go to object mode
- if bpy.ops.object.mode_set.poll():
- bpy.ops.object.mode_set(mode='OBJECT')
- bpy.ops.object.mode_set(mode='EDIT')
-
- # turn off undo
- undo = bpy.context.user_preferences.edit.use_global_undo
- bpy.context.user_preferences.edit.use_global_undo = False
-
# main function
spline = bpy.context.object.data.splines.active
selected = [p for p in spline.bezier_points if p.select_control_point]
@@ -1321,17 +1316,8 @@ class BezierPointsFillet(Operator):
bpy.ops.curve.select_all(action='SELECT')
bpy.ops.curve.spline_type_set(type='BEZIER')
- # restore pre operator undo state
- bpy.context.user_preferences.edit.use_global_undo = undo
-
return {'FINISHED'}
- def invoke(self, context, event):
- self.execute(context)
-
- return {'FINISHED'}
-
-
def subdivide_cubic_bezier(p1, p2, p3, p4, t):
p12 = (p2 - p1) * t + p1
p23 = (p3 - p2) * t + p2
@@ -1352,9 +1338,9 @@ class BezierDivide(Operator):
bl_options = {'REGISTER', 'UNDO'}
# align_matrix for the invoke
- align_matrix = Matrix()
+ align_matrix : Matrix()
- Bezier_t = FloatProperty(
+ Bezier_t : FloatProperty(
name="t (0% - 100%)",
default=50.0,
min=0.0, soft_min=0.0,
@@ -1367,15 +1353,6 @@ class BezierDivide(Operator):
return context.scene is not None
def execute(self, context):
- # go to object mode
- if bpy.ops.object.mode_set.poll():
- bpy.ops.object.mode_set(mode='OBJECT')
- bpy.ops.object.mode_set(mode='EDIT')
-
- # turn off undo
- undo = bpy.context.user_preferences.edit.use_global_undo
- bpy.context.user_preferences.edit.use_global_undo = False
-
# main function
spline = bpy.context.object.data.splines.active
selected_all = [p for p in spline.bezier_points if p.select_control_point]
@@ -1414,376 +1391,30 @@ class BezierDivide(Operator):
selected_all[2].handle_right = h[3]
selected_all[0].handle_left = h[4]
- # restore pre operator undo state
- bpy.context.user_preferences.edit.use_global_undo = undo
-
return {'FINISHED'}
- def invoke(self, context, event):
- self.execute(context)
-
- return {'FINISHED'}
-
-
-# ------------------------------------------------------------
-# Simple change panel
-
-class SimplePanel(Panel):
- bl_idname = "VIEW3D_PT_simple_curve"
- bl_label = "Simple Curve"
- bl_space_type = "VIEW_3D"
- bl_region_type = "TOOLS"
- bl_options = {'DEFAULT_CLOSED'}
- bl_category = "Tools"
-
- @classmethod
- def poll(cls, context):
- if not context.active_object:
- pass
- elif context.object.s_curve.Simple is True:
- return (context.object)
-
- def draw(self, context):
- if context.object.s_curve.Simple is True:
- layout = self.layout
- obj = context.object
- row = layout.row()
-
- simple_change = row.operator("curve.simple", text="Change",
- icon="OUTLINER_DATA_CURVE")
- simple_change.Simple_Change = True
- simple_change.Simple_Delete = obj.name
- simple_change.Simple_Type = obj.s_curve.Simple_Type
- simple_change.Simple_startlocation = obj.location
- simple_change.Simple_endlocation = obj.s_curve.Simple_endlocation
-
- simple_change.Simple_a = obj.s_curve.Simple_a
- simple_change.Simple_b = obj.s_curve.Simple_b
- simple_change.Simple_h = obj.s_curve.Simple_h
-
- simple_change.Simple_angle = obj.s_curve.Simple_angle
- simple_change.Simple_startangle = obj.s_curve.Simple_startangle
- simple_change.Simple_endangle = obj.s_curve.Simple_endangle
- simple_change.Simple_rotation_euler = obj.rotation_euler
-
- simple_change.Simple_sides = obj.s_curve.Simple_sides
- simple_change.Simple_radius = obj.s_curve.Simple_radius
- simple_change.Simple_center = obj.s_curve.Simple_center
- simple_change.Simple_width = obj.s_curve.Simple_width
- simple_change.Simple_length = obj.s_curve.Simple_length
- simple_change.Simple_rounded = obj.s_curve.Simple_rounded
-
-
-# ------------------------------------------------------------
-# Fillet tools panel
-
-class SimpleEdit(Operator):
- bl_idname = "object._simple_edit"
- bl_label = "Create Curves"
- bl_description = "Subdivide and Fillet Curves"
- bl_options = {'REGISTER', 'UNDO'}
-
- @classmethod
- def poll(cls, context):
- vertex = []
- nselected = []
- n = 0
- obj = context.active_object
- if obj is not None:
- if obj.type == 'CURVE':
- for i in obj.data.splines:
- for j in i.bezier_points:
- n += 1
- if j.select_control_point:
- nselected.append(n)
- vertex.append(obj.matrix_world * j.co)
-
- if len(vertex) > 0 and n > 2:
- return (context.active_object)
- if len(vertex) == 2 and abs(nselected[0] - nselected[1]) == 1:
- return (context.active_object)
-
- selected = 0
- for obj in context.selected_objects:
- if obj.type == 'CURVE':
- selected += 1
-
- if selected >= 2:
- return (context.selected_objects)
-
- def draw(self, context):
- vertex = []
- selected = []
- n = 0
- obj = context.active_object
- if obj is not None:
- if obj.type == 'CURVE':
- for i in obj.data.splines:
- for j in i.bezier_points:
- n += 1
- if j.select_control_point:
- selected.append(n)
- vertex.append(obj.matrix_world * j.co)
-
- if len(vertex) > 0 and n > 2:
- layout = self.layout
- row = layout.row()
- row.operator("curve.bezier_points_fillet", text="Fillet")
-
- if len(vertex) == 2 and abs(selected[0] - selected[1]) == 1:
- layout = self.layout
- row = layout.row()
- row.operator("curve.bezier_spline_divide", text="Divide")
-
-
-# ------------------------------------------------------------
-# location update
-
-def StartLocationUpdate(self, context):
-
- bpy.context.scene.cursor_location = self.Simple_startlocation
- return
-
-
-# ------------------------------------------------------------
-# Add properties to objects
-
-class SimpleVariables(PropertyGroup):
-
- Simple = BoolProperty()
- Simple_Change = BoolProperty()
-
- # general properties
- Types = [('Point', "Point", "Construct a Point"),
- ('Line', "Line", "Construct a Line"),
- ('Distance', "Distance", "Construct a two point Distance"),
- ('Angle', "Angle", "Construct an Angle"),
- ('Circle', "Circle", "Construct a Circle"),
- ('Ellipse', "Ellipse", "Construct an Ellipse"),
- ('Arc', "Arc", "Construct an Arc"),
- ('Sector', "Sector", "Construct a Sector"),
- ('Segment', "Segment", "Construct a Segment"),
- ('Rectangle', "Rectangle", "Construct a Rectangle"),
- ('Rhomb', "Rhomb", "Construct a Rhomb"),
- ('Polygon', "Polygon", "Construct a Polygon"),
- ('Polygon_ab', "Polygon ab", "Construct a Polygon ab"),
- ('Trapezoid', "Trapezoid", "Construct a Trapezoid")
- ]
- Simple_Type = EnumProperty(
- name="Type",
- description="Form of Curve to create",
- items=Types
- )
- # Line properties
- Simple_startlocation = FloatVectorProperty(
- name="Start location",
- description="Start location",
- default=(0.0, 0.0, 0.0),
- subtype='TRANSLATION',
- update=StartLocationUpdate
- )
- Simple_endlocation = FloatVectorProperty(
- name="End location",
- description="End location",
- default=(2.0, 2.0, 2.0),
- subtype='TRANSLATION'
- )
- Simple_rotation_euler = FloatVectorProperty(
- name="Rotation",
- description="Rotation",
- default=(0.0, 0.0, 0.0),
- subtype='EULER'
- )
- # Trapezoid properties
- Simple_a = FloatProperty(
- name="Side a",
- default=2.0,
- min=0.0, soft_min=0.0,
- unit='LENGTH',
- description="a side Value"
- )
- Simple_b = FloatProperty(
- name="Side b",
- default=1.0,
- min=0.0, soft_min=0.0,
- unit='LENGTH',
- description="b side Value"
- )
- Simple_h = FloatProperty(
- name="Height",
- default=1.0,
- unit='LENGTH',
- description="Height of the Trapezoid - distance between a and b"
- )
- Simple_angle = FloatProperty(
- name="Angle",
- default=45.0,
- description="Angle"
- )
- Simple_startangle = FloatProperty(
- name="Start angle",
- default=0.0,
- min=-360.0, soft_min=-360.0,
- max=360.0, soft_max=360.0,
- description="Start angle"
- )
- Simple_endangle = FloatProperty(
- name="End angle",
- default=45.0,
- min=-360.0, soft_min=-360.0,
- max=360.0, soft_max=360.0,
- description="End angle"
- )
- Simple_sides = IntProperty(
- name="Sides",
- default=3,
- min=3, soft_min=3,
- description="Number of Sides"
- )
- Simple_radius = FloatProperty(
- name="Radius",
- default=1.0,
- min=0.0, soft_min=0.0,
- unit='LENGTH',
- description="Radius"
- )
- Simple_center = BoolProperty(
- name="Length center",
- default=True,
- description="Length center"
- )
- # Rectangle properties
- Simple_width = FloatProperty(
- name="Width",
- default=2.0,
- min=0.0, soft_min=0.0,
- unit='LENGTH',
- description="Width"
- )
- Simple_length = FloatProperty(
- name="Length",
- default=2.0,
- min=0.0, soft_min=0.0,
- unit='LENGTH',
- description="Length"
- )
- Simple_rounded = FloatProperty(
- name="Rounded",
- default=0.0,
- unit='LENGTH',
- description="Rounded corners"
- )
-
-
-class VIEW3D_MT_simple_menu(Menu):
- bl_idname = "VIEW3D_MT_simple_menu"
- bl_label = "2D Objects"
-
- def draw(self, context):
- self.layout.operator_context = 'INVOKE_REGION_WIN'
-
- oper1 = self.layout.operator(Simple.bl_idname, text="Angle", icon="MOD_CURVE")
- oper1.Simple_Change = False
- oper1.Simple_Type = "Angle"
-
- oper2 = self.layout.operator(Simple.bl_idname, text="Arc", icon="MOD_CURVE")
- oper2.Simple_Change = False
- oper2.Simple_Type = "Arc"
-
- oper3 = self.layout.operator(Simple.bl_idname, text="Circle", icon="MOD_CURVE")
- oper3.Simple_Change = False
- oper3.Simple_Type = "Circle"
-
- oper4 = self.layout.operator(Simple.bl_idname, text="Distance", icon="MOD_CURVE")
- oper4.Simple_Change = False
- oper4.Simple_Type = "Distance"
-
- oper5 = self.layout.operator(Simple.bl_idname, text="Ellipse", icon="MOD_CURVE")
- oper5.Simple_Change = False
- oper5.Simple_Type = "Ellipse"
-
- oper6 = self.layout.operator(Simple.bl_idname, text="Line", icon="MOD_CURVE")
- oper6.Simple_Change = False
- oper6.Simple_Type = "Line"
-
- oper7 = self.layout.operator(Simple.bl_idname, text="Point", icon="MOD_CURVE")
- oper7.Simple_Change = False
- oper7.Simple_Type = "Point"
-
- oper8 = self.layout.operator(Simple.bl_idname, text="Polygon", icon="MOD_CURVE")
- oper8.Simple_Change = False
- oper8.Simple_Type = "Polygon"
-
- oper9 = self.layout.operator(Simple.bl_idname, text="Polygon ab", icon="MOD_CURVE")
- oper9.Simple_Change = False
- oper9.Simple_Type = "Polygon_ab"
-
- oper10 = self.layout.operator(Simple.bl_idname, text="Rectangle", icon="MOD_CURVE")
- oper10.Simple_Change = False
- oper10.Simple_Type = "Rectangle"
-
- oper11 = self.layout.operator(Simple.bl_idname, text="Rhomb", icon="MOD_CURVE")
- oper11.Simple_Change = False
- oper11.Simple_Type = "Rhomb"
-
- oper12 = self.layout.operator(Simple.bl_idname, text="Sector", icon="MOD_CURVE")
- oper12.Simple_Change = False
- oper12.Simple_Type = "Sector"
-
- oper13 = self.layout.operator(Simple.bl_idname, text="Segment", icon="MOD_CURVE")
- oper13.Simple_Change = False
- oper13.Simple_Type = "Segment"
-
- oper14 = self.layout.operator(Simple.bl_idname, text="Trapezoid", icon="MOD_CURVE")
- oper14.Simple_Change = False
- oper14.Simple_Type = "Trapezoid"
-
-
# Register
-
-def Simple_button(self, context):
- layout = self.layout
- layout.separator()
- self.layout.menu("VIEW3D_MT_simple_menu", icon="MOD_CURVE")
-
-class VIEW3D_MT_simple_edit_curve_menu(bpy.types.Menu):
- bl_label = 'Simple edit'
-
- def draw(self, context):
- self.layout.operator("curve.bezier_points_fillet", text="Fillet")
- self.layout.operator("curve.bezier_spline_divide", text="Divide")
-
-def Simple_curve_edit_menu(self, context):
- self.layout.menu('VIEW3D_MT_simple_edit_curve_menu')
- self.layout.separator()
+classes = [
+ Simple,
+ BezierDivide,
+ BezierPointsFillet
+]
def register():
- bpy.utils.register_class(Simple)
- bpy.utils.register_class(BezierPointsFillet)
- bpy.utils.register_class(BezierDivide)
- bpy.utils.register_class(SimplePanel)
- bpy.utils.register_class(SimpleEdit)
- bpy.utils.register_class(VIEW3D_MT_simple_menu)
- bpy.utils.register_class(SimpleVariables)
-
- bpy.types.VIEW3D_MT_curve_add.append(Simple_button)
- bpy.types.VIEW3D_MT_edit_curve_specials.prepend(Simple_curve_edit_menu)
-
- bpy.types.Object.s_curve = PointerProperty(type=SimpleVariables)
+ from bpy.utils import register_class
+ for cls in classes:
+ register_class(cls)
+ bpy.types.VIEW3D_MT_curve_add.append(menu)
+ bpy.types.VIEW3D_MT_edit_curve_specials.prepend(Simple_curve_edit_menu)
def unregister():
- bpy.utils.unregister_class(Simple)
- bpy.utils.unregister_class(BezierPointsFillet)
- bpy.utils.unregister_class(BezierDivide)
- bpy.utils.unregister_class(SimplePanel)
- bpy.utils.unregister_class(SimpleEdit)
- bpy.utils.unregister_class(VIEW3D_MT_simple_menu)
- bpy.utils.unregister_class(SimpleVariables)
-
- bpy.types.VIEW3D_MT_curve_add.remove(Simple_button)
- del bpy.types.Object.s_curve
+ from bpy.utils import unregister_class
+ for cls in reversed(classes):
+ unregister_class(cls)
+ bpy.types.VIEW3D_MT_curve_add.remove(menu)
+ bpy.types.VIEW3D_MT_edit_curve_specials.remove(Simple_curve_edit_menu)
if __name__ == "__main__":
register()
diff --git a/add_curve_extra_objects/add_curve_spirals.py b/add_curve_extra_objects/add_curve_spirals.py
index 9abfebd8..c8c11789 100644
--- a/add_curve_extra_objects/add_curve_spirals.py
+++ b/add_curve_extra_objects/add_curve_spirals.py
@@ -5,8 +5,8 @@ bl_info = {
"name": "Spirals",
"description": "Make spirals",
"author": "Alejandro Omar Chocano Vasquez",
- "version": (1, 2, 1),
- "blender": (2, 62, 0),
+ "version": (1, 2, 2),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Curve",
"warning": "",
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.4/Py/"
@@ -204,9 +204,9 @@ class CURVE_OT_spirals(Operator):
bl_idname = "curve.spirals"
bl_label = "Curve Spirals"
bl_description = "Create different types of spirals"
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- spiral_type = EnumProperty(
+ spiral_type : EnumProperty(
items=[('ARCH', "Archemedian", "Archemedian"),
("LOG", "Logarithmic", "Logarithmic"),
("SPHERE", "Spheric", "Spheric"),
@@ -215,14 +215,14 @@ class CURVE_OT_spirals(Operator):
name="Spiral Type",
description="Type of spiral to add"
)
- curve_type = EnumProperty(
+ curve_type : EnumProperty(
items=[('POLY', "Poly", "PolyLine"),
("NURBS", "NURBS", "NURBS")],
default='POLY',
name="Curve Type",
description="Type of spline to use"
)
- spiral_direction = EnumProperty(
+ spiral_direction : EnumProperty(
items=[('COUNTER_CLOCKWISE', "Counter Clockwise",
"Wind in a counter clockwise direction"),
("CLOCKWISE", "Clockwise",
@@ -231,62 +231,62 @@ class CURVE_OT_spirals(Operator):
name="Spiral Direction",
description="Direction of winding"
)
- turns = IntProperty(
+ turns : IntProperty(
default=1,
min=1, max=1000,
description="Length of Spiral in 360 deg"
)
- steps = IntProperty(
+ steps : IntProperty(
default=24,
min=2, max=1000,
description="Number of Vertices per turn"
)
- radius = FloatProperty(
+ radius : FloatProperty(
default=1.00,
min=0.00, max=100.00,
description="Radius for first turn"
)
- dif_z = FloatProperty(
+ dif_z : FloatProperty(
default=0,
min=-10.00, max=100.00,
description="Increase in Z axis per turn"
)
# needed for 1 and 2 spiral_type
# Archemedian variables
- dif_radius = FloatProperty(
+ dif_radius : FloatProperty(
default=0.00,
min=-50.00, max=50.00,
description="Radius increment in each turn"
)
# step between turns(one turn equals 360 deg)
# Log variables
- B_force = FloatProperty(
+ B_force : FloatProperty(
default=1.00,
min=0.00, max=30.00,
description="Factor of exponent"
)
# Torus variables
- inner_radius = FloatProperty(
+ inner_radius : FloatProperty(
default=0.20,
min=0.00, max=100,
description="Inner Radius of Torus"
)
- dif_inner_radius = FloatProperty(
+ dif_inner_radius : FloatProperty(
default=0,
min=-10, max=100,
description="Increase of inner Radius per Cycle"
)
- dif_radius = FloatProperty(
+ dif_radius : FloatProperty(
default=0,
min=-10, max=100,
description="Increase of Torus Radius per Cycle"
)
- cycles = FloatProperty(
+ cycles : FloatProperty(
default=1,
min=0.00, max=1000,
description="Number of Cycles"
)
- curves_number = IntProperty(
+ curves_number : IntProperty(
default=1,
min=1, max=400,
description="Number of curves of spiral"
@@ -300,13 +300,13 @@ class CURVE_OT_spirals(Operator):
layout = self.layout
col = layout.column_flow(align=True)
- col.label("Presets:")
+ col.label(text="Presets:")
row = col.row(align=True)
row.menu("OBJECT_MT_spiral_curve_presets",
text=bpy.types.OBJECT_MT_spiral_curve_presets.bl_label)
- row.operator("curve_extras.spiral_presets", text="", icon='ZOOMIN')
- op = row.operator("curve_extras.spiral_presets", text="", icon='ZOOMOUT')
+ row.operator("curve_extras.spiral_presets", text="")
+ op = row.operator("curve_extras.spiral_presets", text="")
op.remove_active = True
layout.prop(self, "spiral_type")
@@ -320,25 +320,25 @@ class CURVE_OT_spirals(Operator):
box = layout.box()
if self.spiral_type == 'ARCH':
- box.label("Archemedian Settings:")
+ box.label(text="Archemedian Settings:")
col = box.column(align=True)
col.prop(self, "dif_radius", text="Radius Growth")
col.prop(self, "radius", text="Radius")
col.prop(self, "dif_z", text="Height")
if self.spiral_type == 'LOG':
- box.label("Logarithmic Settings:")
+ box.label(text="Logarithmic Settings:")
col = box.column(align=True)
col.prop(self, "radius", text="Radius")
col.prop(self, "B_force", text="Expansion Force")
col.prop(self, "dif_z", text="Height")
if self.spiral_type == 'SPHERE':
- box.label("Spheric Settings:")
+ box.label(text="Spheric Settings:")
box.prop(self, "radius", text="Radius")
if self.spiral_type == 'TORUS':
- box.label("Torus Settings:")
+ box.label(text="Torus Settings:")
col = box.column(align=True)
col.prop(self, "cycles", text="Number of Cycles")
@@ -412,13 +412,22 @@ class OBJECT_MT_spiral_curve_presets(Menu):
draw = bpy.types.Menu.draw_preset
-def register():
- bpy.utils.register_module(__name__)
+# Register
+classes = [
+ CURVE_OT_spirals,
+ CURVE_EXTRAS_OT_spirals_presets,
+ OBJECT_MT_spiral_curve_presets
+]
+def register():
+ from bpy.utils import register_class
+ for cls in classes:
+ register_class(cls)
def unregister():
- bpy.utils.unregister_module(__name__)
-
+ from bpy.utils import unregister_class
+ for cls in reversed(classes):
+ unregister_class(cls)
if __name__ == "__main__":
register()
diff --git a/add_curve_extra_objects/add_curve_spirofit_bouncespline.py b/add_curve_extra_objects/add_curve_spirofit_bouncespline.py
index e80c6ee1..f2dd0fb5 100644
--- a/add_curve_extra_objects/add_curve_spirofit_bouncespline.py
+++ b/add_curve_extra_objects/add_curve_spirofit_bouncespline.py
@@ -20,8 +20,8 @@
bl_info = {
"name": "SpiroFit, BounceSpline and Catenary",
"author": "Antonio Osprite, Liero, Atom, Jimmy Hazevoet",
- "version": (0, 2, 1),
- "blender": (2, 78, 0),
+ "version": (0, 2, 2),
+ "blender": (2, 80, 0),
"location": "Toolshelf > Create Tab",
"description": "SpiroFit, BounceSpline and Catenary adds "
"splines to selected mesh or objects",
@@ -123,19 +123,19 @@ class SpiroFitSpline(Operator):
bl_description = "Wrap selected mesh in a spiral"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- map_method = EnumProperty(
+ map_method : EnumProperty(
name="Mapping",
default='RAYCAST',
description="Mapping method",
items=[('RAYCAST', 'Ray cast', 'Ray casting'),
('CLOSESTPOINT', 'Closest point', 'Closest point on mesh')]
)
- direction = BoolProperty(
+ direction : BoolProperty(
name="Direction",
description="Spire direction",
default=False
)
- spire_resolution = IntProperty(
+ spire_resolution : IntProperty(
name="Spire Resolution",
default=8,
min=3,
@@ -143,7 +143,7 @@ class SpiroFitSpline(Operator):
soft_max=128,
description="Number of steps for one turn"
)
- spires = IntProperty(
+ spires : IntProperty(
name="Spires",
default=4,
min=1,
@@ -151,72 +151,72 @@ class SpiroFitSpline(Operator):
soft_max=128,
description="Number of turns"
)
- offset = FloatProperty(
+ offset : FloatProperty(
name="Offset",
default=0.0,
precision=3,
description="Use normal direction to offset spline"
)
- waves = IntProperty(
+ waves : IntProperty(
name="Wave",
default=0,
min=0,
description="Wave amount"
)
- wave_iscale = FloatProperty(
+ wave_iscale : FloatProperty(
name="Wave Intensity",
default=0.0,
min=0.0,
precision=3,
description="Wave intensity scale"
)
- rndm_spire = FloatProperty(
+ rndm_spire : FloatProperty(
name="Randomise",
default=0.0,
min=0.0,
precision=3,
description="Randomise spire"
)
- spline_name = StringProperty(
+ spline_name : StringProperty(
name="Name",
default="SpiroFit"
)
- spline_type = EnumProperty(
+ spline_type : EnumProperty(
name="Spline",
default='BEZIER',
description="Spline type",
items=[('POLY', 'Poly', 'Poly spline'),
('BEZIER', 'Bezier', 'Bezier spline')]
)
- resolution_u = IntProperty(
+ resolution_u : IntProperty(
name="Resolution U",
default=12,
min=0,
max=64,
description="Curve resolution u"
)
- bevel = FloatProperty(
+ bevel : FloatProperty(
name="Bevel Radius",
default=0.0,
min=0.0,
precision=3,
description="Bevel depth"
)
- bevel_res = IntProperty(
+ bevel_res : IntProperty(
name="Bevel Resolution",
default=0,
min=0,
max=32,
description="Bevel resolution"
)
- extrude = FloatProperty(
+ extrude : FloatProperty(
name="Extrude",
default=0.0,
min=0.0,
precision=3,
description="Extrude amount"
)
- twist_mode = EnumProperty(
+ twist_mode : EnumProperty(
name="Twisting",
default='MINIMUM',
description="Twist method, type of tilt calculation",
@@ -224,48 +224,48 @@ class SpiroFitSpline(Operator):
('MINIMUM', "Minimum", 'Minimum'),
('TANGENT', "Tangent", 'Tangent')]
)
- twist_smooth = FloatProperty(
+ twist_smooth : FloatProperty(
name="Smooth",
default=0.0,
min=0.0,
precision=3,
description="Twist smoothing amount for tangents"
)
- tilt = FloatProperty(
+ tilt : FloatProperty(
name="Tilt",
default=0.0,
precision=3,
description="Spline handle tilt"
)
- random_radius = FloatProperty(
+ random_radius : FloatProperty(
name="Randomise",
default=0.0,
min=0.0,
precision=3,
description="Randomise radius of spline controlpoints"
)
- x_ray = BoolProperty(
+ x_ray : BoolProperty(
name="X-Ray",
default=False,
description="X-Ray - make the object draw in front of others"
)
- random_seed = IntProperty(
+ random_seed : IntProperty(
name="Random Seed",
default=1,
min=0,
description="Random seed number"
)
- origin_to_start = BoolProperty(
+ origin_to_start : BoolProperty(
name="Origin at Start",
description="Set origin at first point of spline",
default=False
)
- refresh = BoolProperty(
+ refresh : BoolProperty(
name="Refresh",
description="Refresh spline",
default=False
)
- auto_refresh = BoolProperty(
+ auto_refresh : BoolProperty(
name="Auto",
description="Auto refresh spline",
default=True
@@ -323,10 +323,10 @@ class SpiroFitSpline(Operator):
"Active Object is not a Mesh. Operation Cancelled")
return {'CANCELLED'}
- undo = context.user_preferences.edit.use_global_undo
- context.user_preferences.edit.use_global_undo = False
+ #undo = context.user_preferences.edit.use_global_undo
+ #context.user_preferences.edit.use_global_undo = False
- bpy.ops.object.select_all(action='DESELECT')
+ #bpy.ops.object.select_all(action='DESELECT')
r.seed(self.random_seed)
@@ -364,7 +364,7 @@ class SpiroFitSpline(Operator):
if self.auto_refresh is False:
self.refresh = False
- context.user_preferences.edit.use_global_undo = undo
+ #context.user_preferences.edit.use_global_undo = undo
return {'FINISHED'}
@@ -426,7 +426,7 @@ class BounceSpline(Operator):
bl_description = "Fill selected mesh with a spline"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- bounce_number = IntProperty(
+ bounce_number : IntProperty(
name="Bounces",
default=1000,
min=1,
@@ -434,71 +434,71 @@ class BounceSpline(Operator):
soft_max=10000,
description="Number of bounces"
)
- ang_noise = FloatProperty(
+ ang_noise : FloatProperty(
name="Angular Noise",
default=0.25,
min=0.0,
precision=3,
description="Add some noise to ray direction"
)
- offset = FloatProperty(
+ offset : FloatProperty(
name="Offset",
default=0.0,
precision=3,
description="Use normal direction to offset spline"
)
- extra = IntProperty(
+ extra : IntProperty(
name="Extra",
default=50,
min=0,
max=1000,
description="Number of extra tries if it fails to hit mesh"
)
- active_face = BoolProperty(
+ active_face : BoolProperty(
name="Active Face",
default=False,
description="Starts from active face or a random one"
)
- spline_name = StringProperty(
+ spline_name : StringProperty(
name="Name",
default="BounceSpline"
)
- spline_type = EnumProperty(
+ spline_type : EnumProperty(
name="Spline",
default='BEZIER',
description="Spline type",
items=[('POLY', "Poly", "Poly spline"),
('BEZIER', "Bezier", "Bezier spline")]
)
- resolution_u = IntProperty(
+ resolution_u : IntProperty(
name="Resolution U",
default=12,
min=0,
max=64,
description="Curve resolution u"
)
- bevel = FloatProperty(
+ bevel : FloatProperty(
name="Bevel Radius",
default=0.0,
min=0.0,
precision=3,
description="Bevel depth"
)
- bevel_res = IntProperty(
+ bevel_res : IntProperty(
name="Bevel Resolution",
default=0,
min=0,
max=32,
description="Bevel resolution"
)
- extrude = FloatProperty(
+ extrude : FloatProperty(
name="Extrude",
default=0.0,
min=0.0,
precision=3,
description="Extrude amount"
)
- twist_mode = EnumProperty(
+ twist_mode : EnumProperty(
name="Twisting",
default='MINIMUM',
description="Twist method, type of tilt calculation",
@@ -506,48 +506,48 @@ class BounceSpline(Operator):
('MINIMUM', "Minimum", 'Minimum'),
('TANGENT', "Tangent", 'Tangent')]
)
- twist_smooth = FloatProperty(
+ twist_smooth : FloatProperty(
name="Smooth",
default=0.0,
min=0.0,
precision=3,
description="Twist smoothing amount for tangents"
)
- tilt = FloatProperty(
+ tilt : FloatProperty(
name="Tilt",
default=0.0,
precision=3,
description="Spline handle tilt"
)
- random_radius = FloatProperty(
+ random_radius : FloatProperty(
name="Randomise",
default=0.0,
min=0.0,
precision=3,
description="Randomise radius of spline controlpoints"
)
- x_ray = BoolProperty(
+ x_ray : BoolProperty(
name="X-Ray",
default=False,
description="X-Ray - make the object draw in front of others"
)
- random_seed = IntProperty(
+ random_seed : IntProperty(
name="Random Seed",
default=1,
min=0,
description="Random seed number"
)
- origin_to_start = BoolProperty(
+ origin_to_start : BoolProperty(
name="Origin at Start",
description="Set origin at first point of spline",
default=False
)
- refresh = BoolProperty(
+ refresh : BoolProperty(
name="Refresh",
description="Refresh spline",
default=False
)
- auto_refresh = BoolProperty(
+ auto_refresh : BoolProperty(
name="Auto",
description="Auto refresh spline",
default=True
@@ -572,7 +572,7 @@ class BounceSpline(Operator):
col.prop(self, "spline_name")
col.separator()
col.prop(self, "bounce_number")
- row = col.row(align=True).split(0.9, align=True)
+ row = col.row(align=True).split(factor=0.9, align=True)
row.prop(self, "ang_noise")
row.prop(self, "active_face", toggle=True, text="", icon="SNAP_FACE")
col.prop(self, "offset")
@@ -598,10 +598,10 @@ class BounceSpline(Operator):
if obj.type != 'MESH':
return {'CANCELLED'}
- undo = context.user_preferences.edit.use_global_undo
- context.user_preferences.edit.use_global_undo = False
+ #undo = context.user_preferences.edit.use_global_undo
+ #context.user_preferences.edit.use_global_undo = False
- bpy.ops.object.select_all(action='DESELECT')
+ #bpy.ops.object.select_all(action='DESELECT')
r.seed(self.random_seed)
@@ -636,7 +636,7 @@ class BounceSpline(Operator):
if self.auto_refresh is False:
self.refresh = False
- context.user_preferences.edit.use_global_undo = undo
+ #context.user_preferences.edit.use_global_undo = undo
return {'FINISHED'}
@@ -675,14 +675,14 @@ class CatenaryCurve(Operator):
bl_description = "Hang a curve between two selected objects"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- steps = IntProperty(
+ steps : IntProperty(
name="Steps",
description="Resolution of the curve",
default=24,
min=2,
max=1024,
)
- var_a = FloatProperty(
+ var_a : FloatProperty(
name="a",
description="Catenary variable a",
precision=3,
@@ -690,46 +690,46 @@ class CatenaryCurve(Operator):
min=0.01,
max=100.0
)
- spline_name = StringProperty(
+ spline_name : StringProperty(
name="Name",
default="Catenary"
)
- spline_type = EnumProperty(
+ spline_type : EnumProperty(
name="Spline",
default='BEZIER',
description="Spline type",
items=[('POLY', "Poly", "Poly spline"),
('BEZIER', "Bezier", "Bezier spline")]
)
- resolution_u = IntProperty(
+ resolution_u : IntProperty(
name="Resolution U",
default=12,
min=0,
max=64,
description="Curve resolution u"
)
- bevel = FloatProperty(
+ bevel : FloatProperty(
name="Bevel Radius",
default=0.0,
min=0.0,
precision=3,
description="Bevel depth"
)
- bevel_res = IntProperty(
+ bevel_res : IntProperty(
name="Bevel Resolution",
default=0,
min=0,
max=32,
description="Bevel resolution"
)
- extrude = FloatProperty(
+ extrude : FloatProperty(
name="Extrude",
default=0.0,
min=0.0,
precision=3,
description="Extrude amount"
)
- twist_mode = EnumProperty(
+ twist_mode : EnumProperty(
name="Twisting",
default='MINIMUM',
description="Twist method, type of tilt calculation",
@@ -737,48 +737,48 @@ class CatenaryCurve(Operator):
('MINIMUM', "Minimum", "Minimum"),
('TANGENT', "Tangent", "Tangent")]
)
- twist_smooth = FloatProperty(
+ twist_smooth : FloatProperty(
name="Smooth",
default=0.0,
min=0.0,
precision=3,
description="Twist smoothing amount for tangents"
)
- tilt = FloatProperty(
+ tilt : FloatProperty(
name="Tilt",
default=0.0,
precision=3,
description="Spline handle tilt"
)
- random_radius = FloatProperty(
+ random_radius : FloatProperty(
name="Randomise",
default=0.0,
min=0.0,
precision=3,
description="Randomise radius of spline controlpoints"
)
- x_ray = BoolProperty(
+ x_ray : BoolProperty(
name="X-Ray",
default=False,
description="X-Ray - make the object draw in front of others"
)
- random_seed = IntProperty(
+ random_seed : IntProperty(
name="Random Seed",
default=1,
min=0,
description="Random seed number"
)
- origin_to_start = BoolProperty(
+ origin_to_start : BoolProperty(
name="Origin at Start",
description="Set origin at first point of spline",
default=False
)
- refresh = BoolProperty(
+ refresh : BoolProperty(
name="Refresh",
description="Refresh spline",
default=False
)
- auto_refresh = BoolProperty(
+ auto_refresh : BoolProperty(
name="Auto",
description="Auto refresh spline",
default=True
@@ -839,10 +839,10 @@ class CatenaryCurve(Operator):
"Catenary could not be completed. Operation Cancelled")
return {'CANCELLED'}
- bpy.ops.object.select_all(action='DESELECT')
+ #bpy.ops.object.select_all(action='DESELECT')
- undo = context.user_preferences.edit.use_global_undo
- context.user_preferences.edit.use_global_undo = False
+ #undo = context.user_preferences.edit.use_global_undo
+ #context.user_preferences.edit.use_global_undo = False
r.seed(self.random_seed)
@@ -876,7 +876,7 @@ class CatenaryCurve(Operator):
if self.auto_refresh is False:
self.refresh = False
- context.user_preferences.edit.use_global_undo = undo
+ #context.user_preferences.edit.use_global_undo = undo
return {'FINISHED'}
@@ -920,7 +920,7 @@ def add_curve_object(
for i in range(len(verts)):
spline.points[i].co = verts[i][0], verts[i][1], verts[i][2], 1
- bpy.context.scene.objects.link(cur)
+ bpy.context.scene.collection.objects.link(cur)
cur.data.use_uv_as_generated = True
cur.data.resolution_u = resolution_u
cur.data.fill_mode = 'FULL'
@@ -930,10 +930,10 @@ def add_curve_object(
cur.data.twist_mode = twist_mode
cur.data.twist_smooth = twist_smooth
cur.matrix_world = matrix
- bpy.context.scene.objects.active = cur
- cur.select = True
+ #bpy.context.scene.objects.active = cur
+ cur.select_set(True)
if x_ray is True:
- cur.show_in_front = x_ray
+ cur.show_x_ray = x_ray
return
@@ -984,7 +984,7 @@ class SplinePanel(Panel):
bl_context = "objectmode"
bl_region_type = "TOOLS"
bl_label = "Spline"
- bl_category = "Create"
+ #bl_category = "Create"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
diff --git a/add_curve_extra_objects/add_curve_torus_knots.py b/add_curve_extra_objects/add_curve_torus_knots.py
index 4401112d..d138508e 100644
--- a/add_curve_extra_objects/add_curve_torus_knots.py
+++ b/add_curve_extra_objects/add_curve_torus_knots.py
@@ -20,8 +20,8 @@
bl_info = {
"name": "Torus Knots",
"author": "Marius Giurgi (DolphinDream), testscreenings",
- "version": (0, 2),
- "blender": (2, 76, 0),
+ "version": (0, 3),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Curve",
"description": "Adds many types of (torus) knots",
"warning": "",
@@ -160,22 +160,22 @@ def align_matrix(self, context):
else:
rot = Matrix()
- align_matrix = userLoc * loc * rot * userRot
+ align_matrix = userLoc @ loc @ rot @ userRot
return align_matrix
# ------------------------------------------------------------------------------
# Set curve BEZIER handles to auto
-def setBezierHandles(obj, mode='AUTOMATIC'):
+def setBezierHandles(obj, mode='AUTO'):
scene = bpy.context.scene
if obj.type != 'CURVE':
return
- scene.objects.active = obj
- bpy.ops.object.mode_set(mode='EDIT', toggle=True)
- bpy.ops.curve.select_all(action='SELECT')
- bpy.ops.curve.handle_type_set(type=mode)
- bpy.ops.object.mode_set(mode='OBJECT', toggle=True)
+ #scene.objects.active = obj
+ #bpy.ops.object.mode_set(mode='EDIT', toggle=True)
+ #bpy.ops.curve.select_all(action='SELECT')
+ #bpy.ops.curve.handle_type_set(type=mode)
+ #bpy.ops.object.mode_set(mode='OBJECT', toggle=True)
# ------------------------------------------------------------------------------
@@ -237,6 +237,9 @@ def create_torus_knot(self, context):
if splineType == 'BEZIER':
spline.bezier_points.add(int(len(vertArray) * 1.0 / 3 - 1))
spline.bezier_points.foreach_set('co', vertArray)
+ for point in spline.bezier_points:
+ point.handle_right_type = self.handleType
+ point.handle_left_type = self.handleType
else:
spline.points.add(int(len(vertArray) * 1.0 / 4 - 1))
spline.points.foreach_set('co', vertArray)
@@ -265,14 +268,14 @@ def create_torus_knot(self, context):
# set object in the scene
scene = bpy.context.scene
- scene.objects.link(new_obj) # place in active scene
- new_obj.select = True # set as selected
- scene.objects.active = new_obj # set as active
+ scene.collection.objects.link(new_obj) # place in active scene
+ new_obj.select_set(True) # set as selected
+ #scene.objects.active = new_obj # set as active
new_obj.matrix_world = self.align_matrix # apply matrix
# set BEZIER handles
- if splineType == 'BEZIER':
- setBezierHandles(new_obj, self.handleType)
+ #if splineType == 'BEZIER':
+ # setBezierHandles(new_obj, self.handleType)
return
@@ -355,123 +358,123 @@ class torus_knot_plus(Operator, AddObjectHelper):
align_matrix = None
# GENERAL options
- options_plus = BoolProperty(
+ options_plus : BoolProperty(
name="Extra Options",
default=False,
description="Show more options (the plus part)",
)
- absolute_location = BoolProperty(
+ absolute_location : BoolProperty(
name="Absolute Location",
default=False,
description="Set absolute location instead of relative to 3D cursor",
)
# COLOR options
- use_colors = BoolProperty(
+ use_colors : BoolProperty(
name="Use Colors",
default=False,
description="Show torus links in colors",
)
- colorSet = EnumProperty(
+ colorSet : EnumProperty(
name="Color Set",
items=(('1', "RGBish", "RGBsish ordered colors"),
('2', "Rainbow", "Rainbow ordered colors")),
)
- random_colors = BoolProperty(
+ random_colors : BoolProperty(
name="Randomize Colors",
default=False,
description="Randomize link colors",
)
- saturation = FloatProperty(
+ saturation : FloatProperty(
name="Saturation",
default=0.75,
min=0.0, max=1.0,
description="Color saturation",
)
# SURFACE Options
- geo_surface = BoolProperty(
+ geo_surface : BoolProperty(
name="Surface",
default=True,
description="Create surface",
)
- geo_bDepth = FloatProperty(
+ geo_bDepth : FloatProperty(
name="Bevel Depth",
default=0.04,
min=0, soft_min=0,
description="Bevel Depth",
)
- geo_bRes = IntProperty(
+ geo_bRes : IntProperty(
name="Bevel Resolution",
default=2,
min=0, soft_min=0,
max=5, soft_max=5,
description="Bevel Resolution"
)
- geo_extrude = FloatProperty(
+ geo_extrude : FloatProperty(
name="Extrude",
default=0.0,
min=0, soft_min=0,
description="Amount of curve extrusion"
)
- geo_offset = FloatProperty(
+ geo_offset : FloatProperty(
name="Offset",
default=0.0,
min=0, soft_min=0,
description="Offset the surface relative to the curve"
)
# TORUS KNOT Options
- torus_p = IntProperty(
+ torus_p : IntProperty(
name="p",
default=2,
min=1, soft_min=1,
description="Number of Revolutions around the torus hole before closing the knot"
)
- torus_q = IntProperty(
+ torus_q : IntProperty(
name="q",
default=3,
min=1, soft_min=1,
description="Number of Spins through the torus hole before closing the knot"
)
- flip_p = BoolProperty(
+ flip_p : BoolProperty(
name="Flip p",
default=False,
description="Flip Revolution direction"
)
- flip_q = BoolProperty(
+ flip_q : BoolProperty(
name="Flip q",
default=False,
description="Flip Spin direction"
)
- multiple_links = BoolProperty(
+ multiple_links : BoolProperty(
name="Multiple Links",
default=True,
description="Generate all links or just one link when q and q are not co-primes"
)
- torus_u = IntProperty(
+ torus_u : IntProperty(
name="Rev. Multiplier",
default=1,
min=1, soft_min=1,
description="Revolutions Multiplier"
)
- torus_v = IntProperty(
+ torus_v : IntProperty(
name="Spin Multiplier",
default=1,
min=1, soft_min=1,
description="Spin multiplier"
)
- torus_rP = FloatProperty(
+ torus_rP : FloatProperty(
name="Revolution Phase",
default=0.0,
min=0.0, soft_min=0.0,
description="Phase revolutions by this radian amount"
)
- torus_sP = FloatProperty(
+ torus_sP : FloatProperty(
name="Spin Phase",
default=0.0,
min=0.0, soft_min=0.0,
description="Phase spins by this radian amount"
)
# TORUS DIMENSIONS options
- mode = EnumProperty(
+ mode : EnumProperty(
name="Torus Dimensions",
items=(("MAJOR_MINOR", "Major/Minor",
"Use the Major/Minor radii for torus dimensions."),
@@ -479,7 +482,7 @@ class torus_knot_plus(Operator, AddObjectHelper):
"Use the Exterior/Interior radii for torus dimensions.")),
update=mode_update_callback,
)
- torus_R = FloatProperty(
+ torus_R : FloatProperty(
name="Major Radius",
min=0.00, max=100.0,
default=1.0,
@@ -487,7 +490,7 @@ class torus_knot_plus(Operator, AddObjectHelper):
unit='LENGTH',
description="Radius from the torus origin to the center of the cross section"
)
- torus_r = FloatProperty(
+ torus_r : FloatProperty(
name="Minor Radius",
min=0.00, max=100.0,
default=.25,
@@ -495,7 +498,7 @@ class torus_knot_plus(Operator, AddObjectHelper):
unit='LENGTH',
description="Radius of the torus' cross section"
)
- torus_iR = FloatProperty(
+ torus_iR : FloatProperty(
name="Interior Radius",
min=0.00, max=100.0,
default=.75,
@@ -503,7 +506,7 @@ class torus_knot_plus(Operator, AddObjectHelper):
unit='LENGTH',
description="Interior radius of the torus (closest to the torus center)"
)
- torus_eR = FloatProperty(
+ torus_eR : FloatProperty(
name="Exterior Radius",
min=0.00, max=100.0,
default=1.25,
@@ -511,26 +514,26 @@ class torus_knot_plus(Operator, AddObjectHelper):
unit='LENGTH',
description="Exterior radius of the torus (farthest from the torus center)"
)
- torus_s = FloatProperty(
+ torus_s : FloatProperty(
name="Scale",
min=0.01, max=100.0,
default=1.00,
description="Scale factor to multiply the radii"
)
- torus_h = FloatProperty(
+ torus_h : FloatProperty(
name="Height",
default=1.0,
min=0.0, max=100.0,
description="Scale along the local Z axis"
)
# CURVE options
- torus_res = IntProperty(
+ torus_res : IntProperty(
name="Curve Resolution",
default=100,
min=3, soft_min=3,
description="Number of control vertices in the curve"
)
- segment_res = IntProperty(
+ segment_res : IntProperty(
name="Segment Resolution",
default=12,
min=1, soft_min=1,
@@ -540,7 +543,7 @@ class torus_knot_plus(Operator, AddObjectHelper):
('POLY', "Poly", "Poly type"),
('NURBS', "Nurbs", "Nurbs type"),
('BEZIER', "Bezier", "Bezier type")]
- outputType = EnumProperty(
+ outputType : EnumProperty(
name="Output splines",
default='BEZIER',
description="Type of splines to output",
@@ -548,15 +551,15 @@ class torus_knot_plus(Operator, AddObjectHelper):
)
bezierHandles = [
('VECTOR', "Vector", "Bezier Handles type - Vector"),
- ('AUTOMATIC', "Auto", "Bezier Handles type - Automatic"),
+ ('AUTO', "Auto", "Bezier Handles type - Automatic"),
]
- handleType = EnumProperty(
+ handleType : EnumProperty(
name="Handle type",
- default='AUTOMATIC',
+ default='AUTO',
items=bezierHandles,
description="Bezier handle type",
)
- adaptive_resolution = BoolProperty(
+ adaptive_resolution : BoolProperty(
name="Adaptive Resolution",
default=False,
description="Auto adjust curve resolution based on TK length",
@@ -573,12 +576,12 @@ class torus_knot_plus(Operator, AddObjectHelper):
col.label(text="Torus Knot Parameters:")
box = layout.box()
- split = box.split(percentage=0.85, align=True)
+ split = box.split(factor=0.85, align=True)
split.prop(self, "torus_p", text="Revolutions")
split.prop(self, "flip_p", toggle=True, text="",
icon='ARROW_LEFTRIGHT')
- split = box.split(percentage=0.85, align=True)
+ split = box.split(factor=0.85, align=True)
split.prop(self, "torus_q", text="Spins")
split.prop(self, "flip_q", toggle=True, text="",
icon='ARROW_LEFTRIGHT')
@@ -709,14 +712,14 @@ class torus_knot_plus(Operator, AddObjectHelper):
self.align_matrix = align_matrix(self, context)
# turn off undo
- undo = bpy.context.user_preferences.edit.use_global_undo
- bpy.context.user_preferences.edit.use_global_undo = False
+ #undo = bpy.context.user_preferences.edit.use_global_undo
+ #bpy.context.user_preferences.edit.use_global_undo = False
# create the curve
create_torus_knot(self, context)
# restore pre operator undo state
- bpy.context.user_preferences.edit.use_global_undo = undo
+ #bpy.context.user_preferences.edit.use_global_undo = undo
return {'FINISHED'}
@@ -724,3 +727,21 @@ class torus_knot_plus(Operator, AddObjectHelper):
self.execute(context)
return {'FINISHED'}
+
+# Register
+classes = [
+ torus_knot_plus
+]
+
+def register():
+ from bpy.utils import register_class
+ for cls in classes:
+ register_class(cls)
+
+def unregister():
+ from bpy.utils import unregister_class
+ for cls in reversed(classes):
+ unregister_class(cls)
+
+if __name__ == "__main__":
+ register() \ No newline at end of file
diff --git a/add_curve_extra_objects/add_surface_plane_cone.py b/add_curve_extra_objects/add_surface_plane_cone.py
index ad5e1eb9..4f34f654 100644
--- a/add_curve_extra_objects/add_surface_plane_cone.py
+++ b/add_curve_extra_objects/add_surface_plane_cone.py
@@ -4,8 +4,8 @@ bl_info = {
"name": "Surface: Plane / Cone/ Star / Wedge",
"description": "Create a NURBS surface plane",
"author": "Folkert de Vries",
- "version": (1, 0, 1),
- "blender": (2, 5, 9),
+ "version": (1, 0, 2),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Surface",
"warning": "",
"wiki_url": "",
@@ -31,7 +31,7 @@ from bpy.types import Operator
# generic class for inheritance
class MakeSurfaceHelpers:
# get input for size and resolution
- size = FloatProperty(
+ size : FloatProperty(
name="Size",
description="Size of the object",
default=1.0,
@@ -39,14 +39,14 @@ class MakeSurfaceHelpers:
max=100.0,
unit="LENGTH",
)
- res_u = IntProperty(
+ res_u : IntProperty(
name="Resolution U",
description="Surface resolution in u direction",
default=1,
min=1,
max=500,
)
- res_v = IntProperty(
+ res_v : IntProperty(
name="Resolution V",
description="Surface resolution in v direction",
default=1,
@@ -71,7 +71,7 @@ class MakeSurfaceWedge(Operator, MakeSurfaceHelpers):
bl_idname = "object.add_surface_wedge"
bl_label = "Add Surface Wedge"
bl_description = "Construct a Surface Wedge"
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
def execute(self, context):
# variables
@@ -137,7 +137,7 @@ class MakeSurfaceCone(Operator, MakeSurfaceHelpers):
bl_idname = "object.add_surface_cone"
bl_label = "Add Surface Cone"
bl_description = "Construct a Surface Cone"
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
def execute(self, context):
size = self.size
@@ -283,7 +283,7 @@ class MakeSurfacePlane(Operator, MakeSurfaceHelpers):
bl_idname = "object.add_surface_plane"
bl_label = "Add Surface Plane"
bl_description = "Construct a Surface Plane"
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
def execute(self, context):
size = self.size
@@ -347,15 +347,15 @@ class MakeSurfacePlane(Operator, MakeSurfaceHelpers):
class SmoothXtimes(Operator):
bl_idname = "curve.smooth_x_times"
bl_label = "Smooth X Times"
- bl_space_type = "VIEW_3D"
- bl_options = {'REGISTER', 'UNDO'}
+ #bl_space_type = "VIEW_3D"
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
# use of this class:
# lets you smooth till a thousand times. this is normally difficult, because
# you have to press w, click, press w, click etc.
# get values
- times = IntProperty(
+ times : IntProperty(
name="Smooth x Times",
min=1,
max=1000,
@@ -375,24 +375,25 @@ class SmoothXtimes(Operator):
return{'FINISHED'}
+# Register
+classes = [
+ #MakeSurfaceHelpers,
+ MakeSurfacePlane,
+ MakeSurfaceCone,
+ MakeSurfaceStar,
+ MakeSurfaceWedge,
+ SmoothXtimes
+]
def register():
- bpy.utils.register_class(MakeSurfaceHelpers)
- bpy.utils.register_class(MakeSurfacePlane)
- bpy.utils.register_class(MakeSurfaceCone)
- bpy.utils.register_class(MakeSurfaceStar)
- bpy.utils.register_class(MakeSurfaceWedge)
- bpy.utils.register_class(SmoothXtimes)
-
+ from bpy.utils import register_class
+ for cls in classes:
+ register_class(cls)
def unregister():
- bpy.utils.unregister_class(MakeSurfaceHelpers)
- bpy.utils.unregister_class(MakeSurfacePlane)
- bpy.utils.unregister_class(MakeSurfaceCone)
- bpy.utils.unregister_class(MakeSurfaceStar)
- bpy.utils.unregister_class(MakeSurfaceWedge)
- bpy.utils.unregister_class(SmoothXtimes)
-
+ from bpy.utils import unregister_class
+ for cls in reversed(classes):
+ unregister_class(cls)
if __name__ == "__main__":
register()
diff --git a/add_curve_extra_objects/beveltaper_curve.py b/add_curve_extra_objects/beveltaper_curve.py
index f91eb8b3..016a0bc4 100644
--- a/add_curve_extra_objects/beveltaper_curve.py
+++ b/add_curve_extra_objects/beveltaper_curve.py
@@ -20,8 +20,8 @@
bl_info = {
"name": "Bevel/Taper Curve",
"author": "Cmomoney",
- "version": (1, 1),
- "blender": (2, 69, 0),
+ "version": (1, 2),
+ "blender": (2, 80, 0),
"location": "View3D > Object > Bevel/Taper",
"description": "Adds bevel and/or taper curve to active curve",
"warning": "",
@@ -238,38 +238,38 @@ class add_tapercurve(Operator):
bl_label = "Add Curve as Taper"
bl_description = ("Add taper curve to Active Curve\n"
"Needs an existing Active Curve")
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- scale_ends1 = FloatProperty(
+ scale_ends1 : FloatProperty(
name="End Width Left",
description="Adjust left end taper",
default=0.0,
min=0.0
)
- scale_ends2 = FloatProperty(
+ scale_ends2 : FloatProperty(
name="End Width Right",
description="Adjust right end taper",
default=0.0,
min=0.0
)
- scale_mid = FloatProperty(
+ scale_mid : FloatProperty(
name="Center Width",
description="Adjust taper at center",
default=1.0,
min=0.0
)
- link1 = BoolProperty(
+ link1 : BoolProperty(
name="Link Ends",
description="Link the End Width Left / Right settings\n"
"End Width Left will be editable ",
default=True
)
- link2 = BoolProperty(
+ link2 : BoolProperty(
name="Link Ends / Center",
description="Link the End Widths with the Center Width",
default=False
)
- diff = FloatProperty(
+ diff : FloatProperty(
name="Difference",
default=1,
description="Difference between ends and center while linked"
@@ -325,25 +325,25 @@ class add_bevelcurve(Operator, AddObjectHelper):
bl_label = "Add Curve as Bevel"
bl_description = ("Add bevel curve to Active Curve\n"
"Needs an existing Active Curve")
- bl_options = {'REGISTER', 'UNDO'}
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
- types = IntProperty(
+ types : IntProperty(
name="Type",
description="Type of bevel curve",
default=1,
min=1, max=5
)
- scale_x = FloatProperty(
+ scale_x : FloatProperty(
name="Scale X",
description="Scale on X axis",
default=1.0
)
- scale_y = FloatProperty(
+ scale_y : FloatProperty(
name="Scale Y",
description="Scale on Y axis",
default=1.0
)
- link = BoolProperty(
+ link : BoolProperty(
name="Link XY",
description="Link the Scale on X/Y axis",
default=True
@@ -364,7 +364,7 @@ class add_bevelcurve(Operator, AddObjectHelper):
col.prop(self, "rotation")
col = layout.column(align=True)
- col.label("Settings:")
+ col.label(text = "Settings:")
col.prop(self, "types")
split = layout.split(percentage=0.95, align=True)
@@ -394,7 +394,7 @@ class add_bevelcurve(Operator, AddObjectHelper):
class Bevel_Taper_Curve_Menu(Menu):
bl_label = "Bevel/Taper"
- bl_idname = "OBJECT_MT_bevel_taper_curve_menu"
+ bl_idname = "VIEW3D_MT_bevel_taper_curve_menu"
def draw(self, context):
layout = self.layout
@@ -405,16 +405,16 @@ class Bevel_Taper_Curve_Menu(Menu):
def menu_funcs(self, context):
if bpy.context.scene.objects.active.type == "CURVE":
- self.layout.menu("OBJECT_MT_bevel_taper_curve_menu")
+ self.layout.menu("VIEW3D_MT_bevel_taper_curve_menu")
def register():
- bpy.utils.register_module(__name__)
+ #bpy.utils.register_module(__name__)
bpy.types.VIEW3D_MT_object.append(menu_funcs)
def unregister():
- bpy.utils.unregister_module(__name__)
+ #bpy.utils.unregister_module(__name__)
bpy.types.VIEW3D_MT_object.remove(menu_funcs)