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

Fix Load Asset LOP and Load Shot LOP (but better?) #161

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

BigRoy
Copy link
Contributor

@BigRoy BigRoy commented Nov 5, 2024

Changelog Description

Fix old LOP loaders missing the file/representation parm expressions due to having explicit attribute value overrides

Additional review information

Before the loaders used explicit parm callbacks to set the filepath and representation id on the nodes. As such, these attributes had "overrides" from their default values - lacking the default expressions. This PR, ensures those parameter expressions are 'reverted' on update.

This will fix through the scene inventory, if e.g. the user broke it actively and then trigger UPDATE once via the loader itself to get the support for changing versions on the nodes directly again.

However, it also fixes existing loaders on scene open.

Testing notes:

Either:

  1. Set up Load Asset LOP or Load Shot LOP
  2. Explicitly break the file or representation parm expressions.

Or:

  1. Open a legacy scene with loaders from before the change to expressions PR

Then:

  1. Update via scene inventory

The node should be updated.

…due to having explicit attribute value overrides
@BigRoy BigRoy added the type: bug Something isn't working label Nov 5, 2024
@BigRoy BigRoy self-assigned this Nov 5, 2024
@BigRoy BigRoy force-pushed the bugfix/lop_loaders_ensure_expressions branch from be0b962 to 7528b16 Compare November 5, 2024 15:23
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 works when restarting my houdini session. (I can open the workfile tool and reopen the same opened file)
also, when updating (e.g. set version) from scene manager.
it's worth mentioning that scene manager thing won't work when using the loader to load products from other projects.
image
I was going to suggest having an inventory action, but reopening the scene is much easier for me than triggering an inventory action.

inventory action
from ayon_core.pipeline import InventoryAction
from ayon_houdini.api.hda_utils import ensure_loader_expression_parm_defaults


class SetDefaultParms(InventoryAction):

    label = "Set Default Parms"
    icon = "wrench"
    color = "orange"

    @staticmethod
    def is_compatible(container):
        return (
            container.get("loader") in {
                "LOPLoadAssetLoader",
                "FilePathLoader",
                "LOPLoadShotLoader"
            }
        )

    def process(self, containers):
        for container in containers:
            node = container["node"]
            ensure_loader_expression_parm_defaults(node)

image

@BigRoy BigRoy merged commit fa569a7 into ynput:develop Nov 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants