mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
added question if want also to trigger create project structure action
This commit is contained in:
parent
4c59372044
commit
385f59295d
1 changed files with 44 additions and 3 deletions
|
|
@ -6,6 +6,8 @@ from pype.ftrack import BaseAction
|
|||
from pypeapp import config
|
||||
from pype.ftrack.lib import get_avalon_attr
|
||||
|
||||
from pype.vendor.ftrack_api import session as fa_session
|
||||
|
||||
|
||||
class PrepareProject(BaseAction):
|
||||
'''Edit meta data action.'''
|
||||
|
|
@ -22,6 +24,9 @@ class PrepareProject(BaseAction):
|
|||
os.environ.get('PYPE_STATICS_SERVER', '')
|
||||
)
|
||||
|
||||
# Key to store info about trigerring create folder structure
|
||||
create_project_structure_key = "create_folder_structure"
|
||||
|
||||
def discover(self, session, entities, event):
|
||||
''' Validation '''
|
||||
if len(entities) != 1:
|
||||
|
|
@ -74,8 +79,29 @@ class PrepareProject(BaseAction):
|
|||
str([key for key in attributes_to_set])
|
||||
))
|
||||
|
||||
title = "Set Attribute values"
|
||||
item_splitter = {'type': 'label', 'value': '---'}
|
||||
title = "Prepare Project"
|
||||
items = []
|
||||
|
||||
# Ask if want to trigger Action Create Folder Structure
|
||||
items.append({
|
||||
"type": "label",
|
||||
"value": "<h3>Want to create basic Folder Structure?</h3>"
|
||||
})
|
||||
|
||||
items.append({
|
||||
"name": self.create_project_structure_key,
|
||||
"type": "boolean",
|
||||
"value": False,
|
||||
"label": "Check if Yes"
|
||||
})
|
||||
|
||||
items.append(item_splitter)
|
||||
items.append({
|
||||
"type": "label",
|
||||
"value": "<h3>Set basic Attributes:</h3>"
|
||||
})
|
||||
|
||||
multiselect_enumerators = []
|
||||
|
||||
# This item will be last (before enumerators)
|
||||
|
|
@ -88,8 +114,6 @@ class PrepareProject(BaseAction):
|
|||
"label": "AutoSync to Avalon"
|
||||
}
|
||||
|
||||
item_splitter = {'type': 'label', 'value': '---'}
|
||||
|
||||
for key, in_data in attributes_to_set.items():
|
||||
attr = in_data["object"]
|
||||
|
||||
|
|
@ -195,6 +219,10 @@ class PrepareProject(BaseAction):
|
|||
return
|
||||
|
||||
in_data = event['data']['values']
|
||||
|
||||
# pop out info about creating project structure
|
||||
create_proj_struct = in_data.pop(self.create_project_structure_key)
|
||||
|
||||
# Find hidden items for multiselect enumerators
|
||||
keys_to_process = []
|
||||
for key in in_data:
|
||||
|
|
@ -228,6 +256,19 @@ class PrepareProject(BaseAction):
|
|||
|
||||
session.commit()
|
||||
|
||||
# Trigger Create Project Structure action
|
||||
if create_proj_struct is True:
|
||||
self.log.debug("Triggering Create Project Structure action")
|
||||
event = fa_session.ftrack_api.event.base.Event(
|
||||
topic="ftrack.action.launch",
|
||||
data=dict(
|
||||
actionIdentifier="create.project.structure",
|
||||
selection=event["data"]["selection"]
|
||||
),
|
||||
source=dict(user=event['source']['user'])
|
||||
)
|
||||
session.event_hub.publish(event, on_error='ignore')
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue