Skip to content

Reuse check inventory versions for loader colors - #278

Closed
vincentullmann wants to merge 16 commits into
ynput:developfrom
straylondon:reuse_check_inventory_versions_for_loader_colors
Closed

Reuse check inventory versions for loader colors#278
vincentullmann wants to merge 16 commits into
ynput:developfrom
straylondon:reuse_check_inventory_versions_for_loader_colors

Conversation

@vincentullmann

Copy link
Copy Markdown
Contributor

Changelog Description

refactor the tile_color logic to be shared between loaders. Updated the check_inventory_versions to use the same logic as the loader for consistent color coding

Additional review information

before:

  • each Loader re-implements the is_latest checks to update the node colors
  • check_inventory_versions runs on scriptSave and uses its own logic and own color values to update the node colors
  • loading an older version of a product incorrectly used the latest color

after:

  • plugin.NukeLoader.get_node_colors returns a map of "container_status/categories" to colors
    • those values can be overwritten either by setting the respective node_color_<status> variables on the LoaderClass
    • or by overwriting get_node_colors and return different values
  • plugin.NukeLoader.update_node_color(self, node) a helper method to update the tile color for a given node. Loaders should use this on load and update
  • check_inventory_versions now uses the colors defined by each containers get_node_colors

Todo:

  • so far I've only updated the LoadClip and LoadImage loaders as examples. If the general approach is approved I'm happy to roll out the updates to other loaders too.

Testing notes:

  1. import a product using the LoadClip or LoadImage loader
  2. => confirm that the correct color (latest) was used
  3. change the version to an older one
  4. => confirm that the correct color was used (outdated color)
  5. change it back to latest
  6. => confirm that the correct color (latest) was used
  7. load a outdated version of a product
  8. => confirm that the correct color was used (outdated color)
  9. save the workfile (this should trigger the onScriptSave callback: check_inventory_versions
  10. confirm that all nodes have the correct colors

@BigRoy
BigRoy requested a review from jakubjezek001 June 29, 2026 09:49
@BigRoy BigRoy added type: enhancement Improvement of existing functionality or minor addition sponsored This is directly sponsored by a client or community member labels Jun 29, 2026
Comment thread client/ayon_nuke/api/plugin.py Outdated
Comment thread client/ayon_nuke/api/plugin.py Outdated
Comment thread client/ayon_nuke/api/plugin.py Outdated
@BigRoy

BigRoy commented Jul 2, 2026

Copy link
Copy Markdown
Member

@vincentullmann can you resolve the linter issues?

Comment on lines +634 to +637
node_color_invalid = color_to_int(255, 0, 0) # 0xff0000ff
node_color_not_found = color_to_int(255, 255, 0) # 0xffff00ff
node_color_latest = color_to_int(78, 205, 37) # 0x4ecd25ff
node_color_outdated = color_to_int(216, 79, 32) # 0xd84f20ff

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@BigRoy @vincentullmann Guess it might be good idea to put it into the addon settings and users can customize their own colors for these nodes?

@vincentullmann vincentullmann Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, I like the idea.

On that note: When I was going trough each loader and updating the logic I noticed that, the defaults I've picked based on LoadCLip get overwritten often by the same colors.

here is a table showing what colors are currently being used:

Loader invalid not_found latest outdated
NukeLoader
LoadClip default default default default
LoadImage default default default default
LinkAsGroup default default
AlembicModelLoader default default
GeoImportLoader default default
GeoReferenceLoader default default
LoadOcioLookNodes default default
AlembicCameraLoader default default
FbxCameraLoader default default
UsdCameraLoader default default

This raises the questions:

  • a) Should each loader have their own server settings?
  • b) or should we unify the colors? eg.: latest always and outdated always ?
  • c) or group them up and give each group a set of server settings?
    for example
    • 2D Nodes (Clip, Image)
    • Model and Geo
    • *CameraLoaders
    • not sure where LinkAsGroup and LoadOcioLookNodes would fit in

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note on b):
If we unify the colors, we could simplify the code as well. Currently there is some work done to allow each loader to define its own colors, which would be unnecessary, if we'd pick that option

@BigRoy BigRoy Jul 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If there's need for c) then I think we should go for a) and allow customizing all separately.
If no need to differentiate between each, I think b) is the best option.

My vote would go for b) but one may like to change to 3d nodes to a different color from the read nodes (especially in the case of not-outdated) which would require a). I don't have Nuke experience so hard to tell what a user would prefer there. @jakubjezek001 @rdelillo preferences?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The updated inventory-coloring path can break when loaders don’t implement get_node_color, a precomp latest color value appears incorrect, and USD camera load no longer sets the prim path on initial load.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors node tile-coloring for loaded containers so both individual loaders and check_inventory_versions use a shared, loader-driven color mapping based on container version status (latest/outdated/invalid/not_found), aiming for consistent color coding across the integration.

Changes:

  • Introduces NukeLoader.get_node_color() + NukeLoader.update_node_color() helpers and shifts multiple loaders to inherit from plugin.NukeLoader.
  • Updates check_inventory_versions to resolve colors via the loader class (instead of a global constants mapping) and adds color_to_int utility for consistent int conversion.
  • Removes the legacy LOADER_CATEGORY_COLORS constant and replaces per-loader “is latest” checks with shared logic.
File summaries
File Description
client/ayon_nuke/plugins/load/load_usd.py Switches USD geo loaders to NukeLoader and uses shared node-color update after containerisation/updates.
client/ayon_nuke/plugins/load/load_script_precomp.py Switches precomp loader to NukeLoader and delegates tile-color to shared logic with per-loader overrides.
client/ayon_nuke/plugins/load/load_ociolook.py Switches ocio look loader to NukeLoader and removes custom version-color logic in favor of shared update.
client/ayon_nuke/plugins/load/load_model.py Switches model loader to NukeLoader and removes custom version-color logic in favor of shared update.
client/ayon_nuke/plugins/load/load_image.py Switches image loader to NukeLoader and removes custom version-color logic in favor of shared update.
client/ayon_nuke/plugins/load/load_clip.py Removes custom version-color logic and uses shared update_node_color on load/update.
client/ayon_nuke/plugins/load/load_camera.py Switches camera loader to NukeLoader and removes custom version-color logic in favor of shared update.
client/ayon_nuke/plugins/load/load_camera_usd.py Switches USD camera loader to NukeLoader and delegates tile-coloring to shared logic.
client/ayon_nuke/api/plugin.py Adds node-color defaults and helper methods on NukeLoader for centralized color selection and updates.
client/ayon_nuke/api/lib.py Refactors check_inventory_versions to consult loader-provided colors; adds color_to_int conversion helper.
client/ayon_nuke/api/constants.py Removes the legacy global loader category->color mapping constant.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +868 to +877
loader_name = container.get("loader")
if not loader_name:
continue

loader = loaders_by_name.get(loader_name)
if not loader:
continue

if color := loader.get_node_color(category):
container["node"]["tile_color"].setValue(color)
Comment on lines +27 to +28
node_color_latest = color_to_int(255, 255, 255) # 0xff0ff0ff
node_color_outdated = color_to_int(216, 79, 32) # 0xd84f20ff
Comment on lines 55 to 59
camera_node.forceValidate()
camera_node["frame_rate"].setValue(float(fps))

# color node by correct color by actual version
self.node_version_color(
context["project"]["name"], version_entity, camera_node
)

self.set_usd_camera_prim_path(camera_node)

return containerise(
container = containerise(
node=camera_node,
@jakubjezek001

Copy link
Copy Markdown
Member

closing for #364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants