ynput / ayon-houdini

Houdini addon for AYON
Apache License 2.0
11 stars 9 forks source link

Houdini: Loading HDAs from tab menu #9

Open MustafaJafar opened 6 months ago

MustafaJafar commented 6 months ago

Is there an existing issue for this?

Current Behavior:

By default Houdini doesn't install the published HDAs until a user load them from load tool. When an HDA is installed, it becomes available to be loaded via TAB menu. HDAs loaded from TAB menu are not tracked by the load tool.

Problem 1: inventory tool tells the wrong count.

Also, removing the instances from the inventory tool, doesn't uninstall the HDA. Which means I can still able to create as much as HDAs and inventory tool won't know.

But tbh, when updating the definition of an HDA. it's set in the Houdini session for this node type. which means Houdini will automatically update any instance of that node. which also means that count table should be grayed out because updating one instance will also update all the instances (Houdini default).

Problem 2: updating one HDA instance updates all the HDAs because we are updating the HDA definition. So, we need that limitation to be visible in the inventory tool.

Expected Behavior:

Personally, I expect :

  1. Created HDAs via TAB menu should also created AYON extra attributes
  2. Inventory tool should disable actions per instance children. image

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

In Houdini: Problem 1: inventory tool tells the wrong count.

  1. Publish an HDA product
  2. Load that HDA
  3. Crete that HDA from TAB menu
  4. open inventory tool, you'll find count is one.

Problem 2: updating one HDA instance updates all the HDAs because we are updating the HDA definition. So, we need that limitation to be visible in the inventory tool.

  1. Publish multiple versions of an HDA product
  2. Load that HDA multiple times
  3. Set version for one instance
  4. You'll find all the HDAs are updated because we are updating the node definition itself.

[!NOTE]
You'll find all the HDAs are updated even though the inventory tool will detect a wrong version for them (It's the same as https://github.com/ynput/ayon-houdini/issues/12)

Are there any labels you wish to add?

Relevant log output:

No response

Additional context:

No response

[cuID:AY-5262]

BigRoy commented 4 months ago

Problem 1: inventory tool tells the wrong count.

Also, removing the instances from the inventory tool, doesn't uninstall the HDA. Which means I can still able to create as much as HDAs and inventory tool won't know.

This could be solved by ON publish and saving of the HDA secretly imprint it with the parms needed for the containerization (like give it the representation id, etc.) so that if you just create it - it has those attributes.

MustafaJafar commented 1 week ago

So, I found a solution for this one.

We can programmatically add a onCreated script. (we only to run this code once, maybe we can add it to the HDA Creator plugin.) here's a snippet:

import hou

hda_node = hou.node('/obj/AVALON_CONTAINERS/SOPS/hou_hdas_hou_hdas_Test_1')
hda_def = hda_node.type().definition()

hda_def.addSection(
    "OnCreated",
"""
print("Hey, I exist. Say my name:",  kwargs['node'])
"""
    )
hda_def.setExtraFileOption("OnCreated/IsPython", True)

and in that onCreated script we add some logic to add the necessary AYON parameters, it will replace this logic in the loader.

Image

I'd recommend to use generic code in the onCreated script so that artists are free to use the HDA outside of AYON.