Skip to content

Commit 7115831

Browse files
committed
Merge branch 'dev/ptrottier/fix_nodes' into 'main'
Fixed Nodes for latest ComfyUI Releases See merge request lightspeedrtx/lss-ai-tools/comfyui-rtx_remix!25
2 parents 1e9aaf2 + 6c1f7e1 commit 7115831

9 files changed

+8113
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
### Changed
13+
- Update nodes to be compatible with the renamed models
1314

1415
### Fixed
1516

nodes/ingestion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def ingest_texture(
108108
headers=HEADER_LSS_REMIX_VERSION_1_0,
109109
)
110110
check_response_status_code(r)
111-
output_folder = json.loads(r.text).get("asset_path", {})
111+
output_folder = json.loads(r.text).get("directory_path", {})
112112

113113
full_output_folder, filename, _counter, _subfolder, _filename_prefix = folder_paths.get_save_image_path(
114114
texture_name, folder_paths.get_output_directory(), texture[0].shape[1], texture[0].shape[0]

nodes/layers.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def execute(
108108
parent_layer_id: str | None = None,
109109
directories: str = "",
110110
) -> tuple[str]:
111+
# Handle None case for parent_layer_id
112+
if parent_layer_id is None:
113+
parent_layer_id = ""
114+
111115
layer_id_dir = pathlib.Path(parent_layer_id).parent
112116
if directories:
113117
layer_id_dir = layer_id_dir / directories
@@ -169,7 +173,7 @@ def create_layer(
169173
set_edit_target: bool = True,
170174
parent_layer_id: str | None = None,
171175
create_or_insert: bool = True,
172-
) -> str:
176+
) -> tuple[str]:
173177
if not self.enable_this_node: # noqa
174178
return ("",)
175179
payload = {
@@ -314,7 +318,9 @@ def execute(
314318
regex_filter: str = "",
315319
) -> tuple[list[str], list[str], bool]:
316320
if not self.enable_this_node: # noqa
317-
return ([], [], False)
321+
# Return non-empty lists even when disabled to avoid ComfyUI empty list bug
322+
return ([""], [""], False)
323+
318324
layer_types_list = [t.strip() for t in layer_types.split(",")]
319325
params = {
320326
"layer_types": layer_types_list,
@@ -334,13 +340,14 @@ def execute(
334340
check_response_status_code(r)
335341

336342
layer_ids: list[str] = []
337-
layer_types: list[str] = []
343+
layer_types_output: list[str] = []
338344

339345
layers = json.loads(r.text).get("layers", [])
340346
if not layers and crash_if_not_exist:
341347
raise ValueError("No layers found. Please check the parameters of your node")
342348
if not layers and not crash_if_not_exist:
343-
return (layer_ids, layer_types, False)
349+
# Return non-empty lists with placeholder values to avoid ComfyUI empty list bug
350+
return ([""], [""], False)
344351

345352
seen: set[str] = set()
346353
layers_to_process = collections.deque(layers)
@@ -353,11 +360,17 @@ def execute(
353360
seen.add(layer_id)
354361
if not regex_filter or re.match(regex_filter, layer_id):
355362
layer_ids.append(layer_id)
356-
layer_types.append(stringify_layer_type(layer["layer_type"]))
363+
layer_types_output.append(stringify_layer_type(layer["layer_type"]))
357364
if sublayers:
358365
layers_to_process.extend(layer["children"])
359366

360-
return (layer_ids, layer_types, bool(layer_ids))
367+
# Ensure we never return empty lists to avoid ComfyUI execution bug
368+
if not layer_ids:
369+
layer_ids = [""]
370+
layer_types_output = [""]
371+
return (layer_ids, layer_types_output, False)
372+
373+
return (layer_ids, layer_types_output, bool(layer_ids))
361374

362375
@classmethod
363376
def IS_CHANGED(cls, **kwargs): # noqa N802

nodes/textures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def get_texture_prims_assets(
150150
payload["asset_hashes"] = [item.strip() for item in asset_hashes.split(",")]
151151
if texture_types is not None:
152152
payload["texture_types"] = [item.strip() for item in texture_types.split(",")]
153-
if layer_id is not None:
153+
if layer_id is not None and layer_id.strip():
154154
payload["layer_identifier"] = posix(layer_id)
155155

156156
address, port = self.context # noqa
@@ -350,7 +350,7 @@ def get_attr_from_texture_type(self, usd_attribute: str, texture_type: str):
350350
headers=HEADER_LSS_REMIX_VERSION_1_0,
351351
)
352352
check_response_status_code(r)
353-
result_texture_types = json.loads(r.text).get("asset_paths", [])
353+
result_texture_types = json.loads(r.text).get("prim_paths", [])
354354

355355
if not result_texture_types:
356356
raise ValueError(

nodes/utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ def check_response_status_code(response: requests.Response) -> None:
5353
try:
5454
response.raise_for_status()
5555
except requests.exceptions.HTTPError as err:
56-
r = response.json()
57-
_logger.error(f"Requested URL: {response.url}\n" f"Raw Response: \n\n{pprint.pformat(r)}\n") # noqa
56+
# Only try to parse JSON when there's an error
57+
try:
58+
r = response.json()
59+
_logger.error(f"Requested URL: {response.url}\n" f"Raw Response: \n\n{pprint.pformat(r)}\n") # noqa
60+
except (ValueError, requests.exceptions.JSONDecodeError):
61+
# If response is not JSON, just log the text
62+
_logger.error(f"Requested URL: {response.url}\n" f"Raw Response: \n\n{response.text}\n") # noqa
5863
raise err
5964

6065

6166
def posix(layer_id: str | None) -> str:
6267
if layer_id is None:
63-
return layer_id
68+
return ""
6469
return pathlib.Path(layer_id).as_posix()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-rtx-remix"
33
description = "Use ComfyUI with RTX Remix to remaster classic games [a/https://github.com/NVIDIAGameWorks/rtx-remix](https://github.com/NVIDIAGameWorks/rtx-remix)"
4-
version = "1.0.0"
4+
version = "1.0.1"
55
license = {file = "LICENSE"}
66
dependencies = ["numpy", "pillow>=10.0.1", "requests", "torch"]
77

workflows/rtx_remix_pbrify_remix_workflow.png

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)