[Bf-extensions-cvs] [70b42a69] master: Add Curve: Extra Objects: fix visibility, move and rotate in edit mode
Spivak Vladimir cwolf3d
noreply at git.blender.org
Mon Jul 15 02:20:41 CEST 2019
Commit: 70b42a69b58f6859eabc3b4bc702a67bc2b2f42d
Author: Spivak Vladimir (cwolf3d)
Date: Mon Jul 15 03:19:21 2019 +0300
Branches: master
https://developer.blender.org/rBA70b42a69b58f6859eabc3b4bc702a67bc2b2f42d
Add Curve: Extra Objects: fix visibility, move and rotate in edit mode
===================================================================
M add_curve_extra_objects/add_curve_aceous_galore.py
M add_curve_extra_objects/add_curve_braid.py
M add_curve_extra_objects/add_curve_curly.py
M add_curve_extra_objects/add_curve_simple.py
M add_curve_extra_objects/add_curve_spirals.py
M add_curve_extra_objects/beveltaper_curve.py
===================================================================
diff --git a/add_curve_extra_objects/add_curve_aceous_galore.py b/add_curve_extra_objects/add_curve_aceous_galore.py
index 5b67dcad..f5cec2fa 100644
--- a/add_curve_extra_objects/add_curve_aceous_galore.py
+++ b/add_curve_extra_objects/add_curve_aceous_galore.py
@@ -767,23 +767,39 @@ def createCurve(context, vertArray, self, align_matrix):
if bpy.context.mode == 'EDIT_CURVE':
Curve = context.active_object
newSpline = Curve.data.splines.new(type=splineType) # spline
- Curve.matrix_world = align_matrix # apply matrix
- Curve.rotation_euler = self.rotation_euler
else:
# create curve
- newCurve = bpy.data.curves.new(name, type='CURVE') # curve data block
- newSpline = newCurve.splines.new(type=splineType) # spline
-
- # set curveOptions
- newCurve.dimensions = self.shape
- newCurve.use_path = True
+ dataCurve = bpy.data.curves.new(name, type='CURVE') # curve data block
+ newSpline = dataCurve.splines.new(type=splineType) # spline
# create object with newCurve
- SimpleCurve = object_utils.object_data_add(context, newCurve, operator=self) # place in active scene
- SimpleCurve.select_set(True)
- SimpleCurve.matrix_world = align_matrix # apply matrix
- SimpleCurve.rotation_euler = self.rotation_euler
-
+ Curve = object_utils.object_data_add(context, dataCurve, operator=self) # place in active scene
+ Curve.matrix_world = align_matrix # apply matrix
+ Curve.rotation_euler = self.rotation_euler
+
+ # set newSpline Options
+ newSpline.use_cyclic_u = self.use_cyclic_u
+ newSpline.use_endpoint_u = self.endp_u
+ newSpline.order_u = self.order_u
+
+ # set curve Options
+ Curve.data.dimensions = self.shape
+ Curve.data.use_path = True
+ if self.shape == '3D':
+ Curve.data.fill_mode = 'FULL'
+ else:
+ Curve.data.fill_mode = 'BOTH'
+
+ for spline in Curve.data.splines:
+ if spline.type == 'BEZIER':
+ for point in spline.bezier_points:
+ point.select_control_point = False
+ point.select_left_handle = False
+ point.select_right_handle = False
+ else:
+ for point in spline.points:
+ point.select = False
+
# create spline from vertarray
if splineType == 'BEZIER':
newSpline.bezier_points.add(int(len(vertArray) * 0.33))
@@ -791,15 +807,23 @@ def createCurve(context, vertArray, self, align_matrix):
for point in newSpline.bezier_points:
point.handle_right_type = self.handleType
point.handle_left_type = self.handleType
+ point.select_control_point = True
+ point.select_left_handle = True
+ point.select_right_handle = True
else:
newSpline.points.add(int(len(vertArray) * 0.25 - 1))
newSpline.points.foreach_set('co', vertArray)
newSpline.use_endpoint_u = True
+ for point in newSpline.points:
+ point.select = True
+
+ # move and rotate spline in edit mode
+ if bpy.context.mode == 'EDIT_CURVE':
+ bpy.ops.transform.translate(value = self.startlocation)
+ bpy.ops.transform.rotate(value = self.rotation_euler[0], orient_axis = 'X')
+ bpy.ops.transform.rotate(value = self.rotation_euler[1], orient_axis = 'Y')
+ bpy.ops.transform.rotate(value = self.rotation_euler[2], orient_axis = 'Z')
- # set curveOptions
- newSpline.use_cyclic_u = self.use_cyclic_u
- newSpline.use_endpoint_u = self.endp_u
- newSpline.order_u = self.order_u
return
@@ -1408,6 +1432,9 @@ class Curveaceous_galore(Operator, object_utils.AddObjectHelper):
col.prop(self, "noiseBasis")
col.prop(self, "noiseSeed")
+ row = layout.row()
+ row.prop(self, "shape", expand=True)
+
# output options
col = layout.column()
col.label(text="Output Curve Type:")
@@ -1418,8 +1445,8 @@ class Curveaceous_galore(Operator, object_utils.AddObjectHelper):
elif self.outputType == 'BEZIER':
col.row().prop(self, 'handleType', expand=True)
- #col = layout.column()
- #col.row().prop(self, "use_cyclic_u", expand=True)
+ col = layout.column()
+ col.row().prop(self, "use_cyclic_u", expand=True)
box = layout.box()
box.label(text="Location:")
@@ -1433,6 +1460,13 @@ class Curveaceous_galore(Operator, object_utils.AddObjectHelper):
return context.scene is not None
def execute(self, context):
+ # main function
+ self.align_matrix = align_matrix(context, self.startlocation)
+ main(context, self, self.align_matrix or Matrix())
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
# deal with 2D - 3D curve differences
if self.ProfileType in ['Helix', 'Cycloid', 'Noise']:
self.shape = '3D'
@@ -1451,10 +1485,8 @@ class Curveaceous_galore(Operator, object_utils.AddObjectHelper):
self.use_cyclic_u = False
else:
self.use_cyclic_u = True
-
- # main function
- self.align_matrix = align_matrix(context, self.startlocation)
- main(context, self, self.align_matrix or Matrix())
+
+ self.execute(context)
return {'FINISHED'}
diff --git a/add_curve_extra_objects/add_curve_braid.py b/add_curve_extra_objects/add_curve_braid.py
index fcaaf15e..874324a8 100644
--- a/add_curve_extra_objects/add_curve_braid.py
+++ b/add_curve_extra_objects/add_curve_braid.py
@@ -96,6 +96,7 @@ def poly_line(curve, points, join=True, type='NURBS'):
def poly_lines(objname, curvename, lines, bevel=None, joins=False, ctype='NURBS'):
curve = bpy.data.curves.new(name=curvename, type='CURVE')
curve.dimensions = '3D'
+ curve.fill_mode = 'FULL'
obj = bpy.data.objects.new(objname, curve)
obj.location = (0, 0, 0) # object origin
diff --git a/add_curve_extra_objects/add_curve_curly.py b/add_curve_extra_objects/add_curve_curly.py
index 813509c1..e904a070 100644
--- a/add_curve_extra_objects/add_curve_curly.py
+++ b/add_curve_extra_objects/add_curve_curly.py
@@ -18,6 +18,7 @@ import bpy
from bpy.types import Operator
from bpy.props import (
FloatProperty,
+ EnumProperty,
IntProperty,
)
from bpy_extras.object_utils import (
@@ -386,6 +387,17 @@ def make_curve(self, context, verts, lh, rh):
# create object
if bpy.context.mode == 'EDIT_CURVE':
Curve = context.active_object
+
+ for spline in Curve.data.splines:
+ if spline.type == 'BEZIER':
+ for point in spline.bezier_points:
+ point.select_control_point = False
+ point.select_left_handle = False
+ point.select_right_handle = False
+ else:
+ for point in spline.points:
+ point.select = False
+
for p in range(len(verts)):
c = 0
newSpline = Curve.data.splines.new(type='BEZIER') # newSpline
@@ -397,16 +409,24 @@ def make_curve(self, context, verts, lh, rh):
bp.handle_right_type = 'ALIGNED'
bp.handle_left.xyz = lh[p][c]
bp.handle_right.xyz = rh[p][c]
+ bp.select_control_point = True
+ bp.select_left_handle = True
+ bp.select_right_handle = True
c += 1
# something weird with this one
if types == 1 or types == 2 or types == 3:
newSpline.bezier_points[3].handle_left.xyz = lh[p][3]
+
+ bpy.ops.transform.translate(value = self.location)
+ bpy.ops.transform.rotate(value = self.rotation[0], orient_axis = 'X')
+ bpy.ops.transform.rotate(value = self.rotation[1], orient_axis = 'Y')
+ bpy.ops.transform.rotate(value = self.rotation[2], orient_axis = 'Z')
else:
# create curve
- newCurve = bpy.data.curves.new(name='CurlyCurve', type='CURVE') # curvedatablock
+ dataCurve = bpy.data.curves.new(name='CurlyCurve', type='CURVE') # curvedatablock
for p in range(len(verts)):
c = 0
- newSpline = newCurve.splines.new(type='BEZIER') # newSpline
+ newSpline = dataCurve.splines.new(type='BEZIER') # newSpline
newSpline.bezier_points.add(len(verts[p]) / 3 - 1)
newSpline.bezier_points.foreach_set('co', verts[p])
@@ -415,18 +435,25 @@ def make_curve(self, context, verts, lh, rh):
bp.handle_right_type = 'ALIGNED'
bp.handle_left.xyz = lh[p][c]
bp.handle_right.xyz = rh[p][c]
+ bp.select_control_point = True
+ bp.select_left_handle = True
+ bp.select_right_handle = True
c += 1
# something weird with this one
if types == 1 or types == 2 or types == 3:
newSpline.bezier_points[3].handle_left.xyz = lh[p][3]
# create object with newCurve
- Curve = object_data_add(context, newCurve, operator=self) # place in active scene
+ Curve = object_data_add(context, dataCurve, operator=self) # place in active scene
Curve.select_set(True)
# set curveOptions
- Curve.data.dimensions = '3D'
+ Curve.data.dimensions = self.shape
Curve.data.use_path = True
+ if self.shape == '3D':
+ Curve.data.fill_mode = 'FULL'
+ else:
+ Curve.data.fill_mode = 'BOTH'
class add_curlycurve(Operator, AddObjectHelper):
bl_idname = "curve.curlycurve"
@@ -450,6 +477,15 @@ class add_curlycurve(Operator, AddObjectHelper):
description="Scale on Y axis",
default=1.0
)
+ # Curve Options
+ shape : EnumProperty(
+ name="2D / 3D",
+ description="2D or 3D Curve",
+ items=[
+ ('2D', "2D", "2D"),
+ ('3D', "3D", "3D")
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list