Skip to content

Commit

Permalink
Merge pull request #28 from BigRoy/enhancement/load_asset_lop_product…
Browse files Browse the repository at this point in the history
…_types

Load Asset LOP: Allow setting product type filters
  • Loading branch information
BigRoy authored Jul 11, 2024
2 parents a41dd9a + 725231a commit 701d46c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
15 changes: 13 additions & 2 deletions client/ayon_houdini/api/hda_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ def update_info(node, context):
if node.evalParm(key) != value}
parms["load_message"] = "" # clear any warnings/errors

# Update the product type filter to match the type
current = node.evalParm("product_type")
product_type = context["product"]["productType"]
if current and current != product_type:
# If current is empty we consider no filtering applied and we allow
# that to be a state that needs no switching
parms["product_type"] = product_type

# Note that these never trigger any parm callbacks since we do not
# trigger the `parm.pressButton` and programmatically setting values
# in Houdini does not trigger callbacks automatically
Expand Down Expand Up @@ -569,13 +577,16 @@ def get_available_products(node):
if not folder_entity:
return []

# Apply filter only if any value is set
product_types = [product_type] if product_type else None

products = ayon_api.get_products(
project_name,
folder_ids=[folder_entity["id"]],
product_types=[product_type]
product_types=product_types
)

return [product["name"] for product in products]
return list(sorted(product["name"] for product in products))


def set_to_latest_version(node):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
name ayon::lop_import::1.0
script load_asset::1.0
label "Load Asset"
label "AYON Load Asset"

help {
""
Expand Down Expand Up @@ -52,6 +52,14 @@
label "Product Type"
type string
default { "usd" }
menu {
"" "*"
"animation" "animation"
"camera" "camera"
"model" "model"
"pointcache" "pointcache"
"usd" "usd"
}
}
parm {
name "product_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ node = kwargs["node"]
hda_module = node.hdaModule()
hda_module.setup_flag_changed_callback(node)

node.parm("product_type").lock(True)
node.parm("file").lock(True)

0 comments on commit 701d46c

Please sign in to comment.