work
save startup to fix blender opening on 2nd monitor
This commit is contained in:
@@ -648,6 +648,14 @@ def AL_bake(frame_start, frame_end, nla_tracks, fcu_keys, additive, step, action
|
||||
baked_channelbag = anim_layers.get_channelbag(obj, baked_action)
|
||||
baked_fcurves = baked_channelbag.fcurves
|
||||
|
||||
|
||||
if not obj.als.smartbake:
|
||||
interpolation_types = ('CONSTANT', 'LINEAR', 'BEZIER', 'SINE', 'QUAD', 'CUBIC', 'QUART', 'QUINT', 'EXPO', 'CIRC', 'BACK', 'BOUNCE', 'ELASTIC')
|
||||
handle_types = ('FREE', 'ALIGNED', 'VECTOR', 'AUTO', 'AUTO_CLAMPED')
|
||||
# Get the index position to assign with foreach_set
|
||||
interpolation = interpolation_types.index(bpy.context.preferences.edit.keyframe_new_interpolation_type)
|
||||
handle_type = handle_types.index(bpy.context.preferences.edit.keyframe_new_handle_type)
|
||||
|
||||
if obj.als.operator == 'MERGE':# and not additive: # and anim_data.action is not None: #and obj.als.onlyselected
|
||||
#overwrite action
|
||||
anim_data.use_tweak_mode = False
|
||||
@@ -845,7 +853,7 @@ def AL_bake(frame_start, frame_end, nla_tracks, fcu_keys, additive, step, action
|
||||
smartkey.value = eval_array[i]
|
||||
if smartkey.inbetween:
|
||||
continue
|
||||
|
||||
|
||||
baked_fcu.keyframe_points.add(1)
|
||||
keyframe = baked_fcu.keyframe_points[-1]
|
||||
keyframe.co = (frame, eval_array[i])
|
||||
@@ -859,6 +867,10 @@ def AL_bake(frame_start, frame_end, nla_tracks, fcu_keys, additive, step, action
|
||||
continue
|
||||
if obj.als.smartbake:
|
||||
add_interpolations(baked_fcu, fcu_keys[(fcu_key[0], i)], layers_count)
|
||||
else:
|
||||
# Add the interpolation and handle types from the preferences defaults
|
||||
set_all_handles(baked_fcu, interpolation, handle_type)
|
||||
|
||||
baked_fcu.update()
|
||||
|
||||
#paste the modifiers to the new baked fcurve
|
||||
@@ -874,6 +886,17 @@ def AL_bake(frame_start, frame_end, nla_tracks, fcu_keys, additive, step, action
|
||||
|
||||
return baked_action
|
||||
|
||||
def set_all_handles(baked_fcu, interpolation, handle_type):
|
||||
'''Set all the handle types and interpolations in an fcurve using foreach_set and numpy
|
||||
should use numerical value instead of a string'''
|
||||
keyframes_len = len(baked_fcu.keyframe_points)
|
||||
interpolations = np.full(keyframes_len, interpolation)
|
||||
handles = np.full(keyframes_len, handle_type)
|
||||
kp = baked_fcu.keyframe_points
|
||||
kp.foreach_set('interpolation', interpolations)
|
||||
kp.foreach_set('handle_left_type', handles)
|
||||
kp.foreach_set('handle_right_type', handles)
|
||||
|
||||
def ensure_fcurves_bversion(fcurves, data_path, i):
|
||||
'''Either use ensure in Blender 5.0 and above or use find and new in older version'''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user