for sure! Heres a snippet of the "launch" function but I might break it up into multiple functions so its cleaner.
def launch(self, event):
selection = event['data']['selection']
path = 'C:\\project\\test\\'
if len(selection) == 1:
entity = selection[0]
task = None
shot = None
projects = None
try:
projects = self.session.query(
f'Project where id is \"{entity["entityId"]}\"'
).one()
task = self.session.query(
f'Task where id is \"{entity["entityId"]}\"'
).one()
os.makedirs(path + projects['name'] + shot['name'])
except Exception as e:
return {
'success': False,
'message': 'An error occurred.'
}
if task:
return {
'success': True,
'message': f'Shot name: {shot["name"]}'
}
return False
essentially what I'm trying to have it do here is once I select a shot that has a task in it it will create a folder with the name of that shot and task inside of it. Eventually I want to be able to select the project as a whole and have it create a folder for each shot that has a task assigned to it but one step at a time haha