Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Houdini: Implement Load Asset LOP HDA #294

Merged
merged 70 commits into from
Jun 28, 2024

Conversation

BigRoy
Copy link
Collaborator

@BigRoy BigRoy commented Mar 27, 2024

Changelog Description

Implements a LOPs (Solaris / USD) asset loader to reference or payload in files into the Solaris stage.

  • Has separate parms for project_name, folder_path, product_name, version and representation that describe which product to load. Changing any of those parms will trigger an update to load that particular version, as such - you can dynamically drive these using any way Houdini allows you to, e.g. the project name and folder default to respectively $AYON_PROJECT_NAME and $AYON_FOLDER_PATH representing the project and folder of your current context.
  • Has parms and functionality to automatically attach a 'version' thumbnail if the version entity being loaded has one. Disabled by default but can be enabled, resized, etc. per node.

Additional info

image

This is a further enhancement from this OpenPype PR ynput/OpenPype#5831
Some of that can also be seen in the presentation I gave at the Ynput Summit 2024 here.

We have actually used an OpenPype-equivalent in production. Nonetheless I still expect many bugs (and feature requests) so input is greatly welcomed. I'm inviting you to break it and provide feedback. Also provide screen recordings if you get stuck so we can see how "other users" try to use it. @fabiaserra @MustafaJafar @moonyuet @antirotor you are cordially invited.

I did a pretty quick refactor to AYON, so testing is greatly appreciated! :)


Other visual reference of a 'similar' implementation by @fabiaserra here.

Testing notes:

  1. Load and manage USD assets via the Load Asset LOP (and should also work via the manager)

@BigRoy BigRoy requested a review from antirotor March 27, 2024 19:08
@ynbot ynbot added size/M host: Houdini type: enhancement Improvement of existing functionality or minor addition labels Mar 27, 2024
@BigRoy
Copy link
Collaborator Author

BigRoy commented Mar 27, 2024

@iLLiCiTiT this also uses some logic to store a temporary thumbnail alongside the scene so that Houdini can display it - in the screenshot with the PR for example the checkerboard image above the node bottom right. There may be much better ways, but for now I just wanted to highlight this uses some version thumbnails logic from ayon_api.

@MustafaJafar MustafaJafar added community Issues and PRs coming from the community members USD Any USD related PR or issue labels Mar 28, 2024
Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to make these changes on my side to make it work.

Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two suggestions to make this HDA more fun.

  1. A button to select folder path (which is the same as the button in the publisher UI)
    This logic works on my side.
"""Select a folder path."""
from ayon_core.pipeline import get_current_project_name
from ayon_core.tools.publisher.widgets.folders_dialog import FoldersDialog
from ayon_core.tools.utils.host_tools import get_tool_by_name
from ayon_core.hosts.houdini.api.lib import get_main_window


project_name = get_current_project_name()

main_window = get_main_window()
publisher_window = get_tool_by_name( tool_name="publisher", parent=main_window)

dialog = FoldersDialog(publisher_window.controller, main_window)
dialog.exec_()

selected_folder_path = dialog.get_selected_folder_path()

print ("asset name:", selected_folder_path)
  1. A button to select a USD product name.
    This snippet works. it gets a list of usd products within a particular folderpath
import ayon_api

project_name = "Robo"
folder_path = "/Assets/Character/bigrobo"
my_product_type = "usd"


id_only = ["id"]
folder_entity = ayon_api.get_folder_by_path(project_name,
                                            folder_path,
                                            fields=id_only)
my_folder_id = folder_entity["id"]

my_usd_products = ayon_api.get_products(
    project_name,
    folder_ids = [my_folder_id],
    product_types = [my_product_type]
    
)

print(list(map(lambda p: p["name"], my_usd_products)))

irrelevant to this PR.

  1. I think adding a product type selector in the HDA can be used to enhance the previous code snippet. which can be a starting point to have a generic loader. where the digital asset acts as a container and nodes inside it are created based on the data in each loader.
    I'm not sure if I rephrased it correctly. but, I hope you get me.

@BigRoy
Copy link
Collaborator Author

BigRoy commented Mar 28, 2024

I have two suggestions to make this HDA more fun.

Yes, please. I'd love there to be buttons that show a mini-list dialog to pick from. Feel free to make a PR to my branch with those features. it'd be greatly appreciated 😍 - I looked into it in OpenPype but the dialogs then weren't to trivial to hijack into but if you have a good hack for AYON, go for it!

Would you be able to contribute?

It would be a major help for this loader HDA tooling anywhere in Houdini. :)

I had to make these changes on my side to make it work.

Interesting, seems like I might have missed pushing a few commits - because it did work for me.

@MustafaJafar
Copy link
Contributor

Would you be able to contribute?

I was born ready to contribute 🤓..
Hopefully, tomorrow I'll tinker around it.

Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super cool and it works.

I didn't test some of its features : thumbnails (I don't have products with thumbnails) and load options (look fine as it's just straight forward copied parameters).

…t_representation(node, repre_id): in order to avoide error shadowing
Copy link

@Lypsolon Lypsolon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some things I found.

Sorry for the one commit I made; I will leave it as comments from now on.

Also, I have one question in case you tested it. In the on_save() function in pipline.py, there is a call to a function that apparently only exists in the Maya lib.py, and it errors on save. I'm not sure if it does that for you, too.

Lovely stuff btw.

client/ayon_core/hosts/houdini/api/hda_utils.py Outdated Show resolved Hide resolved
client/ayon_core/hosts/houdini/api/hda_utils.py Outdated Show resolved Hide resolved
client/ayon_core/hosts/houdini/api/lib.py Outdated Show resolved Hide resolved
client/ayon_core/hosts/houdini/api/hda_utils.py Outdated Show resolved Hide resolved
@MustafaJafar MustafaJafar self-requested a review June 27, 2024 18:32
Copy link
Member

@moonyuet moonyuet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully in Houdini 19.5

@MustafaJafar MustafaJafar removed the community Issues and PRs coming from the community members label Jun 28, 2024
@MustafaJafar
Copy link
Contributor

It is so cool!
Animation_81

@BigRoy
Copy link
Collaborator Author

BigRoy commented Jun 28, 2024

Sorry @moonyuet @MustafaJafar I accidentally re-requested the review on the wrong PR.

Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working as cool as before

@MustafaJafar
Copy link
Contributor

@moonyuet @BigRoy any last words before merge ?

@moonyuet
Copy link
Member

@moonyuet @BigRoy any last words before merge ?

no, it can be merged.

@MustafaJafar MustafaJafar merged commit f87bd08 into ynput:develop Jun 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host: Houdini size/M type: enhancement Improvement of existing functionality or minor addition USD Any USD related PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants