reset rotation mode

This commit is contained in:
jrkb 2025-01-19 12:03:42 +01:00
parent d13afa7d7d
commit 36c8f25e29

View file

@ -821,6 +821,15 @@ def set_text_on_curve(text_properties, reset_timeout_s=0.1, reset_depsgraph_n=4)
ob.constraints["Follow Path"].up_axis = "UP_Y"
spline_index = 0
elif distribution_type == 'CALCULATE':
previous_ob_rotation_mode = None
previous_obg_rotation_mode = None
if ob.rotation_mode != 'QUATERNION':
ob.rotation_mode = 'QUATERNION'
previous_ob_rotation_mode = ob.rotation_mode
if obg.rotation_mode != 'QUATERNION':
obg.rotation_mode = 'QUATERNION'
previous_obg_rotation_mode = obg.rotation_mode
location, tangent, spline_index = calc_point_on_bezier_curve(mom, advance, True, True)
if spline_index != previous_spline_index:
is_newline = True
@ -846,10 +855,7 @@ def set_text_on_curve(text_properties, reset_timeout_s=0.1, reset_depsgraph_n=4)
vectors,
factors,
local_main_axis)
if ob.rotation_mode != 'QUATERNION':
ob.rotation_mode = 'QUATERNION'
if obg.rotation_mode != 'QUATERNION':
obg.rotation_mode = 'QUATERNION'
q = mathutils.Quaternion()
q.rotate(text_properties.orientation)
if regenerate:
@ -864,6 +870,10 @@ def set_text_on_curve(text_properties, reset_timeout_s=0.1, reset_depsgraph_n=4)
obg.rotation_quaternion = (mom.matrix_world @ q.to_matrix().to_4x4()).to_quaternion()
# ob.rotation_quaternion = (mom.matrix_world @ q.to_matrix().to_4x4()).to_quaternion()
if previous_ob_rotation_mode:
ob.rotation_mode = previous_ob_rotation_mode
if previous_obg_rotation_mode:
obg.rotation_mode = previous_obg_rotation_mode
glyph_advance = get_glyph_advance(glyph) * scalor + text_properties.letter_spacing