From b98c0f8ca58e8460c81e3aca61ea166d0187da1e Mon Sep 17 00:00:00 2001 From: mercu-lore <66737692+mercu-lore@users.noreply.github.com> Date: Tue, 11 Nov 2025 11:26:26 +0100 Subject: [PATCH 1/2] Add files via upload --- workflow/Qwen_edit_multiple_view.json | 1016 +++++++++++++++++++++++++ 1 file changed, 1016 insertions(+) create mode 100644 workflow/Qwen_edit_multiple_view.json diff --git a/workflow/Qwen_edit_multiple_view.json b/workflow/Qwen_edit_multiple_view.json new file mode 100644 index 0000000..cdd4e0a --- /dev/null +++ b/workflow/Qwen_edit_multiple_view.json @@ -0,0 +1,1016 @@ +{ + "id": "ad18abd3-bdee-4f80-8fae-d15d4f845b9d", + "revision": 0, + "last_node_id": 121, + "last_link_id": 348, + "nodes": [ + { + "id": 12, + "type": "UNETLoader", + "pos": [ + -930.0391557960419, + -213.2032255179584 + ], + "size": [ + 459.34149932447474, + 127.25395179744166 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "slot_index": 0, + "links": [ + 176 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "UNETLoader", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "qwenImageEdit2509.safetensors", + "fp8_e4m3fn" + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 61, + "type": "CLIPLoader", + "pos": [ + -930.7226190766206, + -38.57309249304457 + ], + "size": [ + 382, + 106 + ], + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "CLIP", + "type": "CLIP", + "links": [ + 178, + 181 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "CLIPLoader", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "qwen_2.5_vl_7b_fp8_scaled.safetensors", + "qwen_image", + "default" + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 10, + "type": "VAELoader", + "pos": [ + -932.0383429726265, + 110.82804875975992 + ], + "size": [ + 311.81634521484375, + 60.429901123046875 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "slot_index": 0, + "links": [ + 12, + 184, + 185 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "VAELoader", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "qwen_image_vae.safetensors" + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 67, + "type": "ModelSamplingAuraFlow", + "pos": [ + -432.4012714751505, + -210.47574846992734 + ], + "size": [ + 270, + 58 + ], + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 176 + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 213 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "ModelSamplingAuraFlow", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 3.1 + ] + }, + { + "id": 73, + "type": "LoraLoaderModelOnly", + "pos": [ + -429.7508630593093, + -110.25678817197559 + ], + "size": [ + 337.88094555445605, + 82 + ], + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 213 + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 214 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "LoraLoaderModelOnly", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "qwen/Qwen-Edit-2509-Multiple-angles.safetensors", + 1 + ] + }, + { + "id": 72, + "type": "LoraLoaderModelOnly", + "pos": [ + -70.70757717491256, + -118.61988211794913 + ], + "size": [ + 270, + 82 + ], + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 214 + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 215 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "LoraLoaderModelOnly", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "qwen/Qwen-Image-Edit-Lightning-4steps-V1.0.safetensors", + 1 + ] + }, + { + "id": 119, + "type": "Get Image Size", + "pos": [ + -638.4355183945416, + 284.85247464327153 + ], + "size": [ + 140, + 46 + ], + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 343 + } + ], + "outputs": [ + { + "name": "width", + "type": "INT", + "links": [ + 344 + ] + }, + { + "name": "height", + "type": "INT", + "links": [ + 345 + ] + } + ], + "properties": { + "cnr_id": "masquerade", + "ver": "432cb4d146a391b387a0cd25ace824328b5b61cf", + "Node name for S&R": "Get Image Size", + "widget_ue_connectable": {} + }, + "widgets_values": [] + }, + { + "id": 120, + "type": "CameraControlPromptNode", + "pos": [ + -291.3184111477877, + 81.03216072651647 + ], + "size": [ + 314.6509765625, + 202 + ], + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "prompt", + "type": "STRING", + "links": [ + 347, + 348 + ] + } + ], + "properties": { + "Node name for S&R": "CameraControlPromptNode", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 0, + 0, + 0, + 45, + false, + true, + true + ] + }, + { + "id": 121, + "type": "PreviewTextNode", + "pos": [ + -277.52859630645753, + 328.8342284320775 + ], + "size": [ + 304.8811768293061, + 136.14865689845374 + ], + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "text", + "type": "STRING", + "link": 348 + } + ], + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui_custom_nodes_alekpet", + "ver": "1.0.74", + "Node name for S&R": "PreviewTextNode", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "将镜头转为广角镜头 Turn the camera to a wide-angle lens. 将镜头转为特写镜头 Turn the camera to a close-up." + ] + }, + { + "id": 65, + "type": "KSampler", + "pos": [ + 546.2548713698606, + 75.03453111078365 + ], + "size": [ + 270, + 474 + ], + "flags": {}, + "order": 13, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 215 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 339 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 340 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 346 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 175 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "KSampler", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 61, + "increment", + 4, + 1, + "euler", + "simple", + 1 + ] + }, + { + "id": 8, + "type": "VAEDecode", + "pos": [ + 837.1751836105404, + 83.17840995599997 + ], + "size": [ + 210, + 46 + ], + "flags": {}, + "order": 14, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 175 + }, + { + "name": "vae", + "type": "VAE", + "link": 12 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "slot_index": 0, + "links": [ + 209 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "VAEDecode", + "widget_ue_connectable": {} + }, + "widgets_values": [] + }, + { + "id": 82, + "type": "PreviewImage", + "pos": [ + 836.6484165124509, + 183.42353527413272 + ], + "size": [ + 395.122210536882, + 317.07880896302527 + ], + "flags": {}, + "order": 15, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 209 + } + ], + "outputs": [], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.65", + "Node name for S&R": "PreviewImage", + "widget_ue_connectable": {} + }, + "widgets_values": [] + }, + { + "id": 69, + "type": "TextEncodeQwenImageEditPlus", + "pos": [ + 76.55652662858334, + 379.00109863531605 + ], + "size": [ + 420, + 220 + ], + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 181 + }, + { + "name": "vae", + "shape": 7, + "type": "VAE", + "link": 185 + }, + { + "name": "image1", + "shape": 7, + "type": "IMAGE", + "link": 342 + }, + { + "name": "image2", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "name": "image3", + "shape": 7, + "type": "IMAGE", + "link": null + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 340 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "TextEncodeQwenImageEditPlus", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "unnatural skin, oversharpened, plastic texture, harsh lighting, blemishes\n", + [ + false, + true + ] + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 68, + "type": "TextEncodeQwenImageEditPlus", + "pos": [ + 66.09232078395065, + 70.80890140561407 + ], + "size": [ + 426.63751220703125, + 265.5693054199219 + ], + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 178 + }, + { + "name": "vae", + "shape": 7, + "type": "VAE", + "link": 184 + }, + { + "name": "image1", + "shape": 7, + "type": "IMAGE", + "link": 341 + }, + { + "name": "image2", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "name": "image3", + "shape": 7, + "type": "IMAGE", + "link": null + }, + { + "name": "prompt", + "type": "STRING", + "widget": { + "name": "prompt" + }, + "link": 347 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 339 + ] + } + ], + "title": "TextEncodeQwenImageEditPlus (Positive)", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.64", + "Node name for S&R": "TextEncodeQwenImageEditPlus", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "将镜头向右旋转45度 Rotate the camera 45 degrees to the right. 将镜头转为俯视 Turn the camera to a top-down view.", + [ + false, + true + ] + ], + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 118, + "type": "EmptyLatentImage", + "pos": [ + 137.83800068074572, + 675.8480899280861 + ], + "size": [ + 270, + 106 + ], + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "width", + "type": "INT", + "widget": { + "name": "width" + }, + "link": 344 + }, + { + "name": "height", + "type": "INT", + "widget": { + "name": "height" + }, + "link": 345 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 346 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.65", + "Node name for S&R": "EmptyLatentImage", + "widget_ue_connectable": {} + }, + "widgets_values": [ + 512, + 512, + 1 + ] + }, + { + "id": 117, + "type": "LoadImage", + "pos": [ + -929.1446257667166, + 269.16067863951196 + ], + "size": [ + 270, + 314 + ], + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 341, + 342, + 343 + ] + }, + { + "name": "MASK", + "type": "MASK", + "links": null + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.3.65", + "Node name for S&R": "LoadImage", + "widget_ue_connectable": {} + }, + "widgets_values": [ + "ComfyUI_temp_hgdnn_00017_.png", + "image" + ] + } + ], + "links": [ + [ + 12, + 10, + 0, + 8, + 1, + "VAE" + ], + [ + 175, + 65, + 0, + 8, + 0, + "LATENT" + ], + [ + 176, + 12, + 0, + 67, + 0, + "MODEL" + ], + [ + 178, + 61, + 0, + 68, + 0, + "CLIP" + ], + [ + 181, + 61, + 0, + 69, + 0, + "CLIP" + ], + [ + 184, + 10, + 0, + 68, + 1, + "VAE" + ], + [ + 185, + 10, + 0, + 69, + 1, + "VAE" + ], + [ + 209, + 8, + 0, + 82, + 0, + "IMAGE" + ], + [ + 213, + 67, + 0, + 73, + 0, + "MODEL" + ], + [ + 214, + 73, + 0, + 72, + 0, + "MODEL" + ], + [ + 215, + 72, + 0, + 65, + 0, + "MODEL" + ], + [ + 339, + 68, + 0, + 65, + 1, + "CONDITIONING" + ], + [ + 340, + 69, + 0, + 65, + 2, + "CONDITIONING" + ], + [ + 341, + 117, + 0, + 68, + 2, + "IMAGE" + ], + [ + 342, + 117, + 0, + 69, + 2, + "IMAGE" + ], + [ + 343, + 117, + 0, + 119, + 0, + "IMAGE" + ], + [ + 344, + 119, + 0, + 118, + 0, + "INT" + ], + [ + 345, + 119, + 1, + 118, + 1, + "INT" + ], + [ + 346, + 118, + 0, + 65, + 3, + "LATENT" + ], + [ + 347, + 120, + 0, + 68, + 5, + "STRING" + ], + [ + 348, + 120, + 0, + 121, + 0, + "STRING" + ] + ], + "groups": [ + { + "id": 1, + "title": "Load Model", + "bounding": [ + -942.0383429726265, + -286.80322551795837, + 481.3406865010594, + 468.06117540076525 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 2, + "title": "Load Vae", + "bounding": [ + -442.4012714751505, + -284.0757484699273, + 651.693694300238, + 265.8189602979518 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 3, + "title": "Text Encoder", + "bounding": [ + 56.092320783950676, + -2.791098594385945, + 450.4642058446327, + 611.792197229702 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 4, + "title": "Prompt Optimizer", + "bounding": [ + -301.3184111477877, + 7.432160726516513, + 338.6709916706363, + 467.5507246040146 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 5, + "title": "Group", + "bounding": [ + -939.1446257667166, + 195.56067863951196, + 450.7091073721749, + 397.5999999999999 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + }, + { + "id": 6, + "title": "Ksamper + Vae", + "bounding": [ + 536.2548713698606, + 1.4345311107836474, + 705.5157556794722, + 557.6 + ], + "color": "#3f789e", + "font_size": 24, + "flags": {} + } + ], + "config": {}, + "extra": { + "ds": { + "scale": 0.724729500000001, + "offset": [ + 1224.3126814897057, + 573.6912459628222 + ] + }, + "frontendVersion": "1.28.7", + "groupNodes": {}, + "VHS_latentpreview": false, + "VHS_latentpreviewrate": 0, + "VHS_MetadataImage": true, + "VHS_KeepIntermediate": true, + "ue_links": [], + "links_added_by_ue": [] + }, + "version": 0.4 +} \ No newline at end of file From 9f48b30cc7ef8ec09a05d3cb56880839bf6e85c2 Mon Sep 17 00:00:00 2001 From: Lorenzo Mercugliano <66737692+mercu-lore@users.noreply.github.com> Date: Tue, 18 Nov 2025 16:55:58 +0100 Subject: [PATCH 2/2] Add files via upload --- README.md | 215 ++++++++++++++++++++++------------- __init__.py | 39 ++++--- light_control_prompt_node.py | 91 +++++++++++++++ 3 files changed, 244 insertions(+), 101 deletions(-) create mode 100644 light_control_prompt_node.py diff --git a/README.md b/README.md index c1c1126..3fb97f7 100644 --- a/README.md +++ b/README.md @@ -1,81 +1,134 @@ -# Camera Control Prompt Node - -Advanced camera control prompt generator for ComfyUI, optimized for **dx8152's MultiAngle LoRA**. - -## Author -**Lorenzo Mercugliano** - -## Description -A powerful ComfyUI custom node that converts camera control parameters into bilingual prompts (Chinese + English). Designed to work seamlessly with dx8152's MultiAngle LoRA for precise camera control in image generation workflows. - -## Features -- **Multi-directional camera movements** (horizontal, vertical, forward) -- **Camera rotation** with precise angle control (-90° to 90°) -- **Special view modes** (top-down, wide-angle, close-up) -- **Bilingual output** (Chinese + English prompts) -- **Optimized interface** with sliders and toggle controls -- **No redundancy** - smart parameter organization - -## Installation -1. Clone or download this folder to: `ComfyUI/custom_nodes/` -2. The folder structure should be: `ComfyUI/custom_nodes/camera_control_prompt/` -3. Restart ComfyUI - -## Node Inputs - -### Sliders (0-1 or Range Values) -- **move_horizontal** (-1 to 1): Left/Right camera movement - - -1 = Move left - - 0 = No movement - - 1 = Move right - -- **move_vertical** (-1 to 1): Up/Down camera movement - - -1 = Move down - - 0 = No movement - - 1 = Move up - -- **move_forward** (0 to 1): Forward camera movement (toggle) - - 0 = No movement - - 1 = Move forward - -- **rotate** (-90 to 90, step 45): Camera rotation - - -90 = Rotate 90° left - - -45 = Rotate 45° left - - 0 = No rotation - - 45 = Rotate 45° right - - 90 = Rotate 90° right - -### Buttons (Boolean) -- **view_top_down**: Enable top-down view -- **view_wide_angle**: Enable wide-angle lens -- **view_close_up**: Enable close-up view - -## Output -Single STRING output containing the complete bilingual camera control prompt, ready to use with dx8152's MultiAngle LoRA. - -## Example Usage -**Inputs:** -- move_horizontal: 1 (right) -- move_vertical: 0 -- move_forward: 1 -- rotate: 45 (right rotation) -- view_top_down: False -- view_wide_angle: True -- view_close_up: False - -**Output:** -``` -将镜头向右移动 Move the camera right. 将镜头向前移动 Move the camera forward. 将镜头向右旋转45度 Rotate the camera 45 degrees to the right. 将镜头转为广角镜头 Turn the camera to a wide-angle lens. -``` - -## Compatibility -- **ComfyUI**: Latest versions -- **LoRA**: Optimized for dx8152's MultiAngle LoRA -- **Language**: Python 3.8+ - -## License -MIT - -## Credits -- **Node Author**: Lorenzo Mercu -- **Optimized for**: dx8152's MultiAngle LoRA +# Camera Control & Relighting Prompt Nodes + +Advanced prompt generators for ComfyUI, optimized for **dx8152's MultiAngle LoRA** and relighting workflows. + +## Author +**Lorenzo Mercugliano** + +## Description +A collection of powerful ComfyUI custom nodes that convert camera control and lighting parameters into bilingual prompts (Chinese + English). Designed to work seamlessly with dx8152's MultiAngle LoRA for precise camera control and relighting in image generation workflows. + +## Features +- **Multi-directional camera movements** (horizontal, vertical, forward) +- **Camera rotation** with precise angle control (-90° to 90°) +- **Special view modes** (top-down, wide-angle, close-up) +- **Relighting control** with 10 directional light sources +- **Bilingual output** (Chinese + English prompts) +- **Optimized interface** with sliders, toggles, and dropdowns +- **No redundancy** - smart parameter organization + +## Installation +1. Clone or download this folder to: `ComfyUI/custom_nodes/` +2. The folder structure should be: `ComfyUI/custom_nodes/camera_control_prompt/` +3. Restart ComfyUI + +## Nodes + +### 1. Camera Control Prompt Generator + +#### Node Inputs +**Dropdowns:** +- **move_horizontal**: Left/Right camera movement + - none = No movement + - left = Move left + - right = Move right + +- **move_vertical**: Up/Down camera movement + - none = No movement + - up = Move up + - down = Move down + +- **move_forward**: Forward camera movement + - no = No movement + - yes = Move forward + +**Sliders:** +- **rotate** (-90 to 90, step 45): Camera rotation + - -90 = Rotate 90° left + - -45 = Rotate 45° left + - 0 = No rotation + - 45 = Rotate 45° right + - 90 = Rotate 90° right + +**Buttons (Boolean):** +- **view_top_down**: Enable top-down view +- **view_wide_angle**: Enable wide-angle lens +- **view_close_up**: Enable close-up view +- **view_bottom_up**: Enable bottom-up view + +--- + +### 2. Relighting Prompt Generator + +#### Node Inputs +**Dropdown:** +- **light_direction**: Select the light source direction + - front = 前方 (Front) + - front_left = 左前方 (Front Left) + - left = 左方 (Left) + - back_left = 左后方 (Back Left) + - back = 后方 (Back) + - back_right = 右后方 (Back Right) + - right = 右方 (Right) + - front_right = 右前方 (Front Right) + - above = 上方 (Above) + - below = 下方 (Below) + +**Buttons (Boolean):** +- **use_chinese**: Toggle between Chinese (True) and English (False) output + - True = Chinese prompt (default) + - False = English prompt + +## Output +Both nodes output a single STRING containing the complete prompt, ready to use with dx8152's MultiAngle LoRA and relighting workflows. + +## Example Usage + +### Camera Control Prompt Generator +**Inputs:** +- move_horizontal: right +- move_vertical: none +- move_forward: yes +- rotate: 45 +- view_top_down: False +- view_wide_angle: True +- view_close_up: False +- view_bottom_up: False + +**Output:** +``` +将镜头向右移动 Move the camera right. 将镜头向前移动 Move the camera forward. 将镜头向右旋转45度 Rotate the camera 45 degrees to the right. 将镜头转为广角镜头 Turn the camera to a wide-angle lens. +``` + +--- + +### Relighting Prompt Generator +**Inputs (Chinese):** +- light_direction: front_left +- use_chinese: True + +**Output:** +``` +使用图2的亮度贴图对图1重新照明(光源来自左前方) +``` + +**Inputs (English):** +- light_direction: back_right +- use_chinese: False + +**Output:** +``` +Relight Figure 1 using the luminance map from Figure 2 (light source from the back right) +``` + +## Compatibility +- **ComfyUI**: Latest versions +- **LoRA**: Optimized for dx8152's MultiAngle LoRA +- **Language**: Python 3.8+ + +## License +MIT + +## Credits +- **Node Author**: Lorenzo Mercu +- **Optimized for**: dx8152's MultiAngle LoRA diff --git a/__init__.py b/__init__.py index 883d80e..f849349 100644 --- a/__init__.py +++ b/__init__.py @@ -1,20 +1,19 @@ -""" -Camera Control Prompt Node - ComfyUI Custom Node -Optimized for dx8152's MultiAngle LoRA - -Author: Lorenzo Mercu -Optimized for: dx8152's MultiAngle LoRA -License: MIT -""" - -from .camera_control_prompt_node import CameraControlPromptNode - -NODE_CLASS_MAPPINGS = { - "CameraControlPromptNode": CameraControlPromptNode -} - -NODE_DISPLAY_NAME_MAPPINGS = { - "CameraControlPromptNode": "Camera Control Prompt Generator" -} - -__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] +""" +Camera Control Prompt Node - ComfyUI Custom Node +Optimized for dx8152's MultiAngle LoRA + +Author: Lorenzo Mercu +Optimized for: dx8152's MultiAngle LoRA +License: MIT +""" + +from .camera_control_prompt_node import NODE_CLASS_MAPPINGS as CAMERA_MAPPINGS +from .camera_control_prompt_node import NODE_DISPLAY_NAME_MAPPINGS as CAMERA_DISPLAY_MAPPINGS +from .light_control_prompt_node import NODE_CLASS_MAPPINGS as LIGHT_MAPPINGS +from .light_control_prompt_node import NODE_DISPLAY_NAME_MAPPINGS as LIGHT_DISPLAY_MAPPINGS + +# Merge dei mappings da entrambi i nodi +NODE_CLASS_MAPPINGS = {**CAMERA_MAPPINGS, **LIGHT_MAPPINGS} +NODE_DISPLAY_NAME_MAPPINGS = {**CAMERA_DISPLAY_MAPPINGS, **LIGHT_DISPLAY_MAPPINGS} + +__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] diff --git a/light_control_prompt_node.py b/light_control_prompt_node.py new file mode 100644 index 0000000..9caf8d2 --- /dev/null +++ b/light_control_prompt_node.py @@ -0,0 +1,91 @@ +""" +Light Control Prompt Node for ComfyUI +Generates lighting direction prompts for image relighting + +Author: Lorenzo Mercu +Description: Light control prompt generator for relighting workflows +Features: Multi-directional light source control, bilingual prompts +""" + + +class RelightingPromptNode: + """ + Nodo che genera il prompt ottimizzato per il relighting + basandosi sulla direzione della luce selezionata + """ + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "light_direction": ([ + "front", # 前方 + "front_left", # 左前方 + "left", # 左方 + "back_left", # 左后方 + "back", # 后方 + "back_right", # 右后方 + "right", # 右方 + "front_right", # 右前方 + "above", # 上方 + "below" # 下方 + ], {"default": "front"}), + "use_chinese": ("BOOLEAN", {"default": True}), + } + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("prompt",) + FUNCTION = "generate_prompt" + CATEGORY = "relighting" + + def generate_prompt(self, light_direction, use_chinese): + """Genera il prompt basato sulla direzione della luce""" + + # Mappatura direzioni luce - Cinese + light_directions_cn = { + "front": "光源来自前方", + "front_left": "光源来自左前方", + "left": "光源来自左方", + "back_left": "光源来自左后方", + "back": "光源来自后方", + "back_right": "光源来自右后方", + "right": "光源来自右方", + "front_right": "光源来自右前方", + "above": "光源来自上方", + "below": "光源来自下方" + } + + # Mappatura direzioni luce - Inglese + light_directions_en = { + "front": "light source from the front", + "front_left": "light source from the front left", + "left": "light source from the left", + "back_left": "light source from the back left", + "back": "light source from the back", + "back_right": "light source from the back right", + "right": "light source from the right", + "front_right": "light source from the front right", + "above": "light source from above", + "below": "light source from below" + } + + # Genera il prompt nella lingua selezionata + if use_chinese: + direction_text = light_directions_cn.get(light_direction, "光源来自前方") + final_prompt = f"使用图2的亮度贴图对图1重新照明({direction_text})" + else: + direction_text = light_directions_en.get(light_direction, "light source from the front") + final_prompt = f"Relight Figure 1 using the luminance map from Figure 2 ({direction_text})" + + return (final_prompt,) + + +# Mappings per ComfyUI +NODE_CLASS_MAPPINGS = { + "RelightingPromptNode": RelightingPromptNode +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "RelightingPromptNode": "Relighting Prompt Generator" +}