Add Qwen camera translator

This commit is contained in:
2026-06-24 19:15:30 +02:00
parent a469e6cef2
commit 54dc3f5f80
3 changed files with 208 additions and 2 deletions
+64 -2
View File
@@ -4,10 +4,11 @@ import json
import random
try:
from .loop_nodes import LOOP_NODE_CLASS_MAPPINGS, LOOP_NODE_DISPLAY_NAME_MAPPINGS
from .loop_nodes import ANY_TYPE, LOOP_NODE_CLASS_MAPPINGS, LOOP_NODE_DISPLAY_NAME_MAPPINGS
from .prompt_builder import (
build_camera_config_json,
build_camera_orbit_config_json,
build_qwen_camera_config_json,
build_cast_config_json,
build_category_config_json,
build_character_slot_json,
@@ -54,10 +55,11 @@ try:
from .caption_naturalizer import naturalize_caption
from .krea_formatter import format_krea2_prompt
except ImportError:
from loop_nodes import LOOP_NODE_CLASS_MAPPINGS, LOOP_NODE_DISPLAY_NAME_MAPPINGS
from loop_nodes import ANY_TYPE, LOOP_NODE_CLASS_MAPPINGS, LOOP_NODE_DISPLAY_NAME_MAPPINGS
from prompt_builder import (
build_camera_config_json,
build_camera_orbit_config_json,
build_qwen_camera_config_json,
build_cast_config_json,
build_category_config_json,
build_character_slot_json,
@@ -443,6 +445,64 @@ class SxCPCameraOrbitControl:
return config, camera_prompt, json.dumps(parsed, ensure_ascii=True, sort_keys=True)
class SxCPQwenCameraTranslator:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"qwen_prompt": ("STRING", {"default": ""}),
"prefer_camera_info": ("BOOLEAN", {"default": True}),
"camera_mode": (camera_mode_choices(), {"default": "standard"}),
"subject_focus": (camera_orbit_focus_choices(), {"default": "auto"}),
"lens": (camera_lens_choices(), {"default": "auto"}),
"orientation": (camera_orientation_choices(), {"default": "auto"}),
"phone_visibility": (camera_phone_choices(), {"default": "auto"}),
"priority": (camera_priority_choices(), {"default": "locked"}),
"camera_detail": (camera_detail_choices(), {"default": "compact"}),
"include_degrees": ("BOOLEAN", {"default": False}),
},
"optional": {
"camera_info": (ANY_TYPE,),
},
}
RETURN_TYPES = ("STRING", "STRING", "STRING")
RETURN_NAMES = ("camera_config", "camera_prompt", "camera_info_json")
FUNCTION = "build"
CATEGORY = "prompt_builder"
def build(
self,
qwen_prompt,
prefer_camera_info,
camera_mode,
subject_focus,
lens,
orientation,
phone_visibility,
priority,
camera_detail,
include_degrees,
camera_info=None,
):
config = build_qwen_camera_config_json(
qwen_prompt=qwen_prompt or "",
camera_info=camera_info,
prefer_camera_info=prefer_camera_info,
camera_mode=camera_mode,
subject_focus=subject_focus,
lens=lens,
orientation=orientation,
phone_visibility=phone_visibility,
priority=priority,
camera_detail=camera_detail,
include_degrees=include_degrees,
)
parsed = json.loads(config)
camera_prompt = parsed.get("custom_camera_prompt", "")
return config, camera_prompt, json.dumps(parsed, ensure_ascii=True, sort_keys=True)
class SxCPCategoryPreset:
@classmethod
def INPUT_TYPES(cls):
@@ -1304,6 +1364,7 @@ NODE_CLASS_MAPPINGS = {
"SxCPSeedLocker": SxCPSeedLocker,
"SxCPCameraControl": SxCPCameraControl,
"SxCPCameraOrbitControl": SxCPCameraOrbitControl,
"SxCPQwenCameraTranslator": SxCPQwenCameraTranslator,
"SxCPCategoryPreset": SxCPCategoryPreset,
"SxCPCastControl": SxCPCastControl,
"SxCPGenerationProfile": SxCPGenerationProfile,
@@ -1327,6 +1388,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"SxCPSeedLocker": "SxCP Seed Locker",
"SxCPCameraControl": "SxCP Camera Control",
"SxCPCameraOrbitControl": "SxCP Camera Orbit Control",
"SxCPQwenCameraTranslator": "SxCP Qwen Camera Translator",
"SxCPCategoryPreset": "SxCP Category Preset",
"SxCPCastControl": "SxCP Cast Control",
"SxCPGenerationProfile": "SxCP Generation Profile",