From ee479d24ebacb4e999ff20a8b9caf2e17b7403f1 Mon Sep 17 00:00:00 2001 From: jrsndlr Date: Wed, 23 Oct 2024 22:51:45 +0200 Subject: [PATCH 1/2] Nuke callbacks more resilient --- client/ayon_nuke/api/lib.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/client/ayon_nuke/api/lib.py b/client/ayon_nuke/api/lib.py index 5af72bd..c7f53c1 100644 --- a/client/ayon_nuke/api/lib.py +++ b/client/ayon_nuke/api/lib.py @@ -588,15 +588,18 @@ def compat_prefixed(knob_name): if result: first_user_knob = result.group(2) # Collect user knobs from the end of the knob list + node_name = node['name'].value() for knob in reversed(node.allKnobs()): knob_name = knob.name() if not knob_name: # Ignore unnamed knob continue - - knob_type = nuke.knob(knob.fullyQualifiedName(), type=True) - value = knob.value() - + try: + knob_type = nuke.knob(knob.fullyQualifiedName(), type=True) + value = knob.value() + except Exception as e: + log.debug(f"Error reading knob {knob_name} from node {node_name}") + continue if ( knob_type not in EXCLUDED_KNOB_TYPE_ON_READ or # For compating read-only string data that imprinted @@ -815,18 +818,21 @@ def check_inventory_versions(): This will group containers by their version to outdated, not found, invalid or latest and colorize the nodes based on the category. """ - host = registered_host() - containers = host.get_containers() - project_name = get_current_project_name() + try: + host = registered_host() + containers = host.get_containers() + project_name = get_current_project_name() - filtered_containers = filter_containers(containers, project_name) - for category, containers in filtered_containers._asdict().items(): - if category not in LOADER_CATEGORY_COLORS: - continue - color = LOADER_CATEGORY_COLORS[category] - color = int(color, 16) # convert hex to nuke tile color int - for container in containers: - container["node"]["tile_color"].setValue(color) + filtered_containers = filter_containers(containers, project_name) + for category, containers in filtered_containers._asdict().items(): + if category not in LOADER_CATEGORY_COLORS: + continue + color = LOADER_CATEGORY_COLORS[category] + color = int(color, 16) # convert hex to nuke tile color int + for container in containers: + container["node"]["tile_color"].setValue(color) + except Exception as error: + log.warning(error) def writes_version_sync(): From 8aff2fa4bf22223b3e7742793b0755579478c2d4 Mon Sep 17 00:00:00 2001 From: jrsndlr Date: Wed, 23 Oct 2024 23:09:20 +0200 Subject: [PATCH 2/2] fix --- client/ayon_nuke/api/lib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_nuke/api/lib.py b/client/ayon_nuke/api/lib.py index c7f53c1..3154ede 100644 --- a/client/ayon_nuke/api/lib.py +++ b/client/ayon_nuke/api/lib.py @@ -588,7 +588,6 @@ def compat_prefixed(knob_name): if result: first_user_knob = result.group(2) # Collect user knobs from the end of the knob list - node_name = node['name'].value() for knob in reversed(node.allKnobs()): knob_name = knob.name() if not knob_name: @@ -597,8 +596,9 @@ def compat_prefixed(knob_name): try: knob_type = nuke.knob(knob.fullyQualifiedName(), type=True) value = knob.value() - except Exception as e: - log.debug(f"Error reading knob {knob_name} from node {node_name}") + except Exception: + log.debug( + f"Error in knob {knob_name}, node {node['name'].value()}") continue if ( knob_type not in EXCLUDED_KNOB_TYPE_ON_READ or