diff options
author | Spivak Vladimir (cwolf3d) <cwolf3d@gmail.com> | 2019-11-23 05:08:43 +0300 |
---|---|---|
committer | Spivak Vladimir (cwolf3d) <cwolf3d@gmail.com> | 2019-11-23 05:08:43 +0300 |
commit | da9a0d0c51d87e96aa04cbaf84e790a606f76d5f (patch) | |
tree | db4f06f784d801cf7df1faf7001e5f07ba99603e /add_curve_extra_objects/add_curve_curly.py | |
parent | ee818b2a28e769e1fec728da95b9235047141c4c (diff) |
Fix T71782: Curve/Point doesn't get generated at Cursor.
Diffstat (limited to 'add_curve_extra_objects/add_curve_curly.py')
-rw-r--r-- | add_curve_extra_objects/add_curve_curly.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/add_curve_extra_objects/add_curve_curly.py b/add_curve_extra_objects/add_curve_curly.py index 1ac76341..65990ee2 100644 --- a/add_curve_extra_objects/add_curve_curly.py +++ b/add_curve_extra_objects/add_curve_curly.py @@ -418,10 +418,6 @@ def make_curve(self, context, verts, lh, rh): 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 dataCurve = bpy.data.curves.new(name='CurlyCurve', type='CURVE') # curvedatablock @@ -455,6 +451,31 @@ def make_curve(self, context, verts, lh, rh): Curve.data.fill_mode = 'FULL' else: Curve.data.fill_mode = 'BOTH' + + # move and rotate spline in edit mode + if bpy.context.mode == 'EDIT_CURVE': + if self.align == "WORLD": + location = self.location - context.active_object.location + bpy.ops.transform.translate(value = location, orient_type='GLOBAL') + bpy.ops.transform.rotate(value = self.rotation[0], orient_axis = 'X', orient_type='GLOBAL') + bpy.ops.transform.rotate(value = self.rotation[1], orient_axis = 'Y', orient_type='GLOBAL') + bpy.ops.transform.rotate(value = self.rotation[2], orient_axis = 'Z', orient_type='GLOBAL') + + elif self.align == "VIEW": + 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') + + elif self.align == "CURSOR": + location = context.active_object.location + self.location = bpy.context.scene.cursor.location - location + self.rotation = bpy.context.scene.cursor.rotation_euler + + 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') class add_curlycurve(Operator, AddObjectHelper): bl_idname = "curve.curlycurve" |