diff --git a/modules/save3D.py b/modules/save3D.py index 9fb58f5..b7cce20 100644 --- a/modules/save3D.py +++ b/modules/save3D.py @@ -37,10 +37,9 @@ class RunwareSave3D: CATEGORY = "Runware" DESCRIPTION = "Save 3D model files (GLB/PLY) from Runware 3D Inference to the output folder." - def save_3d(self, **kwargs): + def save_3d(self, filenamePrefix="ComfyUI", **kwargs): """Save 3D file from URL""" file_url = kwargs.get("3dObject", "") - filename_prefix = kwargs.get("filenamePrefix", "ComfyUI") if not file_url or not file_url.strip(): raise Exception("No 3D URL provided. Please connect the '3dObject' output from Runware 3D Inference node.") @@ -59,9 +58,9 @@ class RunwareSave3D: if extension not in ["glb", "ply"]: raise Exception(f"Unsupported 3D file extension '{extension}' from URL. Expected .glb or .ply.") - # Sanitize filename_prefix to prevent path traversal or arbitrary subdir creation + # Sanitize filenamePrefix to prevent path traversal or arbitrary subdir creation prefix_basename = os.path.basename( - filename_prefix.replace(os.sep, "_").replace(os.altsep or os.sep, "_") + filenamePrefix.replace(os.sep, "_").replace(os.altsep or os.sep, "_") ) safe_prefix = re.sub(r"[^\w\-]", "", prefix_basename) or "ComfyUI" diff --git a/modules/saveImage.py b/modules/saveImage.py index c1b3b77..0730fc2 100644 --- a/modules/saveImage.py +++ b/modules/saveImage.py @@ -32,10 +32,8 @@ class RunwareSaveImage: OUTPUT_NODE = True CATEGORY = "Runware" - def save_images(self, Images, **kwargs): + def save_images(self, Images, filenamePrefix="ComfyUI", saveImage=True): """Save images using URL directly""" - filename_prefix = kwargs.get("filenamePrefix", "ComfyUI") - save_image = kwargs.get("saveImage", True) # Split URLs if comma-separated (for batch processing) image_urls = [url.strip() for url in Images.split(",") if url.strip()] @@ -44,7 +42,7 @@ class RunwareSaveImage: raise Exception("No image added provided. Please connect the 'Image' from Runware Image Inference node.") # Use output dir when saving, temp dir for preview only (purged on restart) - if save_image: + if saveImage: output_dir = folder_paths.get_output_directory() os.makedirs(output_dir, exist_ok=True) file_type = "output" @@ -64,14 +62,14 @@ class RunwareSaveImage: extension = "." + url_without_params.split('.')[-1] if len(image_urls) > 1: - filename = f"{filename_prefix}_{timestamp}_{i+1:03}.{extension.lstrip('.')}" + filename = f"{filenamePrefix}_{timestamp}_{i+1:03}.{extension.lstrip('.')}" else: - filename = f"{filename_prefix}_{timestamp}.{extension.lstrip('.')}" + filename = f"{filenamePrefix}_{timestamp}.{extension.lstrip('.')}" filepath = os.path.join(output_dir, filename) with open(filepath, 'wb') as f: f.write(img_data) - print(f"[Runware] {'Saved' if save_image else 'Preview'}: {filepath}") + print(f"[Runware] {'Saved' if saveImage else 'Preview'}: {filepath}") saved_files.append({ "filename": filename,