commit 56c7312de9d0d69ef429467fa69c8a7d6e1b0360 Author: malkuthro <166633396+malkuthro@users.noreply.github.com> Date: Sun Sep 28 14:48:07 2025 +0200 firstCommit diff --git a/config.json b/config.json new file mode 100644 index 0000000..4232900 --- /dev/null +++ b/config.json @@ -0,0 +1,97 @@ +{ + "category": "Wan/Parameters", + "node_name": "Wan_2.2", + "fields": [ + { + "name": "light_source", + "type": "combo", + "options": ["none", "Sunny lighting", "Artificial lighting", "Moonlighting", "Practical lighting", "Firelighting", "Fluorescent lighting", "Overcast lighting", "Mixed lighting"], + "default": "none" + }, + { + "name": "lighting_type", + "type": "combo", + "options": ["none", "Soft lighting", "Hard lighting", "Top lighting", "Side lighting", "Underlighting", "Edge lighting", "Silhouette lighting", "Low contrast lighting", "High contrast lighting"], + "default": "none" + }, + { + "name": "time_of_day", + "type": "combo", + "options": ["none", "Sunrise time", "Night time", "Dusk time", "Sunset time", "Dawn time"], + "default": "none" + }, + { + "name": "shot_size", + "type": "combo", + "options": ["none", "Extreme close-up shot", "Close-up shot", "Medium shot", "Medium close-up shot", "Medium wide shot", "Wide shot"], + "default": "none" + }, + { + "name": "lens_focal_length", + "type": "combo", + "options": ["none", "Medium lens", "Wide lens", "Long-focus lens", "Telephoto lens", "Fisheye lens"], + "default": "none" + }, + { + "name": "lens_type", + "type": "combo", + "options": ["none", "Clean single shot", "Two shot", "Three shot", "Group shot", "Establishing shot"], + "default": "none" + }, + { + "name": "camera_angle", + "type": "combo", + "options": ["none", "Over-the-shoulder shot", "High angle shot", "Low angle shot", "Dutch angle shot", "Aerial shot"], + "default": "none" + }, + { + "name": "composition", + "type": "combo", + "options": ["none", "Center composition", "Balanced composition", "Left/right weighted composition", "Symmetrical composition", "Short-side composition"], + "default": "none" + }, + { + "name": "color_tone", + "type": "combo", + "options": ["none", "Warm colors", "Cool colors", "Saturated colors", "Desaturated colors"], + "default": "none" + }, + { + "name": "motion", + "type": "combo", + "options": ["none", "Street dance", "Running", "Skateboarding", "Soccer", "Tennis", "Table tennis", "Snowboarder", "Basketball", "Rugby field", "Bowl dance", "Aerial cartwheel"], + "default": "none" + }, + { + "name": "character_emotion", + "type": "combo", + "options": ["none", "Angrily", "Fear", "Happy", "Sadly", "Surprised"], + "default": "none" + }, + { + "name": "basic_camera_movement", + "type": "combo", + "options": ["none", "Camera pushes in for a close-up", "Camera pulls back", "Camera pans to the right", "Camera moves to the left", "Camera tilts up"], + "default": "none" + }, + { + "name": "advanced_camera_movement", + "type": "combo", + "options": ["none", "Handheld camera", "Compound move", "Tracking shot", "Arc shot"], + "default": "none" + }, + { + "name": "visual_style", + "type": "combo", + "options": ["none", "Felt style", "3D cartoon style", "Pixel art style", "Puppet animation", "3D game scene", "Claymation style", "2D anime style", "Watercolor painting", "Black and white animation segment", "Oil painting style"], + "default": "none" + }, + { + "name": "visual_effects", + "type": "combo", + "options": ["none", "Tilt-shift photography", "Time-lapse"], + "default": "none" + } + ], + "output_type": "STRING" +} \ No newline at end of file diff --git a/wan22_easyPrompt.py b/wan22_easyPrompt.py new file mode 100644 index 0000000..53cbc5a --- /dev/null +++ b/wan22_easyPrompt.py @@ -0,0 +1,49 @@ +import json +import os + +# Get the directory of this script to locate config.json +script_dir = os.path.dirname(os.path.abspath(__file__)) +config_path = os.path.join(script_dir, 'config.json') + +# Load the JSON config +with open(config_path, 'r') as f: + config = json.load(f) + +# Build the INPUT_TYPES dict dynamically +input_types = {"required": {}} +for field in config['fields']: + name = field['name'] + if field['type'] == 'combo': + options = field['options'] + defaults = {"default": field.get('default', options[0])} + input_types["required"][name] = (options, defaults) + elif field['type'] == 'string': + defaults = {"default": field.get('default', ""), "multiline": True} # Optional: make it multiline + input_types["required"][name] = ("STRING", defaults) + +# Dynamically create the node class +class JsonConfigNode: + @classmethod + def INPUT_TYPES(cls): + return input_types + + RETURN_TYPES = (config.get('output_type', "STRING"),) + FUNCTION = "execute" + CATEGORY = config.get('category', "Custom") + + def execute(self, **kwargs): + # Example: Concatenate selections into a prompt string (customize as needed) + prompt_parts = [] + for key, value in kwargs.items(): + if value and value != "none": # Skip 'none' if desired + prompt_parts.append(f"{key}: {value}") + return (", ".join(prompt_parts),) + +# Register the node +NODE_CLASS_MAPPINGS = { + config.get('node_name', "JsonConfigNode"): JsonConfigNode +} + +NODE_DISPLAY_NAME_MAPPINGS = { + config.get('node_name', "JsonConfigNode"): "JSON Config Node" +} \ No newline at end of file