2026-01-01
This commit is contained in:
@@ -1975,9 +1975,9 @@ def make_action(name, reuse=False, slot_type=None, target_obj=None, slot_name=No
|
||||
if target_obj:
|
||||
if not slot_type:
|
||||
slot_type = get_slot_type_for(target_obj)
|
||||
if not slot_name:
|
||||
slot_name = f"SLOT-{slot_type}"
|
||||
make_action_slot(action, slot_type, slot_name)
|
||||
if not slot_name:
|
||||
slot_name = f"SLOT-{slot_type}"
|
||||
make_action_slot(action, slot_type, slot_name)
|
||||
return action
|
||||
|
||||
|
||||
@@ -2088,6 +2088,34 @@ def clear_action(action, slot_type=None, slot_name=None):
|
||||
return False
|
||||
|
||||
|
||||
def get_all_action_channels(action: bpy.types.Action):
|
||||
channels = []
|
||||
if action:
|
||||
if B440():
|
||||
if not action.layers:
|
||||
layer = action.layers.new("Layer")
|
||||
else:
|
||||
layer = action.layers[0]
|
||||
if not layer.strips:
|
||||
strip = layer.strips.new(type='KEYFRAME')
|
||||
else:
|
||||
strip = layer.strips[0]
|
||||
for channelbag in strip.channelbags:
|
||||
channels.append(channelbag)
|
||||
else:
|
||||
channels.append(action)
|
||||
return channels
|
||||
|
||||
|
||||
def get_action_fcurves(action: bpy.types.Action):
|
||||
fcurves = []
|
||||
channels = get_all_action_channels(action)
|
||||
for channel in channels:
|
||||
for fcurve in channel.fcurves:
|
||||
fcurves.append(fcurve)
|
||||
return fcurves
|
||||
|
||||
|
||||
def get_action_channels(action: bpy.types.Action, slot=None, slot_type=None):
|
||||
if not action:
|
||||
return None
|
||||
@@ -2812,7 +2840,7 @@ def set_rl_object_id(obj, new_id=None):
|
||||
|
||||
|
||||
def get_rl_object_id(obj):
|
||||
if obj:
|
||||
if object_exists(obj):
|
||||
if obj.type == "ARMATURE" and "rl_armature_id" in obj:
|
||||
return obj["rl_armature_id"]
|
||||
if "rl_object_id" in obj:
|
||||
@@ -2938,3 +2966,13 @@ def smallest_index(items: list):
|
||||
smallest_value = value
|
||||
index = i
|
||||
return index
|
||||
|
||||
|
||||
def safe_free_bake(point_cache):
|
||||
if B320():
|
||||
with bpy.context.temp_override(point_cache=point_cache):
|
||||
bpy.ops.ptcache.free_bake()
|
||||
else:
|
||||
context_override = bpy.context.copy()
|
||||
context_override["point_cache"] = point_cache
|
||||
bpy.ops.ptcache.free_bake(context_override)
|
||||
Reference in New Issue
Block a user