Merge remote-tracking branch 'origin/blender-v4.4-release'
This commit is contained in:
commit
6def7c3276
@ -89,11 +89,18 @@ def action_get_channelbag_for_slot(action: Action, slot: ActionSlot) -> ActionCh
|
||||
return None
|
||||
|
||||
|
||||
def _ensure_channelbag_exists(action: Action, slot: ActionSlot):
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
channelbag = strip.channelbag(slot, ensure=True)
|
||||
return channelbag
|
||||
def _ensure_channelbag_exists(action: Action, slot: ActionSlot) -> ActionChannelbag:
|
||||
try:
|
||||
layer = action.layers[0]
|
||||
except IndexError:
|
||||
layer = action.layers.new("Layer")
|
||||
|
||||
try:
|
||||
strip = layer.strips[0]
|
||||
except IndexError:
|
||||
strip = layer.strips.new(type='KEYFRAME')
|
||||
|
||||
return strip.channelbag(slot, ensure=True)
|
||||
|
||||
|
||||
def bake_action(
|
||||
@ -389,22 +396,18 @@ def bake_action_iter(
|
||||
is_new_action = action is None
|
||||
if is_new_action:
|
||||
action = bpy.data.actions.new("Action")
|
||||
else:
|
||||
# When baking into the current action, a slot needs to be assigned.
|
||||
if not atd.action_slot:
|
||||
slot = action.slots.new(obj.id_type, obj.name)
|
||||
atd.action_slot = slot
|
||||
|
||||
# Only leave tweak mode if we actually need to modify the action (#57159)
|
||||
if action != atd.action:
|
||||
# Leave tweak mode before trying to modify the action (#48397)
|
||||
if atd.use_tweak_mode:
|
||||
atd.use_tweak_mode = False
|
||||
|
||||
atd.action = action
|
||||
if action.is_action_layered:
|
||||
slot = action.slots.new(obj.id_type, obj.name)
|
||||
atd.action_slot = slot
|
||||
|
||||
# A slot needs to be assigned.
|
||||
if not atd.action_slot:
|
||||
slot = action.slots.new(obj.id_type, obj.name)
|
||||
atd.action_slot = slot
|
||||
|
||||
# Baking the action only makes sense in Replace mode, so force it (#69105)
|
||||
if not atd.use_tweak_mode:
|
||||
@ -722,9 +725,6 @@ class KeyframesCo:
|
||||
data_path, array_index = fc_key
|
||||
assert action.is_action_layered
|
||||
channelbag = _ensure_channelbag_exists(action, action_slot)
|
||||
if not channelbag:
|
||||
# Can happen if no layers or strips exist on the action.
|
||||
continue
|
||||
fcurve = channelbag.fcurves.new(data_path, index=array_index)
|
||||
|
||||
keyframe_points = fcurve.keyframe_points
|
||||
|
Loading…
x
Reference in New Issue
Block a user