mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Align Openpype and Ayon settings, quick fix in shelves loader script
This commit is contained in:
parent
0e331db93a
commit
381c00c334
3 changed files with 91 additions and 73 deletions
|
|
@ -23,29 +23,33 @@ def generate_shelves():
|
|||
# load configuration of houdini shelves
|
||||
project_name = get_current_project_name()
|
||||
project_settings = get_project_settings(project_name)
|
||||
shelves_set_config = project_settings["houdini"]["shelves"]
|
||||
shelves_configs = project_settings["houdini"]["shelves"]
|
||||
|
||||
if not shelves_set_config:
|
||||
if not shelves_configs:
|
||||
log.debug("No custom shelves found in project settings.")
|
||||
return
|
||||
|
||||
# Get Template data
|
||||
template_data = get_current_context_template_data()
|
||||
|
||||
for shelf_set_config in shelves_set_config:
|
||||
shelf_set_filepath = shelf_set_config.get('shelf_set_source_path')
|
||||
shelf_set_os_filepath = shelf_set_filepath[current_os]
|
||||
if shelf_set_os_filepath:
|
||||
shelf_set_os_filepath = get_path_using_template_data(
|
||||
shelf_set_os_filepath, template_data
|
||||
)
|
||||
if not os.path.isfile(shelf_set_os_filepath):
|
||||
log.error("Shelf path doesn't exist - "
|
||||
"{}".format(shelf_set_os_filepath))
|
||||
continue
|
||||
for config in shelves_configs:
|
||||
selected_option = config["options"]
|
||||
shelf_set_config = config[selected_option]
|
||||
|
||||
hou.shelves.loadFile(shelf_set_os_filepath)
|
||||
continue
|
||||
shelf_set_filepath = shelf_set_config.get('shelf_set_source_path')
|
||||
if shelf_set_filepath:
|
||||
shelf_set_os_filepath = shelf_set_filepath[current_os]
|
||||
if shelf_set_os_filepath:
|
||||
shelf_set_os_filepath = get_path_using_template_data(
|
||||
shelf_set_os_filepath, template_data
|
||||
)
|
||||
if not os.path.isfile(shelf_set_os_filepath):
|
||||
log.error("Shelf path doesn't exist - "
|
||||
"{}".format(shelf_set_os_filepath))
|
||||
continue
|
||||
|
||||
hou.shelves.loadFile(shelf_set_os_filepath)
|
||||
continue
|
||||
|
||||
shelf_set_name = shelf_set_config.get('shelf_set_name')
|
||||
if not shelf_set_name:
|
||||
|
|
|
|||
|
|
@ -15,11 +15,18 @@
|
|||
"label": "Add a .shelf file",
|
||||
"children": [
|
||||
{
|
||||
"type": "path",
|
||||
"key": "shelf_set_source_path",
|
||||
"label": "Shelf Set Path",
|
||||
"multipath": false,
|
||||
"multiplatform": true
|
||||
"type": "dict",
|
||||
"key": "add_shelf_file",
|
||||
"label": "Add a .shelf file",
|
||||
"children": [
|
||||
{
|
||||
"type": "path",
|
||||
"key": "shelf_set_source_path",
|
||||
"label": "Shelf Set Path",
|
||||
"multipath": false,
|
||||
"multiplatform": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -28,60 +35,67 @@
|
|||
"label": "Add Shelf Set Name and Shelves Definitions",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"key": "shelf_set_name",
|
||||
"label": "Shelf Set Name"
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"key": "shelf_definition",
|
||||
"label": "Shelves Definitions",
|
||||
"use_label_wrap": true,
|
||||
"object_type": {
|
||||
"type": "dict",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"key": "shelf_name",
|
||||
"label": "Shelf Name"
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"key": "tools_list",
|
||||
"label": "Tools",
|
||||
"use_label_wrap": true,
|
||||
"object_type": {
|
||||
"type": "dict",
|
||||
"children": [
|
||||
{
|
||||
"type": "label",
|
||||
"label": "Name and Script Path are mandatory."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"key": "label",
|
||||
"label": "Name"
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"key": "script",
|
||||
"label": "Script"
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"key": "icon",
|
||||
"label": "Icon"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"key": "help",
|
||||
"label": "Help"
|
||||
"key": "add_set_and_definitions",
|
||||
"label": "Add Shelf Set Name and Shelves Definitions",
|
||||
"type": "dict",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"key": "shelf_set_name",
|
||||
"label": "Shelf Set Name"
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"key": "shelf_definition",
|
||||
"label": "Shelves Definitions",
|
||||
"use_label_wrap": true,
|
||||
"object_type": {
|
||||
"type": "dict",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"key": "shelf_name",
|
||||
"label": "Shelf Name"
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"key": "tools_list",
|
||||
"label": "Tools",
|
||||
"use_label_wrap": true,
|
||||
"object_type": {
|
||||
"type": "dict",
|
||||
"children": [
|
||||
{
|
||||
"type": "label",
|
||||
"label": "Name and Script Path are mandatory."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"key": "label",
|
||||
"label": "Name"
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"key": "script",
|
||||
"label": "Script"
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"key": "icon",
|
||||
"label": "Icon"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"key": "help",
|
||||
"label": "Help"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class AddShelfFileModel(BaseSettingsModel):
|
|||
|
||||
|
||||
class AddSetAndDefinitionsModel(BaseSettingsModel):
|
||||
shelf_set_name: str = Field(title="Shelf Set Name")
|
||||
shelf_set_name: str = Field("", title="Shelf Set Name")
|
||||
shelf_definition: list[ShelfDefinitionModel] = Field(
|
||||
default_factory=list,
|
||||
title="Shelves Definitions"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue