ynput / ayon-core

Apache License 2.0
31 stars 36 forks source link

Houdini: Workfile creator fix call to `create_context_node` on create #506

Closed BigRoy closed 5 months ago

BigRoy commented 6 months ago

Changelog Description

Fix call to create_context_node on create.

Additional info

The method only exists on the houdini host - not on the plugin itself.

Note that it would actually never error currently because apparently this gets called just beforehand elsewhere: https://github.com/ynput/ayon-core/blob/57d225009293a3123f02fd2b48e4e38948e0f711/client/ayon_core/hosts/houdini/api/pipeline.py#L176-L178

Which in itself, also generates the node. But at least this fixes the broken code were the issue to arise that the node did not exist at that point in time.

I'd actually want to refactor HoudiniHost.get_context_data() to not create a node unless it were 'updating' data. Because now even on querying data it creates a node - which to me feels like the wrong point in time to do so.

Testing notes:

Publishing should work.

MustafaJafar commented 6 months ago

A question that might be irrelevant to this PR: When should create_context_node() be called ? tbh, I thought it's part of Installing AYON...

I add a stupid print statement inside it to find out when this method is triggered ? I found out that:

When it's not called

When it's called


I think I can now understand your comment:

Note that it would actually never error currently because apparently this gets called just beforehand elsewhere: https://github.com/ynput/ayon-core/blob/57d225009293a3123f02fd2b48e4e38948e0f711/client/ayon_core/hosts/houdini/api/pipeline.py#L176-L178

Which in itself, also generates the node. But at least this fixes the broken code were the issue to arise that the node did not exist at that point in time.

The only way to show the error is by adding

hou.node(CONTEXT_CONTAINER).destroy()

between these two lines https://github.com/ynput/ayon-core/blob/0e4e845407d9f0c425b392d3f454dd5866b819b5/client/ayon_core/hosts/houdini/plugins/create/create_workfile.py#L97-L98