Rotating the handles of bezier curves.
Running script in edit mode on default bez (blender 2.82)
There are some issues at play, eg what handle type you are using. I have set the type of both to 'FREE'
For example, here is a script to rotate both handles of point 0 of bezier curve by 45 degrees about the local z axis passing through the coordinate point.
Running the script 8 times should see the handles return to initial position.
To rotate have used one of the methods outlined in https://blender.stackexchange.com/a/7603/15543 which is probably a better way to go for a "Procedural System" than operators.
import bpy
from mathutils import Matrix
from math import radians
ob = bpy.context.object
cu = ob.data
spline = cu.splines[0]
p = spline.bezier_points[0]
M = (Matrix.Translation(p.co) @
Matrix.Rotation(radians(45), 4, 'Z') @
Matrix.Translation(-p.co))
p.handle_left_type = 'FREE'
p.handle_right_type = 'FREE'
p.handle_left = M @ p.handle_left
p.handle_right = M @ p.handle_right
Running the script in 2.81 in either mode produces the desired result and updates in the UI.
If you are having issues recommend that you look for errors in the system console, or IMO better still, test in the python console.
# this one throws a syntax error
bpy.ops.transform.transform(
mode='ROTATION',
value=0.6
)
# or this one relies on settings for axis an pivot point, but does rotate
bpy.ops.transform.rotate(
value=0.6
)
bpy.ops.object.mode_set(mode='EDIT')for the ops function. Still doesn't update. – Alex Braun Dec 02 '19 at 00:17