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
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _ensure_channelbag_exists(action: Action, slot: ActionSlot):
|
def _ensure_channelbag_exists(action: Action, slot: ActionSlot) -> ActionChannelbag:
|
||||||
for layer in action.layers:
|
try:
|
||||||
for strip in layer.strips:
|
layer = action.layers[0]
|
||||||
channelbag = strip.channelbag(slot, ensure=True)
|
except IndexError:
|
||||||
return channelbag
|
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(
|
def bake_action(
|
||||||
@ -389,22 +396,18 @@ def bake_action_iter(
|
|||||||
is_new_action = action is None
|
is_new_action = action is None
|
||||||
if is_new_action:
|
if is_new_action:
|
||||||
action = bpy.data.actions.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)
|
# Only leave tweak mode if we actually need to modify the action (#57159)
|
||||||
if action != atd.action:
|
if action != atd.action:
|
||||||
# Leave tweak mode before trying to modify the action (#48397)
|
# Leave tweak mode before trying to modify the action (#48397)
|
||||||
if atd.use_tweak_mode:
|
if atd.use_tweak_mode:
|
||||||
atd.use_tweak_mode = False
|
atd.use_tweak_mode = False
|
||||||
|
|
||||||
atd.action = action
|
atd.action = action
|
||||||
if action.is_action_layered:
|
|
||||||
slot = action.slots.new(obj.id_type, obj.name)
|
# A slot needs to be assigned.
|
||||||
atd.action_slot = slot
|
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)
|
# Baking the action only makes sense in Replace mode, so force it (#69105)
|
||||||
if not atd.use_tweak_mode:
|
if not atd.use_tweak_mode:
|
||||||
@ -722,9 +725,6 @@ class KeyframesCo:
|
|||||||
data_path, array_index = fc_key
|
data_path, array_index = fc_key
|
||||||
assert action.is_action_layered
|
assert action.is_action_layered
|
||||||
channelbag = _ensure_channelbag_exists(action, action_slot)
|
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)
|
fcurve = channelbag.fcurves.new(data_path, index=array_index)
|
||||||
|
|
||||||
keyframe_points = fcurve.keyframe_points
|
keyframe_points = fcurve.keyframe_points
|
||||||
|
Loading…
x
Reference in New Issue
Block a user