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

GraphComponent : Allow : in names #5382

Merged
merged 5 commits into from
Jul 12, 2023
Merged

Conversation

johnhaddon
Copy link
Member

For some upcoming UsdLux work we need to be able to create plugs representing UsdLuxLight parameters, some of which have : in their names (e.g. shaping:focus). Rather than introduce some mangling scheme to squeeze that past Gaffer's existing naming restrictions, it's simpler to lift our restrictions. The history of this is that before Gaffer was even in its infancy, I was using node.plugName syntax in Python to access plugs, but soon grew tired of avoiding Python keywords in plug names, and adopted the node["plugName"] syntax we use now. The naming restrictions were needed for the original syntax, but there's no need for them any more.

After loosening the naming, I went looking for places we had previously mangled names, intending to remove the mangling. But it turned out that in those cases it was better to give the plugs more generic names anyway. So that's what I've done in the subsequent commits.

@johnhaddon johnhaddon requested a review from ericmehl July 6, 2023 11:18
@johnhaddon johnhaddon self-assigned this Jul 6, 2023
Copy link
Collaborator

@ericmehl ericmehl left a comment

Choose a reason for hiding this comment

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

LGTM, just a changes.md update needed to merge.

The immediate motivation for this is to allow the creation of plugs representing UsdLuxLight input names. As the pre-existing comment above `validName()` says, there may be a good case for lifting almost all restrictions, but for now I'm just making the conservatively minimal change needed for the current task.
We were comparing the query plug names against the option name we wanted to query. But the plug names are just `query0`, `query1` etc, so the comparison is meaningless. In fact, the `plugName` argument to `__addQuery` had no affect on the outcome of the function, so I've simply removed it, and the code that was trying to sanitise names by replacing `:` with `_`.

I ran into this while looking for places that were avoiding `:` in plug names, since we allow that now anyway.
The user can change the value of the `name` plug after creating the tweak, so it's better to just use a generic name rather than something than can get out of sync.
The user can change the value of the `name` plug later, after which things would be out of sync.
The `name` being passed to `__addTweak()` is always empty, so we never hit the original naming code, and ended up with the first plug being called `tweak` and the second being called `tweak1`. Starting with `tweak0` matches us up with the other tweaks nodes.
@johnhaddon
Copy link
Member Author

Thanks Eric, I've rebased to fix the merge conflict and am merging now.

@johnhaddon johnhaddon merged commit 0044001 into GafferHQ:main Jul 12, 2023
4 checks passed
@johnhaddon johnhaddon deleted the colonsInNames branch July 18, 2023 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants