Reuse check inventory versions for loader colors - #278
Conversation
|
@vincentullmann can you resolve the linter issues? |
| 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 |
There was a problem hiding this comment.
@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?
There was a problem hiding this comment.
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:
This raises the questions:
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
🟡 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 fromplugin.NukeLoader. - Updates
check_inventory_versionsto resolve colors via the loader class (instead of a global constants mapping) and addscolor_to_intutility for consistent int conversion. - Removes the legacy
LOADER_CATEGORY_COLORSconstant 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.
| 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) |
| node_color_latest = color_to_int(255, 255, 255) # 0xff0ff0ff | ||
| node_color_outdated = color_to_int(216, 79, 32) # 0xd84f20ff |
| 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, |
|
closing for #364 |
Changelog Description
refactor the tile_color logic to be shared between loaders. Updated the
check_inventory_versionsto use the same logic as the loader for consistent color codingAdditional review information
before:
is_latestchecks to update the node colorscheck_inventory_versionsruns on scriptSave and uses its own logic and own color values to update the node colorslatestcolorafter:
plugin.NukeLoader.get_node_colorsreturns a map of "container_status/categories" to colorsnode_color_<status>variables on the LoaderClassget_node_colorsand return different valuesplugin.NukeLoader.update_node_color(self, node)a helper method to update the tile color for a given node. Loaders should use this onloadandupdatecheck_inventory_versionsnow uses the colors defined by each containersget_node_colorsTodo:
LoadClipandLoadImageloaders as examples. If the general approach is approved I'm happy to roll out the updates to other loaders too.Testing notes:
LoadCliporLoadImageloaderonScriptSavecallback:check_inventory_versions