ynput / ayon-houdini

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

Load LOPs: Support update via context options (replace parm callbacks with expressions) #112

Closed BigRoy closed 3 weeks ago

BigRoy commented 1 month ago

Changelog Description

Replace the Load LOPs parm callbacks with expressions on the file parms to support Solaris Context Options.

Additional info

With this PR, the LOP load nodes now LIVE update based on context options. Meaning, using context-options you can now easily do multi-shot lighting!

Fixes: https://github.com/ynput/ayon-houdini/issues/111

https://github.com/user-attachments/assets/a3807f41-eb24-4da9-94b9-1a88fca840db

Credit: Audio snippet in the background at the beginning is a few seconds of the start from this Youtube video

TODO

Testing notes:

  1. [x] Load Asset LOP should work consistently
  2. [x] Load Shot LOP should work consistently
  3. [x] Both should NOT be super slow
  4. [x] When using Solaris Context Options the loader should update along live.
    • [x] even with Edit Context Options LOP updates should be live
BigRoy commented 1 month ago

Should we care about these warnings ?

Yes, we should! I thought I had fixed that already but maybe I forgot to push. Will continue with this.

Will also need to decide what to do with the thumbnails. Before this PR it was created to "auto-update" on context update (but especially now with those being expressions that makes even less sense.) Mark from SideFX says it best:

You should really not be "doing things" as a result of evaluating expressions.

So I guess for now the easiest way is to remove how it's "live" and then just add a "Update thumbnail" button. We can think of better fixes down the line.

MustafaJafar commented 1 month ago

Isn't this cool! I published three products pointcacherock_1, pointcacherock_2 and pointcacherock_3 and loading them inside a loop works! (as loops are based on context options)

Note: I don't know if my example here is favorite in production. tbh, I don't know what is the best way to publish multiple variants of my pointcache products. maybe it's the correct workflow since different variants of an AYON product are just different AYON products.

image

BigRoy commented 3 weeks ago

@MustafaJafar could you give it one last test-drive?

MustafaJafar commented 3 weeks ago

on my side,

BigRoy commented 3 weeks ago

Update thumbnail is buggy, to make it reliable, I need to trigger reload every time before clicking update thumbnail.

Correct, update thumbnail is intentionally not live - since expressions should not be allowed to edit the graph aside of the return value from the expression.

As such, @MustafaJafar I suppose everything works? :)

MustafaJafar commented 3 weeks ago

Correct, update thumbnail is intentionally not live - since expressions should not be allowed to edit the graph aside of the return value from the expression.

yes, but I've to click two button to actually update the thumbnail.

BigRoy commented 3 weeks ago

yes, but I've to click two button to actually update the thumbnail.

Ah I see now. It's even weider because the representation id on that node doesn't seem to update? Nor does the filepath in the parameter window? (even though it does update in the view).

I guess it has to do with how Houdini applies "Context Options" only in a certain context of the display viewer which isn't necessarily the attribute visually shown in the parameter window and evaluated from node.evalParm() or alike.

As such, this may be something that'd be hard to support regardless (to update the thumbnail correctly based on what you're displaying in the graph currently). I wouldn't bother for now.

Let's merge.