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: Sync publisher attributes with node parameters #418

Conversation

MustafaJafar
Copy link
Contributor

@MustafaJafar MustafaJafar commented Apr 15, 2024

Changelog Description

Use Houdini node parameters as the source of truth while using metadata as temp values.
This PR adds two methods to creator class which sync the attributes in the publisher to Houdini nodes.

  1. update_node_parameters update node parameters according the metadata (user preference in the publish tab.) It's triggered when user click save button in publisher
  2. read_node_data update metadata according to the node parameters. It's triggered when user click refresh button in publisher

Things left: check these product types:

Product Type update_node_parameters read_node_data
Camera (Abc)
Arnold ASS
Arnold ROP
PointCache (Bgeo)
Composite (Image Sequence)
Houdini Digital Asset (Hda)
Karma ROP
Mantra IFD
Mantra ROP
PointCache (Abc)
Redshift Proxy
Redshift ROP
Review
Static Mesh (FBX)
VDB Cache
VRay ROP
USD (experimental)

Demo

2024-04-18.22-46-38.mp4

Testing notes:

  1. Open Houdini
  2. Create instances
  3. In publish tab, change some options and hit save button (you should find out that node parameters are synced with the selected options in the publisher)
  4. Change the dedicated nodes parameters and hit refresh (you should find out the publisher is synced to the node)

@MustafaJafar MustafaJafar marked this pull request as draft April 15, 2024 16:17
@ynbot ynbot added size/S type: enhancement Improvement of existing functionality or minor addition labels Apr 15, 2024
@MustafaJafar MustafaJafar linked an issue Apr 15, 2024 that may be closed by this pull request
2 tasks
@moonyuet
Copy link
Member

moonyuet commented Apr 17, 2024

Is there any reason why to touch the update_instances function to update Houdini node parameters on creator attributes change? Are you trying to align the setting in create tab to the one in publish tab in the publisher UI as the goal of this PR?
If that is the case, there are some workarounds already done in create_review in Max host and create_textureSet in Substance Painter host to deal with the setting sync in between the create tab and the publish tab. You dont need to touch the update_instances function.

creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
for key in ["imageFormat",
"keepImages",
"review_width",
"review_height",
"percentSize",
"visualStyleMode",
"viewportPreset",
"antialiasingQuality",
"vpTexture"]:
if key in pre_create_data:
creator_attributes[key] = pre_create_data[key]

creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
for key in [
"exportPresetUrl",
"exportFileFormat",
"exportSize",
"exportPadding",
"exportDilationDistance"
]:
if key in pre_create_data:
creator_attributes[key] = pre_create_data[key]

@MustafaJafar
Copy link
Contributor Author

Is there any reason why to touch the update_instances function to update Houdini node parameters on creator attributes change? Are you trying to align the setting in create tab to the one in publish tab in the publisher UI as the goal of this PR?

No, not really.
I made a quick demo to show what this PR does.

2024-04-18.17-38-29.mp4

I find it confusing..
Maybe, we should be more careful about using get_instance_attr_defs

@MustafaJafar MustafaJafar requested a review from BigRoy April 18, 2024 17:35
@MustafaJafar
Copy link
Contributor Author

After some overthinking here's another demo where Houdini parameters are used as the single source of truth.
metadata are used to connect the Houdini parameters to the publisher.

  • update_node_parameters is used to update the node's parameters according to the value of the creator_attributes (should it be more generic IDK but in the creator plugin we only use creator_attributes)
  • read_node_data which has the inverted logic of the previous method. the data return from this method will override ayon parameters.
2024-04-18.22-46-38.mp4

@moonyuet
Copy link
Member

After some overthinking here's another demo where Houdini parameters are used as the single source of truth. metadata are used to connect the Houdini parameters to the publisher.

  • update_node_parameters is used to update the node's parameters according to the value of the creator_attributes (should it be more generic IDK but in the creator plugin we only use creator_attributes)
  • read_node_data which has the inverted logic of the previous method. the data return from this method will override ayon parameters.

2024-04-18.22-46-38.mp4

I can see why now. If you talk about updating the creator_attributes parameters on the instance nodes generated by the creator, the latest commit on the adjustment on update_instances function does make sense as the goal of Houdini development (which allows more customizations by the user)

@MustafaJafar MustafaJafar changed the title Houdini: update node parameters on creator attributes change. Houdini: Sync publisher attributes with node parameters Apr 19, 2024
@MustafaJafar
Copy link
Contributor Author

MustafaJafar commented May 10, 2024

I found some case that doesn't work with this PR.
e.g.
when I change an attribute in the publisher and click save (it updates the Houdini node correctly)
Then I revert the changes in the Houdini while keeping the publisher as it's
Then I click again the publisher to apply the changes inside it to the node (but, there are no changes so, it won't update the node)

Because there are no changes, the save button won't even work so in this particular case, the method that's used to update the Houdini nodes won't be even called. so the node and publisher attributes will be out of sync.

2024-05-10.21-53-37.mp4

@BigRoy
Copy link
Collaborator

BigRoy commented May 10, 2024

I found some case that doesn't work with this PR. e.g. when I change an attribute in the publisher and click save (it updates the Houdini node correctly) Then I revert the changes in the Houdini while keeping the publisher as it's Then I click again the publisher to apply the changes inside it to the node (but, there are no changes so, it won't update the node)

Because there are no changes, the save button won't even work so in this particular case, the method that's used to update the Houdini nodes won't be even called. so the node and publisher attributes will be out of sync.
2024-05-10.21-53-37.mp4

At this stage, I'd say it's expected. If you after "reset" or refresh or save start tweaking stuff inside the Houdini scene without resetting/refreshing again then that'd be user error and should not be an "allowed workflow".

However, changing something in Houdini and then clicking "reset" should actually detect the new values preferably.

@MustafaJafar
Copy link
Contributor Author

If you after "reset" or refresh or save start tweaking stuff inside the Houdini scene without resetting/refreshing again then that'd be user error and should not be an "allowed workflow".

But, in this case, Should the validators tell if publish attributes and Houdini node parameters are not in sync ?
The validators won't need to provide/offer any repair actions because the publisher attributes and node parameters will be in sync again once the publisher tool resets.

For reference, in the above screen record, the redshift node will be published with split export and farm disabled even though it's enabled in the publisher attributes. (as the node is the source of truth)
or we can just ignore that as the node is the only source of truth in this PR!

However, changing something in Houdini and then clicking "reset" should actually detect the new values preferably.

This is the current state of this PR.

@antirotor
Copy link
Member

Well, you're right that in ideal world, you would have a set of validators checking that those options are in sync - but imho it is lot of work to catch all reliably. Maybe it is enough to check state of the scene, compare checksums of the state before and after - but even that cannot be done 100% reliable. To make it work, you would need to track every individual option in houdini nodes affecting the current publishing process. If this can be done easily, I am completely for it - maybe there are some events we can bind to - something like "on scene change display visual warning that publisher UI can be outdated - but I think this is adding more complexity then there are gains from it. For me it is enough to clearly document how it behaves.

@MustafaJafar
Copy link
Contributor Author

Closing this PR as it adds more complexity then there are gains from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host: Houdini size/S type: enhancement Improvement of existing functionality or minor addition
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Houdini: Update node parameters when creator attributes change
6 participants