I’m making some improvements to the collect media script and I’ve run into an issue. The project I’m testing in is throwing an error and I can’t for the life of me figure it out. I know what the issue is but I need to know which reel/reel group is causing it. Other projects are fine so it’s a weird one as I think this is a bit of an edge case.
I’ve tried to debug by spitting out the name at each step but to no avail. Is there a way to call a flame object directly and then get information from there?
In other words, in the console I’m getting flame.PyReel object at 0x7f6f5edacf90 and I’d like to be able to implicitly call that object and get it’s name and parent, etc so I can work backwards.
Ya, normally I would iterate through the selection. Something like this.
import flame
def process_selection(selection):
'''Loop through selection.'''
for reel in selection:
print(reel) # that PyReel object stored as a variable named reel
print(reel.name)
print(reel.parent)
def scope_reel(selection):
'''Filter for only PySequence.'''
for item in selection:
if isinstance(item, flame.PyReel):
return True
return False
def get_media_panel_custom_ui_actions():
'''Python hook to add custom right click menu.'''
return [{'name': 'WIP...',
'actions': [{'name': 'Print PyReel Details',
'isVisible': scope_reel,
'execute': process_selection,
'minimumVersion': '2021.1'}]
}]
Re-reading your question… Short answer - Im not aware of a way to directly interact with the PyFlame objects. Its all based on selections.
I lied… I mostly use selections but I guess you could interact directly by using the flame module defines. So instead of using selection workflow, you could get the current ReelGroup and then drill down to the PyReel you want with these. But you can see these defines spit out a lot of lists to sift through, I think selection way might be easier.
Thanks both. Looks like there isn’t really a great way to do it. In the end I just had to debug my way through it and I finally found the culprit. A clip that turned into a sequence that was then returning None for segments.