Trying to figure out how to find a control rig based on the current selected control in the viewport, with Python. I’d like to, ultimately, get around the problem that the Pose Tool has of selecting controls on every control rig in the sequencer. It’d be ideal to filter the selection to the selected Control Rig vs all Control Rigs in the Sequencer…
import unreal
#Get current level sequence
lvl_seq = unreal.LevelSequenceEditorBlueprintLibrary.get_current_level_sequence()
print(lvl_seq)
#Get all rigs in level sequence
rig_prxs = unreal.ControlRigSequencerLibrary.get_control_rigs(lvl_seq)
active_rig = []
#Iterate through control selection to find the rig the selection belongs to...
for i in range(len(rig_prxs)):
rig = rig_prxs[i].control_rig
#Query selected control in Sequencer
sel_ctrl = rig.current_control_selection()
try:
if len(sel_ctrl):
active_rig.append(rig_prxs[i])
except:
print('No rig found')
rig.clear_control_selection()
#Current rig
rig = active_rig[0].control_rig
rig.select_control("upperarm_r_fk_ctrl")
rig_ctrls = rig.current_control_selection()
print(rig_ctrls)