mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #5844 from ynput/bugfix/OP-6837_Houdini-Shelves-Manager-Shelf-is-not-add-to-the-given-shelf-set
This commit is contained in:
commit
28e9bf2493
4 changed files with 147 additions and 84 deletions
|
|
@ -24,29 +24,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_with_asset_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.newShelfSet(file_path=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:
|
||||
|
|
|
|||
|
|
@ -5,70 +5,99 @@
|
|||
"is_group": true,
|
||||
"use_label_wrap": true,
|
||||
"object_type": {
|
||||
"type": "dict",
|
||||
"children": [
|
||||
"type": "dict-conditional",
|
||||
"enum_key": "options",
|
||||
"enum_label": "Options",
|
||||
"enum_children": [
|
||||
{
|
||||
"type": "text",
|
||||
"key": "shelf_set_name",
|
||||
"label": "Shelf Set Name"
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"key": "shelf_set_source_path",
|
||||
"label": "Shelf Set Path (optional)",
|
||||
"multipath": false,
|
||||
"multiplatform": true
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"key": "shelf_definition",
|
||||
"label": "Shelves",
|
||||
"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_shelf_file",
|
||||
"label": "Add a .shelf file",
|
||||
"children": [
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "add_set_and_definitions",
|
||||
"label": "Add Shelf Set Name and Shelves Definitions",
|
||||
"children": [
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,16 +22,46 @@ class ShelfDefinitionModel(BaseSettingsModel):
|
|||
)
|
||||
|
||||
|
||||
class ShelvesModel(BaseSettingsModel):
|
||||
_layout = "expanded"
|
||||
shelf_set_name: str = Field("", title="Shelfs set name")
|
||||
|
||||
class AddShelfFileModel(BaseSettingsModel):
|
||||
shelf_set_source_path: MultiplatformPathModel = Field(
|
||||
default_factory=MultiplatformPathModel,
|
||||
title="Shelf Set Path (optional)"
|
||||
title="Shelf Set Path"
|
||||
)
|
||||
|
||||
|
||||
class AddSetAndDefinitionsModel(BaseSettingsModel):
|
||||
shelf_set_name: str = Field("", title="Shelf Set Name")
|
||||
shelf_definition: list[ShelfDefinitionModel] = Field(
|
||||
default_factory=list,
|
||||
title="Shelf Definitions"
|
||||
title="Shelves Definitions"
|
||||
)
|
||||
|
||||
|
||||
def shelves_enum_options():
|
||||
return [
|
||||
{
|
||||
"value": "add_shelf_file",
|
||||
"label": "Add a .shelf file"
|
||||
},
|
||||
{
|
||||
"value": "add_set_and_definitions",
|
||||
"label": "Add Shelf Set Name and Shelves Definitions"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
class ShelvesModel(BaseSettingsModel):
|
||||
options: str = Field(
|
||||
title="Options",
|
||||
description="Switch between shelves manager options",
|
||||
enum_resolver=shelves_enum_options,
|
||||
conditionalEnum=True
|
||||
)
|
||||
add_shelf_file: AddShelfFileModel = Field(
|
||||
title="Add a .shelf file",
|
||||
default_factory=AddShelfFileModel
|
||||
)
|
||||
add_set_and_definitions: AddSetAndDefinitionsModel = Field(
|
||||
title="Add Shelf Set Name and Shelves Definitions",
|
||||
default_factory=AddSetAndDefinitionsModel
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.2.6"
|
||||
__version__ = "0.2.7"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue