Skip to content

Transform your 3D texturing workflow with the power of generative AI, directly within Blender!

qwen unzoom fix, camera generation order, improvement to regenerate selected, exponent reset, original reneder ipadapter mode for local_edit, new presets, improve debug heatmap, reorganize ui

sakalonddd6bd034891d
diff --git a/README.md b/README.md
index ccec68a..fbab5dd 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# StableGen: AI-Powered 3D Texturing in Blender ✨
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
-[![Blender Version](https://img.shields.io/badge/Blender-4.2%2B-orange.svg)](#system-requirements)
+[![Blender Version](https://img.shields.io/badge/Blender-4.2+%20%7C%205.1%2B-orange.svg)](#system-requirements)
[![GitHub All Releases](https://img.shields.io/github/downloads/sakalond/stablegen/total?color=brightgreen&label=Downloads)](https://github.com/sakalond/stablegen/releases)
**Transform your 3D texturing workflow with the power of generative AI, directly within Blender!**
@@ -44,6 +44,16 @@ StableGen empowers 3D artists by bringing cutting-edge AI texturing capabilities
* **Sequential Mode:** Generates textures viewpoint by viewpoint on each mesh, using inpainting and visibility masks for high consistency across complex surfaces.
* **Grid Mode:** Processes multiple viewpoints for all meshes simultaneously for faster previews. Includes an optional refinement pass.
* Sophisticated weighted blending ensures smooth transitions between views.
+* 📷 **Advanced Camera Placement:**
+ * **7 placement strategies:** Orbit Ring, Fan Arc, Hemisphere, PCA-Axis, Normal-Weighted K-means, Greedy Occlusion Coverage, and Interactive Visibility-Weighted placement.
+ * **Per-camera optimal aspect ratios** — each camera gets its own resolution computed from the mesh's silhouette, so no pixels are wasted on letterboxing.
+ * **Unlimited cameras** — no more 8-camera limit.
+ * **Camera generation order** — drag-and-drop reorder list with 6 preset strategies to control the processing order in Sequential mode.
+ * Camera cloning, mirroring, and floating viewport prompt labels.
+* 🎯 **Local Edit Mode:**
+ * Point cameras at specific areas to modify — new texture blends seamlessly over the original using angle-based and vignette-based feathering.
+ * Separate angle ramp and silhouette edge feathering controls for precise blending.
+ * Works with all architectures (SDXL, Flux, Qwen Image Edit).
* 📐 **Precise Geometric Control with ControlNet:**
* Leverage multiple ControlNet units (Depth, Canny, Normal) simultaneously to ensure generated textures respect your model's geometry.
* Fine-tune strength, start/end steps for each ControlNet unit.
@@ -56,13 +66,16 @@ StableGen empowers 3D artists by bringing cutting-edge AI texturing capabilities
* Connects to your existing ComfyUI installation, allowing you to use your preferred SDXL checkpoints, custom LoRAs, and the new Qwen Image Edit workflow alongside experimental FLUX.1-dev support.
* Offloads heavy computation to the ComfyUI server, keeping Blender mostly responsive.
* ✨ **Advanced Inpainting & Refinement:**
- * **Refine Mode (Img2Img):** Re-style, enhance, or add detail to existing textures (StableGen generated or otherwise) using an image-to-image process. Choose to preserve original textures for localized refinement.
+ * **Refine Mode (Img2Img):** Re-style, enhance, or add detail to existing textures (StableGen generated or otherwise) using an image-to-image process.
+ * **Local Edit Mode:** Selectively modify specific areas while preserving the rest, with independent angle and vignette feathering controls.
* **UV Inpaint Mode:** Intelligently fills untextured areas directly on your model's UV map using surrounding texture context.
+ * **Color Matching:** Match each generated view's colors to the current texture before blending, using multiple algorithms (MKL, Reinhard, Histogram, MVGD).
* 🛠️ **Integrated Workflow Tools:**
- * **Camera Setup:** Quickly add and arrange multiple cameras around your subject.
+ * **Camera Setup:** Quickly add and arrange multiple cameras with 7 placement strategies, per-camera aspect ratios, interactive occlusion preview, and customizable generation order.
* **View-Specific Prompts:** Assign unique text prompts to individual camera viewpoints for targeted details.
- * **Texture Baking:** Convert complex procedural StableGen materials into standard UV image textures.
- * **HDRI Setup, Modifier Application, Curve Conversion, GIF/MP4 Export & Reproject.**
+ * **Texture Baking:** Convert complex procedural StableGen materials into standard UV image textures. "Flatten for Refine" option lets you bake and continue editing.
+ * **Debug Tools:** Visualize projection coverage, UV alignment, and weight blending without running AI generation.
+ * **HDRI Setup, Modifier Application, Curve Conversion, GIF/MP4 Export & Reproject.****
* 📋 **Preset System:**
* Get started quickly with built-in presets for common scenarios (e.g., "Default", "Characters", "Quick Draft").
* Save and manage your own custom parameter configurations for repeatable workflows.
@@ -133,8 +146,8 @@ StableGen acts as an intuitive interface within Blender that communicates with a
## 💻 System Requirements
-* **Blender:** Version 4.2 or newer. *Note: Blender 5.x is not supported yet (work in progress).*
-* **Operating System:** Windows 10/11 or Linux.
+* **Blender:** Version 4.2 – 4.5 (OSL projection) or Blender 5.1+ (GPU-accelerated projection via native Raycast nodes). **Blender 5.0 is not supported** (OSL is broken and native Raycast was not yet available).
+* **Operating System:** Windows 10/11, Linux, or macOS (Apple Silicon).
* **GPU:** **NVIDIA GPU with CUDA is recommended** for ComfyUI. For further details, check ComfyUI's github page: [https://github.com/comfyanonymous/ComfyUI](https://github.com/comfyanonymous/ComfyUI).
* At least 8 GB of VRAM is required to run SDXL at a usable speed; plan for 16 GB or more when running FLUX.1-dev or the Qwen-Image-Edit pipeline.
* **ComfyUI:** A working installation of ComfyUI. StableGen uses this as its backend.
@@ -245,7 +258,7 @@ These are the main operational buttons and initial setup tools, generally found
* **Generate / Cancel Generation (Main Button):** This is the primary button to start the AI texture generation process for meshe objects based on your current settings. It communicates with the ComfyUI backend. While processing, the button changes to "Cancel Generation," allowing you to stop the current task. Progress bars will appear below this button during generation.
* **Bake Textures:** Converts the dynamic, multi-projection material StableGen creates on your meshes into a single, standard UV-mapped image texture per object. This is essential for exporting or simplifying scenes. You can set the resolution and UV unwrapping method for the bake. This option is crucial for finalizing your AI-generated textures into a portable format.
-* **Add Cameras:** Helps you quickly set up multiple viewpoints. It creates a circular array of Blender cameras around the active object (if "Object" center type is chosen) or the current 3D view center. You can specify the number of cameras and interactively adjust their positions before finalizing.
+* **Add Cameras:** Set up multiple viewpoints using one of 7 placement strategies — from simple orbit rings to geometry-aware occlusion-optimized placement with per-camera aspect ratios. Use the interactive preview to fine-tune placement before confirming.
* **Collect Camera Prompts:** Cycles through all cameras in your scene, allowing you to type a specific descriptive text prompt for each viewpoint (e.g., "front view," "close-up on face"). These per-camera prompts are used in conjunction with the main prompt if `Use camera prompts` is enabled in `Viewpoint Blending Settings`.
### Preset Management
@@ -268,6 +281,7 @@ These are your primary controls for defining the generation:
* `Generate Sequentially`: Viewpoints generate one by one, using inpainting from previous views for consistency.
* `Generate Using Grid`: Combines all views into a grid for a single generation pass, with an optional refinement step.
* `Refine/Restyle Texture (Img2Img)`: Uses the current texture as input for an image-to-image process.
+ * `Local Edit`: Selectively modify specific areas by pointing cameras at them — new texture blends over the original with feathered edges.
* `UV Inpaint Missing Areas`: Fills untextured areas on a UV map via inpainting.
* **Target Objects:** Choose whether to texture all visible mesh objects or only selected ones.
@@ -277,7 +291,7 @@ Click the arrow next to each title to expand and access detailed settings:
* **Core Generation Settings:** Control diffusion basics like Seed, Steps, CFG, Negative Prompt, Sampler, Scheduler and Clip Skip.
* **LoRA Management:** Add and configure LoRAs (Low-Rank Adaptation) for additional style or content guidance. You can set the model and clip strength for each LoRA.
-* **Viewpoint Blending Settings:** Manage how textures from different camera views are combined, including camera-specific prompts, discard angles, and blending weight exponents.
+* **Viewpoint Blending Settings:** Manage how textures from different camera views are combined, including camera-specific prompts, discard angles, blending weight exponents, camera generation order, and post-generation exponent reset.
* **Output & Material Settings:** Define fallback color, material properties (BSDF), automatic resolution scaling, and options for baking textures during generation which enables generating with more than 8 viewpoints.
* **Image Guidance (IPAdapter & ControlNet):** Configure IPAdapter for style transfer using external images and set up multiple ControlNet units (Depth, Canny, etc.) for precise structural control.
* **Inpainting Options:** Fine-tune masking and blending for `Sequential` and `UV Inpaint` modes (e.g., differential diffusion, mask blurring/growing).
@@ -408,11 +422,10 @@ Here are some features we plan to implement in the future (in no particular orde
* **Advanced IPAdapter support:** Support for custom IPAdapter models, support for advanced IPAdapter parameters.
* **Upscaling:** Support for upscaling generated textures.
* **Custom VAE, CLIP model selection:** Ability to select custom VAE and CLIP models in addition to custom ControlNet and LoRA models.
-* **Qwen workflow refinements:** Deeper integration for Qwen Image Edit, including UV inpainting and refine modes.
-* **Automatic camera placement improvements:** More advanced camera placement algorithms (e.g., based on model geometry).
-* **Refine mode improvements:** Features like brush based inpainting, and better blending for "Preserve Original Textures" mode.
+* **Refine mode improvements:** Features like brush based inpainting.
* **Z-Image support** (and eventual Z-Image editing model support)
* **Mesh generation:** Integration of mesh generation capabilities.
+* **Brush-based inpainting:** Paint masks directly on the viewport for targeted local edits.
If you have any suggestions, please feel free to open an issue!
@@ -425,4 +438,4 @@ Ondřej Sakala
* X/Twitter: `@sakalond`
---
-*Last Updated: December 15, 2025*
+*Last Updated: February 14, 2026*
diff --git a/stablegen/__init__.py b/stablegen/__init__.py
index b69fb11..ee28bfa 100644
--- a/stablegen/__init__.py
+++ b/stablegen/__init__.py
@@ -1,7 +1,7 @@
""" This script registers the addon. """
import bpy # pylint: disable=import-error
from .stablegen import StableGenPanel, ApplyPreset, SavePreset, DeletePreset, get_preset_items, update_parameters, ResetQwenPrompt
-from .render_tools import BakeTextures, AddCameras, CloneCamera, MirrorCamera, ToggleCameraLabels, SwitchMaterial, ExportOrbitGIF, CollectCameraPrompts, CameraPromptItem
+from .render_tools import BakeTextures, AddCameras, CloneCamera, MirrorCamera, ToggleCameraLabels, SwitchMaterial, ExportOrbitGIF, CollectCameraPrompts, CameraPromptItem, CameraOrderItem, SG_UL_CameraOrderList, SyncCameraOrder, MoveCameraOrder, ApplyCameraOrderPreset
from .debug_tools import debug_classes as _debug_classes
from .utils import AddHDRI, ApplyModifiers, CurvesToMesh
from .generator import ComfyUIGenerate, Reproject, Regenerate, MirrorReproject
@@ -15,7 +15,7 @@ bl_info = {
"name": "StableGen",
"category": "Object",
"author": "Ondrej Sakala",
- "version": (0, 1, 1),
+ "version": (0, 2, 0),
'blender': (4, 2, 0)
}
@@ -34,6 +34,11 @@ classes = [
ExportOrbitGIF,
CollectCameraPrompts,
CameraPromptItem,
+ CameraOrderItem,
+ SG_UL_CameraOrderList,
+ SyncCameraOrder,
+ MoveCameraOrder,
+ ApplyCameraOrderPreset,
AddHDRI,
ApplyModifiers,
CurvesToMesh,
@@ -1071,6 +1076,19 @@ def load_handler(dummy):
if bpy.context.scene:
scene = bpy.context.scene
addon_prefs = bpy.context.preferences.addons[__package__].preferences
+
+ # Re-register aspect-ratio crop overlays if any cameras have
+ # per-camera resolutions stored. GPU draw handlers do not
+ # survive file loads so they must be re-created here.
+ try:
+ from .render_tools import _sg_ensure_crop_overlay
+ for obj in scene.objects:
+ if obj.type == 'CAMERA' and 'sg_display_crop' in obj:
+ _sg_ensure_crop_overlay()
+ break
+ except Exception:
+ pass
+
if hasattr(scene, "controlnet_units") and not scene.controlnet_units:
default_unit = scene.controlnet_units.add()
default_unit.unit_type = 'depth'
@@ -1363,14 +1381,24 @@ def register():
default=False,
update=update_parameters
)
+ def _get_ipadapter_mode_items(self, context):
+ items = [
+ ('first', 'Use first generated image', '', 0),
+ ('recent', 'Use most recent generated image', '', 1),
+ ]
+ if context:
+ is_local_edit = (
+ context.scene.generation_method == 'local_edit'
+ or (context.scene.model_architecture.startswith('qwen')
+ and context.scene.qwen_generation_method == 'local_edit')
+ )
+ if is_local_edit:
+ items.append(('original_render', 'Use original render', 'Uses the existing texture render from each camera viewpoint as IPAdapter reference', 2))
+ return items
bpy.types.Scene.sequential_ipadapter_mode = bpy.props.EnumProperty(
name="IPAdapter Mode",
description="Mode for IPAdapter in sequential generation",
- items=[
- ('first', 'Use first generated image', ''),
- ('recent', 'Use most recent generated image', ''),
- ],
- default='first',
+ items=_get_ipadapter_mode_items,
update=update_parameters
)
bpy.types.Scene.sequential_desaturate_factor = bpy.props.FloatProperty(
@@ -1439,6 +1467,14 @@ def register():
default=False,
update=update_parameters
)
+ bpy.types.Scene.qwen_timestep_zero_ref = bpy.props.BoolProperty(
+ name="Timestep-Zero References",
+ description="Tell the model that reference images are fully clean (timestep 0) instead of noisy. "
+ "Reduces color shift and over-saturation, especially with Qwen 2511. "
+ "Requires the FluxKontextMultiReferenceLatentMethod node in ComfyUI",
+ default=False,
+ update=update_parameters
+ )
bpy.types.Scene.refine_images = bpy.props.BoolProperty(
name="Refine Images",
description="Refine images after generation",
@@ -1562,6 +1598,20 @@ def register():
max=180.0,
update=update_parameters
)
+ bpy.types.Scene.weight_exponent_generation_only = bpy.props.BoolProperty(
+ name="Reset Exponent After Generation",
+ description="If enabled, the Weight Exponent will be reset to a specified value after generation completes. Useful for Voronoi projection mode where a high exponent produces sharp segmentation during generation but softer blending is preferred for the final result",
+ default=False,
+ update=update_parameters
+ )
+ bpy.types.Scene.weight_exponent_after_generation = bpy.props.FloatProperty(
+ name="Exponent After Generation",
+ description="The value to set the Weight Exponent to after generation is complete",
+ default=15.0,
+ min=0.01,
+ max=1000.0,
+ update=update_parameters
+ )
bpy.types.Scene.view_blend_use_color_match = bpy.props.BoolProperty(
name="Match Colors to Viewport",
description="Match each generated view’s colors to the current viewport texture before blending",
@@ -1714,7 +1764,7 @@ def register():
bpy.types.Scene.visibility_vignette_softness = bpy.props.FloatProperty(
name="Vignette Softness",
description="Exponent shaping feather falloff (<1 = sharper transition, >1 = softer/wider transition)",
- default=0.5,
+ default=1.0,
min=0.1,
max=5.0,
update=update_parameters,
@@ -1730,7 +1780,7 @@ def register():
bpy.types.Scene.refine_angle_ramp_active = bpy.props.BoolProperty(
name="Use Angle Ramp",
description="Blend refinement based on surface angle",
- default=False,
+ default=True,
update=update_parameters
)
bpy.types.Scene.refine_angle_ramp_pos_0 = bpy.props.FloatProperty(
@@ -1744,7 +1794,7 @@ def register():
bpy.types.Scene.refine_angle_ramp_pos_1 = bpy.props.FloatProperty(
name="Angle Ramp White Point",
description="Position of the white point (Visible) for the angle ramp",
- default=0.6,
+ default=0.05,
min=0.0,
max=1.0,
update=update_parameters
@@ -1772,7 +1822,7 @@ def register():
"silhouette boundary as an additional multiplier on top of the "
"angle×feather weight. Interior surfaces keep full strength; "
"only the geometric edge is softened",
- default=False,
+ default=True,
update=update_parameters
)
bpy.types.Scene.refine_edge_feather_width = bpy.props.IntProperty(
@@ -2033,6 +2083,23 @@ def register():
default=True,
update=update_parameters
)
+
+ bpy.types.Scene.sg_camera_order = bpy.props.CollectionProperty(
+ type=CameraOrderItem,
+ name="Camera Generation Order",
+ description="Defines the order in which cameras are processed during generation"
+ ) # type: ignore
+ bpy.types.Scene.sg_camera_order_index = bpy.props.IntProperty(
+ name="Active Camera Order Index",
+ default=0
+ )
+ bpy.types.Scene.sg_use_custom_camera_order = bpy.props.BoolProperty(
+ name="Use Custom Camera Order",
+ description="When enabled, generation uses the custom camera order list instead of alphabetical sorting",
+ default=False,
+ update=update_parameters
+ )
+
bpy.types.Scene.show_core_settings = bpy.props.BoolProperty(
name="Core Generation Settings",
description="Parameters used for the image generation process. Also includes LoRAs for faster generation.",
@@ -2047,6 +2114,13 @@ def register():
update=update_parameters
)
+ bpy.types.Scene.show_camera_options = bpy.props.BoolProperty(
+ name="Camera Settings",
+ description="Camera prompt and generation order settings.",
+ default=False,
+ update=update_parameters
+ )
+
bpy.types.Scene.show_scene_understanding_settings = bpy.props.BoolProperty(
name="Viewpoint Blending Settings",
description="Settings for how the addon blends different viewpoints together.",
@@ -2192,6 +2266,8 @@ def unregister():
del bpy.types.Scene.discard_factor_generation_only
del bpy.types.Scene.discard_factor_after_generation
del bpy.types.Scene.weight_exponent
+ del bpy.types.Scene.weight_exponent_generation_only
+ del bpy.types.Scene.weight_exponent_after_generation
del bpy.types.Scene.allow_modify_existing_textures
del bpy.types.Scene.ask_object_prompts
del bpy.types.Scene.fallback_color
@@ -2235,8 +2311,12 @@ def unregister():
del bpy.types.Scene.output_timestamp
del bpy.types.Scene.camera_prompts
del bpy.types.Scene.use_camera_prompts
+ del bpy.types.Scene.sg_camera_order
+ del bpy.types.Scene.sg_camera_order_index
+ del bpy.types.Scene.sg_use_custom_camera_order
del bpy.types.Scene.show_core_settings
del bpy.types.Scene.show_lora_settings
+ del bpy.types.Scene.show_camera_options
del bpy.types.Scene.show_scene_understanding_settings
del bpy.types.Scene.show_output_material_settings
del bpy.types.Scene.show_image_guidance_settings
@@ -2263,6 +2343,7 @@ def unregister():
del bpy.types.Scene.qwen_context_cleanup_hue_tolerance
del bpy.types.Scene.qwen_context_cleanup_value_adjust
del bpy.types.Scene.qwen_context_fallback_dilation
+ del bpy.types.Scene.qwen_timestep_zero_ref
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
diff --git a/stablegen/blender_manifest.toml b/stablegen/blender_manifest.toml
index 2888577..30f36eb 100644
--- a/stablegen/blender_manifest.toml
+++ b/stablegen/blender_manifest.toml
@@ -1,6 +1,6 @@
schema_version = "1.0.0"
id = "stablegen"
-version = "0.1.1"
+version = "0.2.0"
name = "StableGen"
tagline = "AI-Powered Texturing"
maintainer = "Ondrej Sakala <[email protected]>"
diff --git a/stablegen/debug_tools.py b/stablegen/debug_tools.py
index 7cc5735..19d8ba4 100644
--- a/stablegen/debug_tools.py
+++ b/stablegen/debug_tools.py
@@ -391,6 +391,19 @@ class SG_OT_DebugCoverageHeatmap(bpy.types.Operator):
bl_label = "Project Coverage Heatmap"
bl_options = {'REGISTER', 'UNDO'}
+ mode: bpy.props.EnumProperty(
+ name="Mode",
+ items=[
+ ('AVERAGE', "Average",
+ "Sum all camera weights and divide by camera count. "
+ "Shows mean coverage across all cameras"),
+ ('MAX', "Best Camera",
+ "Take the maximum single-camera weight at each point. "
+ "Shows the best coverage available, ignoring overlap"),
+ ],
+ default='AVERAGE',
+ ) # type: ignore
+
@classmethod
def poll(cls, context):
return _common_poll(cls, context)
@@ -428,8 +441,8 @@ class SG_OT_DebugCoverageHeatmap(bpy.types.Operator):
use_native = bpy.app.version >= (5, 1, 0)
- # Sum angle weights from all cameras
- sum_node = None
+ # Accumulate angle weights from all cameras
+ accum_node = None
for i, cam in enumerate(cameras):
if use_native:
result = create_native_raycast_visibility(
@@ -440,44 +453,115 @@ class SG_OT_DebugCoverageHeatmap(bpy.types.Operator):
w_node.outputs[0].default_value = 1.0
w_node.location = (-400, -800 * i)
- if sum_node is None:
- sum_node = w_node
+ if accum_node is None:
+ accum_node = w_node
else:
- add = nodes.new("ShaderNodeMath")
- add.operation = 'ADD'
- add.location = (600 + i * 100, -100 * i)
- links.new(sum_node.outputs[0], add.inputs[0])
- links.new(w_node.outputs[0], add.inputs[1])
- sum_node = add
-
- # Normalise by camera count
- div = nodes.new("ShaderNodeMath")
- div.operation = 'DIVIDE'
- div.location = (1200, 0)
- div.inputs[1].default_value = max(len(cameras), 1)
- links.new(sum_node.outputs[0], div.inputs[0])
-
- # Color ramp: 0 → red, 0.5 → yellow, 1 → green
+ combine = nodes.new("ShaderNodeMath")
+ combine.operation = ('MAXIMUM'
+ if self.mode == 'MAX' else 'ADD')
+ combine.location = (600 + i * 100, -100 * i)
+ links.new(accum_node.outputs[0], combine.inputs[0])
+ links.new(w_node.outputs[0], combine.inputs[1])
+ accum_node = combine
+
+ # Normalise: divide by camera count (average) or clamp to 1 (max)
+ if self.mode == 'MAX':
+ norm = nodes.new("ShaderNodeMath")
+ norm.operation = 'MINIMUM'
+ norm.location = (1200, 0)
+ norm.inputs[1].default_value = 1.0
+ links.new(accum_node.outputs[0], norm.inputs[0])
+ else:
+ norm = nodes.new("ShaderNodeMath")
+ norm.operation = 'DIVIDE'
+ norm.location = (1200, 0)
+ norm.inputs[1].default_value = max(len(cameras), 1)
+ links.new(accum_node.outputs[0], norm.inputs[0])
+
+ # ── Log-scale to spread out low-coverage differences ──
+ # Formula: log(1 + value * 9) / log(10)
+ # Maps 0→0, 1→1 but stretches the low end significantly.
+ scale9 = nodes.new("ShaderNodeMath")
+ scale9.operation = 'MULTIPLY'
+ scale9.location = (1300, -100)
+ scale9.inputs[1].default_value = 9.0
+ links.new(norm.outputs[0], scale9.inputs[0])
+
+ add1 = nodes.new("ShaderNodeMath")
+ add1.operation = 'ADD'
+ add1.location = (1400, -100)
+ add1.inputs[1].default_value = 1.0
+ links.new(scale9.outputs[0], add1.inputs[0])
+
+ log_node = nodes.new("ShaderNodeMath")
+ log_node.operation = 'LOGARITHM'
+ log_node.location = (1500, -100)
+ log_node.inputs[1].default_value = 10.0
+ links.new(add1.outputs[0], log_node.inputs[0])
+
+ # ── Detect zero coverage (sum == 0) for distinct color ──
+ is_zero = nodes.new("ShaderNodeMath")
+ is_zero.operation = 'LESS_THAN'
+ is_zero.location = (1300, 200)
+ is_zero.inputs[1].default_value = 0.001
+ links.new(accum_node.outputs[0], is_zero.inputs[0])
+
+ # Non-linear color ramp with more low-end stops:
+ # 0.0 → dark red (very low coverage)
+ # 0.15 → red
+ # 0.30 → orange
+ # 0.50 → yellow
+ # 0.75 → yellow-green
+ # 1.0 → green (excellent coverage)
ramp = nodes.new("ShaderNodeValToRGB")
- ramp.location = (1400, 0)
+ ramp.location = (1700, 0)
ramp.color_ramp.interpolation = 'LINEAR'
elements = ramp.color_ramp.elements
+ # Stop 0: dark red
elements[0].position = 0.0
- elements[0].color = (1.0, 0.0, 0.0, 1.0) # red
- elements[1].position = 1.0
- elements[1].color = (0.0, 1.0, 0.0, 1.0) # green
- mid = elements.new(0.5)
- mid.color = (1.0, 1.0, 0.0, 1.0) # yellow
-
- links.new(div.outputs[0], ramp.inputs["Fac"])
+ elements[0].color = (0.4, 0.0, 0.0, 1.0)
+ # Stop 1: bright red
+ elements[1].position = 0.15
+ elements[1].color = (1.0, 0.0, 0.0, 1.0)
+ # Stop 2: orange
+ s2 = elements.new(0.30)
+ s2.color = (1.0, 0.5, 0.0, 1.0)
+ # Stop 3: yellow
+ s3 = elements.new(0.50)
+ s3.color = (1.0, 1.0, 0.0, 1.0)
+ # Stop 4: yellow-green
+ s4 = elements.new(0.75)
+ s4.color = (0.5, 1.0, 0.0, 1.0)
+ # Stop 5 (already at 1.0 from elements[1] which got pushed):
+ # Ensure last element is green at 1.0
+ last = ramp.color_ramp.elements[-1]
+ last.position = 1.0
+ last.color = (0.0, 1.0, 0.0, 1.0)
+
+ links.new(log_node.outputs[0], ramp.inputs["Fac"])
+
+ # Mix: if zero coverage → magenta, else → ramp color
+ zero_color = nodes.new("ShaderNodeRGB")
+ zero_color.location = (1700, 300)
+ zero_color.outputs[0].default_value = (0.8, 0.0, 0.8, 1.0) # magenta
+
+ mix = nodes.new("ShaderNodeMixRGB")
+ mix.location = (1900, 100)
+ mix.blend_type = 'MIX'
+ links.new(is_zero.outputs[0], mix.inputs["Fac"])
+ links.new(ramp.outputs["Color"], mix.inputs["Color1"])
+ links.new(zero_color.outputs[0], mix.inputs["Color2"])
# Emission so it's visible in solid mode too
emit = nodes.new("ShaderNodeEmission")
- emit.location = (1700, 0)
- links.new(ramp.outputs["Color"], emit.inputs["Color"])
+ emit.location = (2100, 0)
+ links.new(mix.outputs["Color"], emit.inputs["Color"])
links.new(emit.outputs[0], output.inputs["Surface"])
- self.report({'INFO'}, f"Coverage heatmap applied ({len(cameras)} cameras)")
+ mode_label = 'best-camera' if self.mode == 'MAX' else 'average'
+ self.report({'INFO'},
+ f"Coverage heatmap applied ({len(cameras)} cameras, "
+ f"{mode_label} mode)")
return {'FINISHED'}
diff --git a/stablegen/generator.py b/stablegen/generator.py
index ebdb1d8..e154cf6 100644
--- a/stablegen/generator.py
+++ b/stablegen/generator.py
@@ -494,6 +494,20 @@ class ComfyUIGenerate(bpy.types.Operator):
# Sort cameras by name
self._cameras.sort(key=lambda x: x.name)
+ # Apply custom generation order if enabled (non-destructive reorder)
+ if context.scene.sg_use_custom_camera_order and len(context.scene.sg_camera_order) > 0:
+ order_names = [item.name for item in context.scene.sg_camera_order]
+ cam_by_name = {cam.name: cam for cam in self._cameras}
+ ordered = []
+ for name in order_names:
+ if name in cam_by_name:
+ ordered.append(cam_by_name.pop(name))
+ # Append any cameras not in the order list (newly added cameras)
+ for cam in self._cameras:
+ if cam.name in cam_by_name:
+ ordered.append(cam)
+ self._cameras = ordered
+
# Hide crop and label overlays during generation
_sg_remove_crop_overlay()
_sg_hide_label_overlay()
@@ -565,29 +579,6 @@ class ComfyUIGenerate(bpy.types.Operator):
if not context.scene.overwrite_material or self._material_id == -1 or (context.scene.generation_method == 'local_edit' or (context.scene.model_architecture.startswith('qwen') and context.scene.qwen_generation_method == 'local_edit')):
self._material_id += 1
- if context.scene.generation_method == 'sequential' and context.scene.sequential_custom_camera_order != "":
- # The format is: index1,index2,index3,...,indexN
- camera_order = context.scene.sequential_custom_camera_order.split(',')
- # Check if there is index for each camera
- if len(camera_order) != len(self._cameras):
- self.report({'ERROR'}, "The number of indices in the custom camera order must match the number of cameras.")
- context.scene.generation_status = 'idle'
- ComfyUIGenerate._is_running = False
- return {'CANCELLED'}
- # Make a backup of all cameras, remove and then add them in the custom order
- cameras = self._cameras.copy()
- cameras_backup = [camera.copy() for camera in cameras]
- for camera in cameras:
- bpy.data.objects.remove(camera)
- self._cameras = []
- # Re-add the cameras in the custom order
- for i, index in enumerate(camera_order):
- camera = cameras_backup[int(index)]
- # Rename the camera to match the index
- camera.name = f"Camera_{i}"
- self._cameras.append(camera)
- bpy.context.scene.collection.objects.link(camera)
-
if context.scene.generation_mode == 'standard' or context.scene.generation_mode == 'regenerate_selected':
# If there is depth controlnet unit
if any(unit["unit_type"] == "depth" for unit in controlnet_units) or (context.scene.use_flux_lora and context.scene.model_architecture == 'flux1') or (context.scene.model_architecture == 'qwen_image_edit' and context.scene.qwen_guidance_map_type == 'depth') or (context.scene.model_architecture.startswith('qwen') and context.scene.qwen_generation_method in ('refine', 'local_edit') and context.scene.qwen_refine_use_depth):
@@ -766,12 +757,22 @@ class ComfyUIGenerate(bpy.types.Operator):
# Regenerate mode preparation
if context.scene.generation_mode == 'regenerate_selected':
- # Reset weights for selected viewpoints
- # Prepare list of camera_ids and material_ids to reset weights for
- ids = []
- for camera_id in self._selected_camera_ids:
- ids.append((camera_id, self._material_id))
- reinstate_compare_nodes(context, self._to_texture, ids)
+ if context.scene.generation_method == 'sequential':
+ # Sequential regeneration: reset all cameras from the first
+ # selected onward so the projection sequence replays correctly.
+ # Non-selected cameras reuse their existing images but still
+ # get reprojected, keeping subsequent cameras' context intact.
+ first_selected = min(self._selected_camera_ids)
+ ids = [(cid, self._material_id)
+ for cid in range(first_selected, len(self._cameras))]
+ reinstate_compare_nodes(context, self._to_texture, ids)
+ self._current_image = first_selected
+ self._threads_left = len(self._cameras) - first_selected
+ else:
+ # Non-sequential modes: only reset selected cameras
+ ids = [(cid, self._material_id)
+ for cid in self._selected_camera_ids]
+ reinstate_compare_nodes(context, self._to_texture, ids)
# Add modal timer
context.window_manager.modal_handler_add(self)
@@ -780,7 +781,8 @@ class ComfyUIGenerate(bpy.types.Operator):
if context.scene.generation_method == 'grid':
self._thread = threading.Thread(target=self.async_generate, args=(context,))
else:
- self._thread = threading.Thread(target=self.async_generate, args=(context, 0))
+ _start_cam = self._current_image # 0 normally, first_selected for sequential regen
+ self._thread = threading.Thread(target=self.async_generate, args=(context, _start_cam))
self._thread.start()
@@ -848,6 +850,29 @@ class ComfyUIGenerate(bpy.types.Operator):
print("Discard angle reset complete.")
+ # Reset weight exponent if enabled
+ if (context.scene.weight_exponent_generation_only and
+ (self._generation_method_on_start == 'sequential' or context.scene.model_architecture == 'qwen_image_edit')):
+
+ new_exponent = context.scene.weight_exponent_after_generation
+ print(f"Resetting weight exponent in material nodes to {new_exponent}...")
+
+ for obj in self._to_texture:
+ if not obj.active_material or not obj.active_material.use_nodes:
+ continue
+
+ nodes = obj.active_material.node_tree.nodes
+ for node in nodes:
+ # OSL script nodes: update 'Power' input
+ if node.type == 'SCRIPT':
+ if 'Power' in node.inputs:
+ node.inputs['Power'].default_value = new_exponent
+ # Native MATH POWER nodes (Blender 5.1+ native path)
+ elif node.type == 'MATH' and node.operation == 'POWER' and node.label == 'power_weight':
+ node.inputs[1].default_value = new_exponent
+
+ print("Weight exponent reset complete.")
+
# If viewport rendering mode is 'Rendered' and mode is 'regenerate_selected', switch to 'Solid' and then back to 'Rendered' to refresh the viewport
if context.scene.generation_mode == 'regenerate_selected' and context.area.spaces.active.shading.type == 'RENDERED':
context.area.spaces.active.shading.type = 'SOLID'
@@ -941,7 +966,36 @@ class ComfyUIGenerate(bpy.types.Operator):
if self._error:
return
- if context.scene.steps != 0 and not (context.scene.generation_mode == 'regenerate_selected' and camera_id not in self._selected_camera_ids):
+ # Sequential regeneration: non-selected cameras skip AI
+ # generation but still reproject their existing image so
+ # subsequent cameras see the correct incremental texture state.
+ _is_seq_reproject = (
+ context.scene.generation_mode == 'regenerate_selected'
+ and camera_id not in self._selected_camera_ids
+ and context.scene.generation_method == 'sequential'
+ )
+
+ if _is_seq_reproject:
+ self._stage = "Reprojecting Image"
+ self._progress = 0
+ # project_image patches the material tree for this camera,
+ # loading the existing generated image from disk.
+ def image_reproject_callback():
+ try:
+ redraw_ui(context)
+ project_image(context, self._to_texture, self._material_id, stop_index=self._current_image)
+ except Exception as e:
+ self._error = str(e)
+ traceback.print_exc()
+ self._wait_event.set()
+ return None
+ bpy.app.timers.register(image_reproject_callback)
+ self._wait_event.wait()
+ self._wait_event.clear()
+ if self._error:
+ return
+
+ elif context.scene.steps != 0 and not (context.scene.generation_mode == 'regenerate_selected' and camera_id not in self._selected_camera_ids):
# Prepare Image Info for Upload
controlnet_info = {}
mask_info = None
@@ -968,6 +1022,9 @@ class ComfyUIGenerate(bpy.types.Operator):
# Get info for IPAdapter reference image
if context.scene.use_ipadapter:
ipadapter_ref_info = self._get_uploaded_image_info(context, "custom", filename=bpy.path.abspath(context.scene.ipadapter_image))
+ elif context.scene.sequential_ipadapter and context.scene.sequential_ipadapter_mode == 'original_render' and context.scene.generation_method == 'local_edit':
+ # Use the existing texture render from this camera's viewpoint as IPAdapter reference
+ ipadapter_ref_info = self._get_uploaded_image_info(context, "inpaint", subtype="render", camera_id=camera_id)
elif context.scene.sequential_ipadapter and self._current_image > 0:
cam_id = 0 if context.scene.sequential_ipadapter_mode == 'first' else self._current_image - 1
ipadapter_ref_info = self._get_uploaded_image_info(context, "generated", camera_id=cam_id, material_id=self._material_id)
diff --git a/stablegen/render_tools.py b/stablegen/render_tools.py
index 05b9dd9..ab53270 100644
--- a/stablegen/render_tools.py
+++ b/stablegen/render_tools.py
@@ -2234,11 +2234,20 @@ def _resolution_from_aspect(aspect, total_px, align=8):
return new_x, new_y
+def _get_resolution_align(context):
+ """Return the resolution alignment step: 112 for Qwen with alignment
+ enabled, 8 otherwise."""
+ if (context.scene.model_architecture.startswith('qwen')
+ and getattr(context.scene, 'qwen_rescale_alignment', False)):
+ return 112
+ return 8
+
+
def _apply_auto_aspect(directions_np, context, verts_world):
"""Adjust scene render resolution to match the mesh's average apparent
aspect ratio across the given camera *directions_np*. This is the
'shared' mode — all cameras use the same resolution.
- Keeps total pixel count approximately constant and snaps to 8 px.
+ Keeps total pixel count approximately constant and snaps to alignment step.
Returns (new_res_x, new_res_y)."""
center = verts_world.mean(axis=0)
aspects = [_compute_per_camera_aspect(d, verts_world, center)
@@ -2247,7 +2256,8 @@ def _apply_auto_aspect(directions_np, context, verts_world):
render = context.scene.render
total_px = render.resolution_x * render.resolution_y
- new_x, new_y = _resolution_from_aspect(avg_aspect, total_px)
+ align = _get_resolution_align(context)
+ new_x, new_y = _resolution_from_aspect(avg_aspect, total_px, align=align)
render.resolution_x = new_x
render.resolution_y = new_y
return new_x, new_y
@@ -2306,6 +2316,11 @@ def _sg_draw_crop_overlays():
context = bpy.context
scene = context.scene
+ # Respect Blender's overlay toggle
+ space = context.space_data
+ if space and hasattr(space, 'overlay') and not space.overlay.show_overlays:
+ return
+
shader = gpu.shader.from_builtin('UNIFORM_COLOR')
for obj in scene.objects:
@@ -2377,6 +2392,11 @@ def _sg_draw_view_labels():
if region is None or rv3d is None:
return
+ # Respect Blender's overlay toggle
+ space = context.space_data
+ if space and hasattr(space, 'overlay') and not space.overlay.show_overlays:
+ return
+
from bpy_extras.view3d_utils import location_3d_to_region_2d
font_id = 0
@@ -3426,8 +3446,9 @@ class AddCameras(bpy.types.Operator):
d_unit = d_np / np.linalg.norm(d_np)
# --- Pass 1: orthographic aspect as initial estimate ---
+ align = _get_resolution_align(context)
aspect = _compute_per_camera_aspect(d_unit, verts_world, center_for_aspect)
- res_x, res_y = _resolution_from_aspect(aspect, total_px)
+ res_x, res_y = _resolution_from_aspect(aspect, total_px, align=align)
fov_x, fov_y = _get_fov(cam_settings, context, res_x, res_y)
dist, aim_off = _compute_silhouette_distance(
verts_world, center_np, d_np, fov_x, fov_y)
@@ -3436,7 +3457,7 @@ class AddCameras(bpy.types.Operator):
aim_point_np = center_np + aim_off
cam_pos_np = aim_point_np + d_unit * dist
aspect = _perspective_aspect(verts_world, cam_pos_np, d_np)
- res_x, res_y = _resolution_from_aspect(aspect, total_px)
+ res_x, res_y = _resolution_from_aspect(aspect, total_px, align=align)
fov_x, fov_y = _get_fov(cam_settings, context, res_x, res_y)
dist, aim_off = _compute_silhouette_distance(
verts_world, center_np, d_np, fov_x, fov_y)
@@ -3950,6 +3971,242 @@ class CameraPromptItem(bpy.types.PropertyGroup):
description="Description of the view from this camera"
) # type: ignore
+# ── Camera Generation Order ──────────────────────────────────────────────────
+
+class CameraOrderItem(bpy.types.PropertyGroup):
+ """One entry in the generation-order list. Stores the Blender camera name."""
+ name: bpy.props.StringProperty(
+ name="Camera Name",
+ description="Name of the camera object"
+ ) # type: ignore
+
+
+class SG_UL_CameraOrderList(bpy.types.UIList):
+ """UIList that shows cameras in their current generation order."""
+ bl_idname = "SG_UL_CameraOrderList"
+
+ def draw_item(self, _context, layout, _data, item, _icon,
+ _active_data, _active_propname, index):
+ cam_obj = bpy.data.objects.get(item.name)
+ if cam_obj is None:
+ layout.label(text=f"{item.name} (missing)", icon='ERROR')
+ return
+ # Show index, camera icon, name, and prompt if any
+ row = layout.row(align=True)
+ row.label(text=f"{index + 1}.")
+ row.label(text=item.name, icon='CAMERA_DATA')
+ # Show prompt preview if one exists
+ prompt_item = next(
+ (p for p in _context.scene.camera_prompts if p.name == item.name), None)
+ if prompt_item and prompt_item.prompt:
+ sub = row.row()
+ sub.scale_x = 1.5
+ sub.label(text=prompt_item.prompt, icon='SHORTDISPLAY')
+
+
+class SyncCameraOrder(bpy.types.Operator):
+ """Rebuild the generation order list from all cameras in the scene (sorted alphabetically)"""
+ bl_idname = "stablegen.sync_camera_order"
+ bl_label = "Sync Camera Order"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ def execute(self, context):
+ scene = context.scene
+ cameras = sorted(
+ [obj for obj in scene.objects if obj.type == 'CAMERA'],
+ key=lambda x: x.name)
+ scene.sg_camera_order.clear()
+ for cam in cameras:
+ item = scene.sg_camera_order.add()
+ item.name = cam.name
+ scene.sg_camera_order_index = 0
+ self.report({'INFO'}, f"Synced {len(cameras)} cameras to generation order list.")
+ return {'FINISHED'}
+
+
+class MoveCameraOrder(bpy.types.Operator):
+ """Move the selected camera up or down in the generation order"""
+ bl_idname = "stablegen.move_camera_order"
+ bl_label = "Move Camera"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ direction: bpy.props.EnumProperty(
+ items=[('UP', "Up", ""), ('DOWN', "Down", "")],
+ name="Direction"
+ ) # type: ignore
+
+ def execute(self, context):
+ scene = context.scene
+ idx = scene.sg_camera_order_index
+ total = len(scene.sg_camera_order)
+ if total < 2:
+ return {'CANCELLED'}
+ new_idx = idx - 1 if self.direction == 'UP' else idx + 1
+ if new_idx < 0 or new_idx >= total:
+ return {'CANCELLED'}
+ scene.sg_camera_order.move(idx, new_idx)
+ scene.sg_camera_order_index = new_idx
+ return {'FINISHED'}
+
+
+class ApplyCameraOrderPreset(bpy.types.Operator):
+ """Sort the generation order list using a preset strategy.
+ Cameras are first synced from the scene, then reordered."""
+ bl_idname = "stablegen.apply_camera_order_preset"
+ bl_label = "Apply Camera Order Preset"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ strategy: bpy.props.EnumProperty(
+ name="Strategy",
+ items=[
+ ('ALPHABETICAL', "Alphabetical (Original)",
+ "Sort cameras alphabetically by name (original order for auto-generated cameras)"),
+ ('FRONT_FIRST', "Front → Back → Sides",
+ "Front-facing cameras first, then back, then sides. "
+ "Prioritises the main view for sequential inpainting"),
+ ('BACK_FIRST', "Back → Front → Sides",
+ "Back-facing cameras first, then front, then sides"),
+ ('ALTERNATING', "Alternating (Opposites)",
+ "Alternate between opposing cameras (front, back, left, right…) "
+ "for maximum context spread between consecutive views"),
+ ('TOP_DOWN', "Top → Bottom",
+ "Cameras sorted from highest elevation to lowest"),
+ ('REVERSE', "Reverse Current",
+ "Reverse the current generation order"),
+ ],
+ default='FRONT_FIRST'
+ ) # type: ignore
+
+ def execute(self, context):
+ scene = context.scene
+
+ # Always sync from scene first (picks up new/removed cameras)
+ cameras = sorted(
+ [obj for obj in scene.objects if obj.type == 'CAMERA'],
+ key=lambda x: x.name)
+
+ if not cameras:
+ self.report({'ERROR'}, "No cameras in the scene.")
+ return {'CANCELLED'}
+
+ if self.strategy == 'REVERSE':
+ # Reverse whatever is currently in the list
+ names = [item.name for item in scene.sg_camera_order]
+ if not names:
+ names = [c.name for c in cameras]
+ names.reverse()
+ elif self.strategy == 'ALPHABETICAL':
+ names = [c.name for c in cameras]
+ else:
+ # Compute mesh centre for direction classification
+ mesh_objects = [obj for obj in scene.objects
+ if obj.type == 'MESH' and not obj.hide_get()]
+ if mesh_objects:
+ centres = [obj.matrix_world @ (
+ sum((mathutils.Vector(v.co) for v in obj.data.vertices),
+ mathutils.Vector()) / max(len(obj.data.vertices), 1))
+ for obj in mesh_objects]
+ mesh_center = sum(centres, mathutils.Vector()) / len(centres)
+ else:
+ mesh_center = mathutils.Vector((0, 0, 0))
+
+ mc = np.array(mesh_center, dtype=float)
+
+ # Use the first camera (alphabetically) as the reference
+ # "front" direction — avoids assuming any world axis is front.
+ ref_pos = np.array(cameras[0].location, dtype=float)
+ ref_d = ref_pos - mc
+ ref_d_xy = ref_d[:2]
+ ref_xy_len = np.linalg.norm(ref_d_xy)
+ if ref_xy_len < 1e-8:
+ ref_d_xy = np.array([0.0, 1.0])
+ else:
+ ref_d_xy = ref_d_xy / ref_xy_len
+
+ # Compute direction angles for each camera
+ cam_data = []
+ for cam in cameras:
+ pos = np.array(cam.location, dtype=float)
+ d = pos - mc
+ norm = np.linalg.norm(d)
+ if norm < 1e-8:
+ d = np.array([0, 1, 0], dtype=float)
+ else:
+ d /= norm
+ # Elevation (angle above XY plane)
+ elev = math.degrees(math.asin(np.clip(d[2], -1, 1)))
+ # Azimuth relative to the first camera's XY direction
+ d_xy = d[:2]
+ d_xy_len = np.linalg.norm(d_xy)
+ if d_xy_len < 1e-8:
+ azimuth = 0.0
+ else:
+ d_xy = d_xy / d_xy_len
+ cos_a = float(np.clip(np.dot(d_xy, ref_d_xy), -1, 1))
+ cross = float(ref_d_xy[0] * d_xy[1]
+ - ref_d_xy[1] * d_xy[0])
+ azimuth = math.degrees(math.atan2(cross, cos_a))
+ cam_data.append((cam.name, elev, azimuth))
+
+ if self.strategy == 'FRONT_FIRST':
+ # Priority: front (small |azimuth|), then back (large |azimuth|), then sides
+ def _front_key(item):
+ _name, _elev, az = item
+ abs_az = abs(az)
+ if abs_az <= 45:
+ bucket = 0 # front
+ elif abs_az >= 135:
+ bucket = 1 # back
+ else:
+ bucket = 2 # sides
+ return (bucket, abs_az, -_elev)
+ cam_data.sort(key=_front_key)
+
+ elif self.strategy == 'BACK_FIRST':
+ def _back_key(item):
+ _name, _elev, az = item
+ abs_az = abs(az)
+ if abs_az >= 135:
+ bucket = 0 # back
+ elif abs_az <= 45:
+ bucket = 1 # front
+ else:
+ bucket = 2 # sides
+ return (bucket, -abs_az, -_elev)
+ cam_data.sort(key=_back_key)
+
+ elif self.strategy == 'ALTERNATING':
+ # Sort by azimuth, then pick from alternating ends
+ cam_data.sort(key=lambda x: x[2])
+ alternated = []
+ left, right = 0, len(cam_data) - 1
+ pick_left = True
+ while left <= right:
+ if pick_left:
+ alternated.append(cam_data[left])
+ left += 1
+ else:
+ alternated.append(cam_data[right])
+ right -= 1
+ pick_left = not pick_left
+ cam_data = alternated
+
+ elif self.strategy == 'TOP_DOWN':
+ cam_data.sort(key=lambda x: -x[1]) # highest elevation first
+
+ names = [item[0] for item in cam_data]
+
+ # Apply to collection
+ scene.sg_camera_order.clear()
+ for n in names:
+ item = scene.sg_camera_order.add()
+ item.name = n
+ scene.sg_camera_order_index = 0
+ self.report({'INFO'},
+ f"Applied '{self.strategy}' order to {len(names)} cameras.")
+ return {'FINISHED'}
+
+
class CollectCameraPrompts(bpy.types.Operator):
"""Cycles through cameras and prompts for a viewpoint description for each. This can help when specific perspectives fail to generate correctly.
@@ -4663,6 +4920,16 @@ class ExportOrbitGIF(bpy.types.Operator):
default='CYCLES'
) # type: ignore
+ interpolation: bpy.props.EnumProperty(
+ name="Rotation Curve",
+ description="Keyframe interpolation for the orbit rotation",
+ items=[
+ ('LINEAR', "Linear", "Constant speed throughout the orbit"),
+ ('BEZIER', "Ease In/Out", "Smooth acceleration and deceleration"),
+ ],
+ default='LINEAR'
+ ) # type: ignore
+
_timer = None
_rendering = False
_cancelled = False # Added flag to track cancellation
@@ -4728,6 +4995,48 @@ class ExportOrbitGIF(bpy.types.Operator):
return context.window_manager.invoke_props_dialog(self)
+ @staticmethod
+ def _force_fcurve_interpolation(obj, interpolation_type):
+ """Set interpolation on all keyframe points of *obj*'s fcurves.
+
+ Works on Blender 4.x (action.fcurves) and 5.x+ (layered actions
+ with slots / channelbags).
+ """
+ anim = obj.animation_data
+ if not anim or not anim.action:
+ return
+
+ action = anim.action
+ fcurves = []
+
+ # Blender 5.x layered-action API (slots → channelbags → fcurves)
+ action_slot = getattr(anim, "action_slot", None)
+ if action_slot is not None:
+ # Try the helper shipped in bpy_extras first
+ try:
+ from bpy_extras.anim_utils import action_get_channelbag_for_slot
+ bag = action_get_channelbag_for_slot(action, action_slot)
+ if bag is not None:
+ fcurves = list(bag.fcurves)
+ except Exception:
+ pass
+ # Manual fallback: iterate channelbags on the *action*
+ if not fcurves:
+ for attr in ("channelbags", "channel_bags"):
+ bags = getattr(action, attr, None)
+ if bags is not None:
+ for bag in bags:
+ fcurves.extend(bag.fcurves)
+ break
+
+ # Blender 4.x legacy path
+ if not fcurves and hasattr(action, "fcurves"):
+ fcurves = list(action.fcurves)
+
+ for fc in fcurves:
+ for kf in fc.keyframe_points:
+ kf.interpolation = interpolation_type
+
def setup_animation(self, context):
obj = context.active_object
scene = context.scene
@@ -4776,31 +5085,23 @@ class ExportOrbitGIF(bpy.types.Operator):
scene.render.fps = self.frame_rate
# Animate Empty's Rotation
- self._temp_empty.rotation_euler = (0, 0, 0)
- self._temp_empty.keyframe_insert(data_path="rotation_euler", index=2, frame=1) # Keyframe Z rotation at frame 1
-
- self._temp_empty.rotation_euler = (0, 0, math.radians(360))
- # Keyframe Z rotation at end frame + 1 for full circle and correct interpolation
- self._temp_empty.keyframe_insert(data_path="rotation_euler", index=2, frame=total_frames + 1)
-
- # Set Interpolation to Linear for smooth rotation
- if self._temp_empty.animation_data and self._temp_empty.animation_data.action:
- action = self._temp_empty.animation_data.action
- # Blender 5.0+ uses slots/channelbags API for fcurves
- if hasattr(action, 'slots') and action.slots:
- slot = action.slots[0]
- for channelbag in slot.channelbags:
- for fcurve in channelbag.fcurves:
- if fcurve.data_path == "rotation_euler" and fcurve.array_index == 2:
- for kf_point in fcurve.keyframe_points:
- kf_point.interpolation = 'LINEAR'
- fcurve.extrapolation = 'LINEAR'
- else:
- for fcurve in action.fcurves:
- if fcurve.data_path == "rotation_euler" and fcurve.array_index == 2:
- for kf_point in fcurve.keyframe_points:
- kf_point.interpolation = 'LINEAR'
- fcurve.extrapolation = 'LINEAR'
+ # Set keyframe interpolation type before inserting so keyframes
+ # are created with the correct curve.
+ prefs = bpy.context.preferences.edit
+ prev_interp = prefs.keyframe_new_interpolation_type
+ prefs.keyframe_new_interpolation_type = self.interpolation
+ try:
+ self._temp_empty.rotation_euler = (0, 0, 0)
+ self._temp_empty.keyframe_insert(data_path="rotation_euler", index=2, frame=1)
+
+ self._temp_empty.rotation_euler = (0, 0, math.radians(360))
+ self._temp_empty.keyframe_insert(data_path="rotation_euler", index=2, frame=total_frames + 1)
+ finally:
+ prefs.keyframe_new_interpolation_type = prev_interp
+
+ # Post-insert: force the chosen interpolation on all keyframe points.
+ # The preference alone doesn't always take effect on Blender 5.x.
+ self._force_fcurve_interpolation(self._temp_empty, self.interpolation)
def execute(self, context):
@@ -4824,7 +5125,8 @@ class ExportOrbitGIF(bpy.types.Operator):
'engine': scene.render.engine, # Store original engine
'film_transparent': render.film_transparent, # Store original film transparency
'light': scene.display.shading.light, # Store original shading light
- 'color_type': scene.display.shading.color_type # Store original shading color type
+ 'color_type': scene.display.shading.color_type, # Store original shading color type
+ 'use_compositing': render.use_compositing, # Store compositor pipeline state
}
scene.render.engine = get_eevee_engine_id() if self.engine == 'EEVEE' else self.engine
@@ -4833,6 +5135,13 @@ class ExportOrbitGIF(bpy.types.Operator):
context.scene.display.shading.light = 'STUDIO'
context.scene.display.shading.color_type = 'SINGLE'
+ # Disable compositing in the render pipeline so Blender writes
+ # the raw ViewLayer result to render.filepath. StableGen's
+ # compositor uses File Output nodes without a Composite node,
+ # which causes the Composite output (and thus saved frames) to be
+ # blank/transparent.
+ render.use_compositing = False
+
# Apply Render Settings for PNG sequence
render.filepath = os.path.join(self._temp_dir, "frame_") # Base path for frames
render.image_settings.file_format = 'PNG' # Render as PNG sequence
@@ -4955,6 +5264,8 @@ class ExportOrbitGIF(bpy.types.Operator):
setattr(render, key, value)
elif key == 'film_transparent': # Restore film transparency
setattr(render, key, value)
+ elif key == 'use_compositing': # Restore compositor pipeline state
+ render.use_compositing = value
elif hasattr(render, key):
setattr(render, key, value)
elif hasattr(scene, key):
diff --git a/stablegen/stablegen.py b/stablegen/stablegen.py
index a951ac3..ab3b59e 100644
--- a/stablegen/stablegen.py
+++ b/stablegen/stablegen.py
@@ -14,12 +14,17 @@ PRESETS = {
"QUICK DRAFT": {"description": "Optimized for speed", "control_after_generate": "fixed", "model_architecture": "sdxl", "steps": 4, "cfg": 1.0, "sampler": "dpmpp_2s_ancestral", "scheduler": "sgm_uniform", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "weight_exponent": 3.0, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "grid", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.7, "sequential_factor_smooth": 0.1, "sequential_ipadapter": True, "sequential_ipadapter_mode": "first", "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 2, "blur_mask_sigma": 1.0, "grow_mask_by": 2, "canny_threshold_low": 0, "canny_threshold_high": 80, "controlnet_units": [{'unit_type': 'depth', 'model_name': 'controlnet_depth_sdxl.safetensors', 'strength': 0.5, 'start_percent': 0.0, 'end_percent': 1.0, 'is_union': False, 'use_union_type': True}], "lora_units": [{'model_name': 'Hyper-SDXL-4steps-lora.safetensors', 'model_strength': 1.0, 'clip_strength': 1.0}]},
"UV INPAINTING": {"description": "Recommended UV Inpainting setup. It is recommended to bake texutures manually before running the generation to fine-tune unwrapping and avoid lag when generating.", "control_after_generate": "fixed", "model_architecture": "sdxl", "steps": 10, "cfg": 1.5, "sampler": "dpmpp_2s_ancestral", "scheduler": "sgm_uniform", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 80.0, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "uv_inpaint", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "3,0,1,2", "sequential_factor": 0.6000000238418579, "sequential_factor_smooth": 0.11000001430511475, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "first", "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 3, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "lora_units": [{'model_name': 'sdxl_lightning_8step_lora.safetensors', 'model_strength': 1.0, 'clip_strength': 1.0}]}, # No ControlNet for UV Inpainting by default
"ARCHITECTURE": {"description": "Prioritizes only the most straight-on camera for each point. This means details generated on flat surfaces will not get blurred by getting generated differently from two or more viewpoints. Does not use visibility masking. Each picture will get generated as new, consistency depends on IPAdapter + geometry.", "control_after_generate": "fixed", "model_architecture": "sdxl", "steps": 8, "cfg": 1.5, "sampler": "dpmpp_2s_ancestral", "scheduler": "sgm_uniform", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 80.0, "weight_exponent": 10.0, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "separate", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": False, "sequential_custom_camera_order": "", "sequential_factor": 0.75, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "first", "ipadapter_weight_type": "style", "ipadapter_strength": 0.800000011920929, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": False, "blur_mask": True, "blur_mask_radius": 3, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "controlnet_units": [{'unit_type': 'depth', 'model_name': 'controlnet_depth_sdxl.safetensors', 'strength': 0.6000000238418579, 'start_percent': 0.0, 'end_percent': 1.0, 'is_union': False, 'use_union_type': True}], "lora_units": [{'model_name': 'sdxl_lightning_8step_lora.safetensors', 'model_strength': 1.0, 'clip_strength': 1.0}]},
- "QWEN EDIT PRECISE": {"description": "Precise detail when camera overlap is good. Relies on context renders plus the prompt, so sparse coverage can still introduce artifacts.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": False, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.0, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
- "QWEN EDIT SAFE": {"description": "Safer fallback when coverage is limited. Uses the previous view (recent mode) instead of context renders to keep global look coherent, at the cost of some fine-detail persistence.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 6.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "early_priority": False, "early_priority_strength": 0.5, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "NONE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
- "QWEN EDIT ALT": {"description": "Balanced option that mixes additional context renders with sequential references to smooth out coverage while keeping detail reasonable.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "recent", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "ADDITIONAL", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "early_priority": True, "early_priority_strength": 0.5, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
- "QWEN EDIT PRECISE (NUNCHAKU)": {"description": "Precise detail using Nunchaku. Meant to be used with the Nunchaku model which has the 4-step Lightning LoRA included. Requires Nunchaku nodes.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": False, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.0, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": []},
- "QWEN EDIT SAFE (NUNCHAKU)": {"description": "Safer fallback using Nunchaku. Meant to be used with the Nunchaku model which has the 4-step Lightning LoRA included. Requires Nunchaku nodes.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 6.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "early_priority": False, "early_priority_strength": 0.5, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "NONE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": []},
- "QWEN EDIT ALT (NUNCHAKU)": {"description": "Balanced option using Nunchaku. Meant to be used with the Nunchaku model which has the 4-step Lightning LoRA included. Requires Nunchaku nodes.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "recent", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "ADDITIONAL", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "early_priority": True, "early_priority_strength": 0.5, "lora_units": []},
+ "QWEN PRECISE": {"description": "Precise detail when camera overlap is good. Relies on context renders plus the prompt, so sparse coverage can still introduce artifacts.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit","qwen_generation_method": "generate", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": False, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.0, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
+ "QWEN SAFE": {"description": "Safer fallback when coverage is limited. Uses the previous view (recent mode) instead of context renders to keep global look coherent, at the cost of some fine-detail persistence.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "generate", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 6.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "early_priority": False, "early_priority_strength": 0.5, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "NONE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
+ "QWEN ALT": {"description": "Balanced option that mixes additional context renders with sequential references to smooth out coverage while keeping detail reasonable.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "generate", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "recent", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "ADDITIONAL", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "early_priority": True, "early_priority_strength": 0.5, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
+ "QWEN VORONOI": {"description": "Voronoi projection mode with exponent 1000 for hard camera segmentation during generation, then resets to 15 for softer blending. Each surface point is dominated by its closest camera. Based on Qwen Precise.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "generate", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 1000.0, "weight_exponent_generation_only": True, "weight_exponent_after_generation": 15.0, "qwen_voronoi_mode": True, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": False, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.0, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
+ "QWEN PRECISE (NUNCHAKU)": {"description": "Precise detail using Nunchaku. Meant to be used with the Nunchaku model which has the 4-step Lightning LoRA included. Requires Nunchaku nodes.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "generate", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": False, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.0, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": []},
+ "QWEN SAFE (NUNCHAKU)": {"description": "Safer fallback using Nunchaku. Meant to be used with the Nunchaku model which has the 4-step Lightning LoRA included. Requires Nunchaku nodes.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "generate", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 6.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "early_priority": False, "early_priority_strength": 0.5, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "NONE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": []},
+ "QWEN ALT (NUNCHAKU)": {"description": "Balanced option using Nunchaku. Meant to be used with the Nunchaku model which has the 4-step Lightning LoRA included. Requires Nunchaku nodes.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "generate", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "qwen_voronoi_mode": False, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "recent", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "ADDITIONAL", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "early_priority": True, "early_priority_strength": 0.5, "lora_units": []},
+ "QWEN VORONOI (NUNCHAKU)": {"description": "Voronoi projection mode using Nunchaku. Exponent 1000 for hard camera segmentation during generation, then resets to 15 for softer blending. Requires Nunchaku nodes.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "generate", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 1000.0, "weight_exponent_generation_only": True, "weight_exponent_after_generation": 15.0, "qwen_voronoi_mode": True, "clip_skip": 1, "auto_rescale": True, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.8, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": False, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.0, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "lora_units": []},
+ "LOCAL REFINE": {"description": "Uses the SDXL local edit mode to improve detail / refine specific areas. Use new set of cameras or a single camera pointed at the area you want to refine.", "control_after_generate": "fixed", "model_architecture": "sdxl", "steps": 8, "cfg": 1.5, "sampler": "dpmpp_2s_ancestral", "scheduler": "sgm_uniform", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 80.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "weight_exponent_generation_only": False, "weight_exponent_after_generation": 15.0, "view_blend_use_color_match": False, "view_blend_color_match_method": "reinhard", "view_blend_color_match_strength": 1.0, "clip_skip": 1, "auto_rescale": True, "auto_rescale_target_mp": 1.0, "overwrite_material": True, "generation_method": "local_edit", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 0.800000011920929, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": True, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.10000000149011612, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": True, "sequential_ipadapter_mode": "original_render", "sequential_desaturate_factor": 0.10000000149011612, "sequential_contrast_factor": 0.10000000149011612, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "early_priority": False, "early_priority_strength": 0.5, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_voronoi_mode": True, "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 5.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": True, "refine_angle_ramp_active": True, "refine_angle_ramp_pos_0": 0.0, "refine_angle_ramp_pos_1": 0.05, "visibility_vignette": True, "visibility_vignette_width": 0.3, "visibility_vignette_softness": 1.0, "visibility_vignette_blur": False, "refine_feather_ramp_pos_0": 0.0, "refine_feather_ramp_pos_1": 0.6, "refine_edge_feather_projection": True, "refine_edge_feather_width": 30, "refine_edge_feather_softness": 1.0, "controlnet_units": [{'unit_type': 'depth', 'model_name': 'controlnet_depth_sdxl.safetensors', 'strength': 0.5, 'start_percent': 0.0, 'end_percent': 1.0, 'is_union': False, 'use_union_type': True}], "lora_units": [{'model_name': 'sdxl_lightning_8step_lora.safetensors', 'model_strength': 1.0, 'clip_strength': 1.0}]},
+ "LOCAL EDIT (QWEN)": {"description": "Uses Qwen to make targeted edits to specific areas. Point cameras at what you want to change — you can alter colors, style, rewrite text, add details, and more. Untouched areas are preserved.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "local_edit", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "weight_exponent_generation_only": False, "weight_exponent_after_generation": 15.0, "view_blend_use_color_match": False, "view_blend_color_match_method": "reinhard", "view_blend_color_match_strength": 1.0, "clip_skip": 1, "auto_rescale": True, "auto_rescale_target_mp": 1.0, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 1.0, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": False, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": False, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.0, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "early_priority": False, "early_priority_strength": 0.5, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_voronoi_mode": False, "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": False, "refine_angle_ramp_active": False, "refine_angle_ramp_pos_0": 0.0, "refine_angle_ramp_pos_1": 0.05, "visibility_vignette": True, "visibility_vignette_width": 0.1, "visibility_vignette_softness": 1.0, "visibility_vignette_blur": False, "refine_feather_ramp_pos_0": 0.0, "refine_feather_ramp_pos_1": 0.6, "refine_edge_feather_projection": True, "refine_edge_feather_width": 15, "refine_edge_feather_softness": 1.0, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
+ "REFINE (QWEN)": {"description": "Uses Qwen to restyle or globally modify the entire existing texture. Applies changes uniformly across all camera views — ideal for changing the overall color scheme, art style, or surface appearance.", "control_after_generate": "fixed", "model_architecture": "qwen_image_edit", "qwen_generation_method": "refine", "steps": 4, "cfg": 1.0, "sampler": "euler", "scheduler": "simple", "fallback_color": mathutils.Color((0.0, 0.0, 0.0)), "discard_factor": 70.0, "discard_factor_generation_only": True, "discard_factor_after_generation": 90.0, "weight_exponent": 3.0, "weight_exponent_generation_only": False, "weight_exponent_after_generation": 15.0, "view_blend_use_color_match": False, "view_blend_color_match_method": "reinhard", "view_blend_color_match_strength": 1.0, "clip_skip": 1, "auto_rescale": True, "auto_rescale_target_mp": 1.0, "overwrite_material": True, "generation_method": "sequential", "refine_images": False, "refine_steps": 8, "refine_sampler": "dpmpp_2s_ancestral", "refine_scheduler": "sgm_uniform", "denoise": 1.0, "refine_cfg": 1.5, "refine_prompt": "", "refine_upscale_method": "lanczos", "sequential_smooth": False, "sequential_custom_camera_order": "", "sequential_factor": 0.699999988079071, "sequential_factor_smooth": 0.15000000596046448, "sequential_factor_smooth_2": 1.0, "sequential_ipadapter": False, "sequential_ipadapter_mode": "first", "sequential_desaturate_factor": 0.0, "sequential_contrast_factor": 0.0, "sequential_ipadapter_regenerate": False, "ipadapter_weight_type": "style", "ipadapter_strength": 1.0, "ipadapter_start": 0.0, "ipadapter_end": 1.0, "early_priority": False, "early_priority_strength": 0.5, "differential_diffusion": True, "differential_noise": True, "blur_mask": True, "blur_mask_radius": 1, "blur_mask_sigma": 1.0, "grow_mask_by": 3, "canny_threshold_low": 0, "canny_threshold_high": 80, "qwen_guidance_map_type": "depth", "qwen_voronoi_mode": False, "qwen_use_external_style_image": False, "qwen_external_style_image": "", "qwen_context_render_mode": "REPLACE_STYLE", "qwen_external_style_initial_only": False, "qwen_use_custom_prompts": False, "qwen_custom_prompt_initial": "Change the format of image 1 to '{main_prompt}'", "qwen_custom_prompt_seq_none": "Change and transfer the format of '{main_prompt}' in image 1 to the style from image 2", "qwen_custom_prompt_seq_replace": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas.", "qwen_custom_prompt_seq_additional": "Change and transfer the format of image 1 to '{main_prompt}'. Replace all solid magenta areas in image 2. Replace the background with solid gray. The style from image 2 should smoothly continue into the previously magenta areas. Image 3 represents the overall style of the object.", "qwen_guidance_fallback_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_guidance_background_color": mathutils.Color((1.0, 0.0, 1.0)), "qwen_context_cleanup": False, "qwen_context_cleanup_hue_tolerance": 0.0, "qwen_context_cleanup_value_adjust": 0.0, "qwen_context_fallback_dilation": 1, "qwen_rescale_alignment": False, "lora_units": [{'model_name': 'Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors', 'model_strength': 1.0, 'clip_strength': 0.0}]},
}
# Global list of all generation parameter names to check for a preset.
@@ -35,6 +40,8 @@ GEN_PARAMETERS = [
"discard_factor_generation_only",
"discard_factor_after_generation",
"weight_exponent",
+ "weight_exponent_generation_only",
+ "weight_exponent_after_generation",
"view_blend_use_color_match",
"view_blend_color_match_method",
"view_blend_color_match_strength",
@@ -93,6 +100,22 @@ GEN_PARAMETERS = [
"qwen_context_cleanup_value_adjust",
"qwen_context_fallback_dilation",
"qwen_rescale_alignment",
+ "qwen_generation_method",
+ "qwen_refine_use_prev_ref",
+ "qwen_refine_use_depth",
+ "qwen_timestep_zero_ref",
+ "refine_angle_ramp_active",
+ "refine_angle_ramp_pos_0",
+ "refine_angle_ramp_pos_1",
+ "visibility_vignette",
+ "visibility_vignette_width",
+ "visibility_vignette_softness",
+ "visibility_vignette_blur",
+ "refine_feather_ramp_pos_0",
+ "refine_feather_ramp_pos_1",
+ "refine_edge_feather_projection",
+ "refine_edge_feather_width",
+ "refine_edge_feather_softness",
]
def get_preset_items(self, context):
@@ -406,7 +429,8 @@ class StableGenPanel(bpy.types.Panel):
return None
core_settings_props = [
- "show_core_settings", "show_lora_settings", "show_scene_understanding_settings",
+ "show_core_settings", "show_lora_settings", "show_camera_options",
+ "show_scene_understanding_settings",
"show_output_material_settings", "show_image_guidance_settings",
"show_masking_inpainting_settings", "show_mode_specific_settings"
]
@@ -493,40 +517,71 @@ class StableGenPanel(bpy.types.Panel):
btn_row_lora.operator("stablegen.add_lora_unit", text="Add Another LoRA", icon="ADD")
btn_row_lora.operator("stablegen.remove_lora_unit", text="Remove Selected", icon="REMOVE")
- # --- Image & Scene Understanding ---
- content_box = draw_collapsible_section(advanced_params_box, "show_scene_understanding_settings", "Viewpoint Blending Settings", icon="ZOOM_IN")
+ # --- Camera Options ---
+ content_box = draw_collapsible_section(advanced_params_box, "show_camera_options", "Camera Settings", icon="CAMERA_DATA")
if content_box:
row = content_box.row(align=True)
- row.prop(scene, "use_camera_prompts", text="Use camera prompts", toggle=True, icon="CAMERA_DATA")
-
- row = content_box.row()
- row.prop(scene, "discard_factor", text="Discard-Over Angle")
-
- # Conditional UI for resetting discard factor
- if scene.generation_method == 'sequential' or scene.model_architecture == 'qwen_image_edit':
- row = content_box.row()
- row.prop(scene, "discard_factor_generation_only", text="Reset Angle After Generation", toggle=True)
- if scene.discard_factor_generation_only:
- row = content_box.row()
- row.prop(scene, "discard_factor_after_generation", text="Angle After Generation")
+ row.prop(scene, "use_camera_prompts", text="Use Camera Prompts", toggle=True, icon="OUTLINER_OB_CAMERA")
- row = content_box.row()
- row.prop(scene, "weight_exponent", text="Weight Exponent")
+ # ── Camera Generation Order ──
+ row = content_box.row(align=True)
+ row.prop(scene, "sg_use_custom_camera_order",
+ text="Custom Generation Order", toggle=True, icon="SORTALPHA")
+ if scene.sg_use_custom_camera_order:
+ order_box = content_box.box()
+ # Preset strategy selector + sync
+ row = order_box.row(align=True)
+ row.operator_menu_enum(
+ "stablegen.apply_camera_order_preset", "strategy",
+ text="Sort Preset", icon="PRESET")
+ row.operator("stablegen.sync_camera_order",
+ text="", icon="FILE_REFRESH")
+
+ # UIList with move buttons
+ row = order_box.row()
+ row.template_list(
+ "SG_UL_CameraOrderList", "",
+ scene, "sg_camera_order",
+ scene, "sg_camera_order_index",
+ rows=4, maxrows=8)
+ col = row.column(align=True)
+ op = col.operator("stablegen.move_camera_order",
+ text="", icon="TRIA_UP")
+ op.direction = 'UP'
+ op = col.operator("stablegen.move_camera_order",
+ text="", icon="TRIA_DOWN")
+ op.direction = 'DOWN'
+
+ # --- Viewpoint Blending Settings ---
+ content_box = draw_collapsible_section(advanced_params_box, "show_scene_understanding_settings", "Viewpoint Blending Settings", icon="ZOOM_IN")
+ if content_box:
+ # Row 1: Discard-Over Angle | Weight Exponent
+ split = content_box.split(factor=0.5, align=True)
+ split.prop(scene, "discard_factor", text="Discard Angle")
+ split.prop(scene, "weight_exponent", text="Exponent")
+
+ # Row 2 & 3: Reset toggles and values (only for sequential / qwen)
+ if scene.generation_method == 'sequential' or scene.model_architecture == 'qwen_image_edit':
+ split = content_box.split(factor=0.5, align=True)
+ split.prop(scene, "discard_factor_generation_only", text="Reset Angle", toggle=True)
+ split.prop(scene, "weight_exponent_generation_only", text="Reset Exponent", toggle=True)
+
+ if scene.discard_factor_generation_only or scene.weight_exponent_generation_only:
+ split = content_box.split(factor=0.5, align=True)
+ if scene.discard_factor_generation_only:
+ split.prop(scene, "discard_factor_after_generation", text="Angle After")
+ else:
+ split.label(text="")
+ if scene.weight_exponent_generation_only:
+ split.prop(scene, "weight_exponent_after_generation", text="Exp. After")
+ else:
+ split.label(text="")
row = content_box.row()
row.prop(scene, "early_priority", text="Prioritize Initial Views", toggle=True, icon="REW")
if scene.early_priority:
row = content_box.row()
row.prop(scene, "early_priority_strength", text="Priority Strength")
-
- row = content_box.row()
- row.prop(scene, "view_blend_use_color_match", text="Match Colors to Viewport", toggle=True)
-
- if scene.view_blend_use_color_match:
- row = content_box.row(align=True)
- row.prop(scene, "view_blend_color_match_method", text="Method")
- row = content_box.row()
- row.prop(scene, "view_blend_color_match_strength", text="Strength")
# --- Output & Material Settings ---
@@ -618,6 +673,10 @@ class StableGenPanel(bpy.types.Panel):
row = style_box.row()
row.prop(scene, "qwen_external_style_image", text="Style Image")
+ # Timestep-zero reference method — shared across all Qwen modes
+ row = content_box.row()
+ row.prop(scene, "qwen_timestep_zero_ref", text="Timestep-Zero References (color shift fix)", toggle=True, icon="COLORSET_08_VEC")
+
row = content_box.row()
row.prop(scene, "qwen_use_custom_prompts", text="Custom Guidance Prompts", toggle=True, icon="TEXT")
if scene.qwen_use_custom_prompts:
@@ -829,6 +888,16 @@ class StableGenPanel(bpy.types.Panel):
row = box.row()
row.prop(scene, "refine_edge_feather_softness", text="Feather Softness")
+ # Color Matching
+ box = mode_specific_outer_box.box()
+ row = box.row()
+ row.prop(scene, "view_blend_use_color_match", text="Match Colors to Viewport", toggle=True, icon="COLOR")
+ if scene.view_blend_use_color_match:
+ row = box.row(align=True)
+ row.prop(scene, "view_blend_color_match_method", text="Method")
+ row = box.row()
+ row.prop(scene, "view_blend_color_match_strength", text="Strength")
+
# Qwen Refine Mode Parameters
elif scene.model_architecture.startswith('qwen') and scene.qwen_generation_method == 'refine':
row = mode_specific_outer_box.row()
@@ -994,6 +1063,16 @@ class StableGenPanel(bpy.types.Panel):
row = box.row()
row.prop(scene, "refine_edge_feather_softness", text="Feather Softness")
+ # Color Matching
+ box = mode_specific_outer_box.box()
+ row = box.row()
+ row.prop(scene, "view_blend_use_color_match", text="Match Colors to Viewport", toggle=True, icon="COLOR")
+ if scene.view_blend_use_color_match:
+ row = box.row(align=True)
+ row.prop(scene, "view_blend_color_match_method", text="Method")
+ row = box.row()
+ row.prop(scene, "view_blend_color_match_strength", text="Strength")
+
row = mode_specific_outer_box.row()
row.prop(scene, "sequential_ipadapter", text="Use IPAdapter for Local Edit", toggle=True, icon="MODIFIER")
if scene.sequential_ipadapter:
@@ -1040,10 +1119,6 @@ class StableGenPanel(bpy.types.Panel):
row.alignment = 'CENTER'
row.label(text="Sequential Mode Parameters", icon="SEQUENCE")
- split = mode_specific_outer_box.split(factor=0.5)
- split.label(text="Custom Camera Order:")
- split.prop(scene, "sequential_custom_camera_order", text="")
-
if not (scene.differential_diffusion and not scene.differential_noise):
row = mode_specific_outer_box.row()
row.prop(scene, "sequential_smooth", text="Use Smooth Visibility Map", toggle=True, icon="MOD_SMOOTH")
@@ -1146,7 +1221,7 @@ class StableGenPanel(bpy.types.Panel):
row.operator("stablegen.debug_grid_pattern", text="Grid Pattern", icon="MESH_GRID")
row = debug_box.row()
- row.operator("stablegen.debug_coverage_heatmap", text="Coverage Heatmap", icon="COLORSET_01_VEC")
+ row.operator("stablegen.debug_coverage_heatmap", text="Coverage Heatmap", icon="AREA_SWAP")
if width_mode == 'narrow':
row = debug_box.row()
row.operator("stablegen.debug_visibility_material", text="Visibility Material", icon="HIDE_OFF")
diff --git a/stablegen/util/helpers.py b/stablegen/util/helpers.py
index c355dfb..32d19f3 100755
--- a/stablegen/util/helpers.py
+++ b/stablegen/util/helpers.py
@@ -1391,7 +1391,7 @@ prompt_text_qwen_image_edit = """
"8": {
"inputs": {
"pixels": [
- "10",
+ "14",
0
],
"vae": [
@@ -1404,21 +1404,6 @@ prompt_text_qwen_image_edit = """
"title": "VAE Encode"
}
},
- "10": {
- "inputs": {
- "upscale_method": "lanczos",
- "megapixels": 1,
- "resolution_steps": 1,
- "image": [
- "14",
- 0
- ]
- },
- "class_type": "ImageScaleToTotalPixels",
- "_meta": {
- "title": "Scale Image to Total Pixels"
- }
- },
"11": {
"inputs": {
"prompt": "",
@@ -1426,12 +1411,8 @@ prompt_text_qwen_image_edit = """
"3",
0
],
- "vae": [
- "4",
- 0
- ],
"image1": [
- "10",
+ "14",
0
],
"image2": [
@@ -1455,12 +1436,8 @@ prompt_text_qwen_image_edit = """
"3",
0
],
- "vae": [
- "4",
- 0
- ],
"image1": [
- "10",
+ "14",
0
],
"image2": [
diff --git a/stablegen/workflows.py b/stablegen/workflows.py
index 18d3cbb..1002261 100644
--- a/stablegen/workflows.py
+++ b/stablegen/workflows.py
@@ -119,6 +119,128 @@ class WorkflowManager:
img_out.save(out_buf, format="PNG")
return out_buf.getvalue()
+ def _build_qwen_reference_latent_chain(self, prompt, NODES, start_node_id=700):
+ """
+ Build VAEEncode + ReferenceLatent chain for the Qwen unzoom fix.
+
+ When the VAE input is disconnected from TextEncodeQwenImageEditPlus,
+ the node no longer creates reference latents (and no longer forces
+ a 1 MP rescale). We replicate the reference-latent injection
+ manually so the latents match the actual output resolution.
+
+ For each active image (image1 / image2 / image3) still present in
+ the positive text-encode node, a VAEEncode node is created and a
+ ReferenceLatent node is chained onto both positive and negative
+ conditioning. The KSampler inputs are then updated to point at
+ the tail of the chain.
+
+ When ``qwen_timestep_zero_ref`` is enabled on the scene, a
+ FluxKontextMultiReferenceLatentMethod node is appended with
+ ``index_timestep_zero`` so the model treats reference latents as
+ fully-denoised tokens, reducing color shift / over-saturation.
+ """
+ pos_node = NODES['pos_prompt']
+ neg_node = NODES['neg_prompt']
+ sampler_node = NODES['sampler']
+ vae_ref = ["4", 0] # VAELoader node
+
+ # Collect active image references from the pos text-encode node.
+ # image1 is always present; image2/image3 may have been deleted.
+ active_refs = []
+ pos_inputs = prompt[pos_node]['inputs']
+ for key in ('image1', 'image2', 'image3'):
+ if key in pos_inputs:
+ active_refs.append(pos_inputs[key])
+
+ if not active_refs:
+ return
+
+ node_id = start_node_id
+ # Avoid collisions with existing dynamic nodes
+ while str(node_id) in prompt:
+ node_id += 1
+
+ pos_cond_ref = [pos_node, 0]
+ neg_cond_ref = [neg_node, 0]
+
+ for i, img_ref in enumerate(active_refs):
+ # --- VAEEncode for this image ---
+ # For image1 we can reuse the existing node 8 which already
+ # encodes the same image (also used as KSampler latent_image).
+ if i == 0:
+ vae_enc_ref = ["8", 0]
+ else:
+ vae_enc_id = str(node_id)
+ node_id += 1
+ prompt[vae_enc_id] = {
+ "inputs": {
+ "pixels": img_ref,
+ "vae": vae_ref
+ },
+ "class_type": "VAEEncode",
+ "_meta": {"title": f"VAE Encode (Ref {i + 1})"}
+ }
+ vae_enc_ref = [vae_enc_id, 0]
+
+ # --- ReferenceLatent for positive ---
+ ref_pos_id = str(node_id)
+ node_id += 1
+ prompt[ref_pos_id] = {
+ "inputs": {
+ "conditioning": pos_cond_ref,
+ "latent": vae_enc_ref
+ },
+ "class_type": "ReferenceLatent",
+ "_meta": {"title": f"Reference Latent Pos {i + 1}"}
+ }
+ pos_cond_ref = [ref_pos_id, 0]
+
+ # --- ReferenceLatent for negative ---
+ ref_neg_id = str(node_id)
+ node_id += 1
+ prompt[ref_neg_id] = {
+ "inputs": {
+ "conditioning": neg_cond_ref,
+ "latent": vae_enc_ref
+ },
+ "class_type": "ReferenceLatent",
+ "_meta": {"title": f"Reference Latent Neg {i + 1}"}
+ }
+ neg_cond_ref = [ref_neg_id, 0]
+
+ # Point KSampler at the final chained conditioning
+ prompt[sampler_node]['inputs']['positive'] = pos_cond_ref
+ prompt[sampler_node]['inputs']['negative'] = neg_cond_ref
+
+ # ── Timestep-zero reference method (colour-shift reduction) ─────
+ context = bpy.context
+ if getattr(context.scene, 'qwen_timestep_zero_ref', False):
+ # Positive conditioning
+ tz_pos_id = str(node_id)
+ node_id += 1
+ prompt[tz_pos_id] = {
+ "inputs": {
+ "conditioning": pos_cond_ref,
+ "reference_latents_method": "index_timestep_zero"
+ },
+ "class_type": "FluxKontextMultiReferenceLatentMethod",
+ "_meta": {"title": "Ref Method (Pos)"}
+ }
+ prompt[sampler_node]['inputs']['positive'] = [tz_pos_id, 0]
+
+ # Negative conditioning
+ tz_neg_id = str(node_id)
+ node_id += 1
+ prompt[tz_neg_id] = {
+ "inputs": {
+ "conditioning": neg_cond_ref,
+ "reference_latents_method": "index_timestep_zero"
+ },
+ "class_type": "FluxKontextMultiReferenceLatentMethod",
+ "_meta": {"title": "Ref Method (Neg)"}
+ }
+ prompt[sampler_node]['inputs']['negative'] = [tz_neg_id, 0]
+
def _get_qwen_default_prompts(self, context, is_initial_image):
"""Gets the default Qwen prompts based on the current context."""
# Check if we are in a real generation context vs. just resetting a prompt
@@ -244,6 +366,9 @@ class WorkflowManager:
final_prompt += ". Use image3 as depth map reference."
prompt[NODES['pos_prompt']]['inputs']['prompt'] = final_prompt
+
+ # --- Reference Latent chain (Qwen unzoom fix) ---
+ self._build_qwen_reference_latent_chain(prompt, NODES)
# --- Save and Execute ---
self._save_prompt_to_file(prompt, revision_dir)
@@ -320,7 +445,6 @@ class WorkflowManager:
context_render_info = None
context_mode = context.scene.qwen_context_render_mode
remove_context = False
- style_requires_scaling = False
# --- Camera Prompt Injection ---
if context.scene.use_camera_prompts and self.operator._cameras and self.operator._current_image < len(self.operator._cameras):
@@ -377,7 +501,6 @@ class WorkflowManager:
if not style_image_info:
self.operator._error = "External style image enabled, but file not found or could not be uploaded."
return {"error": "conn_failed"}
- style_requires_scaling = True
if context_mode != 'ADDITIONAL':
if context.scene.qwen_use_custom_prompts:
pos_prompt_text = (context.scene.qwen_custom_prompt_initial if is_initial_image else context.scene.qwen_custom_prompt_seq_none).format(main_prompt=user_prompt)
@@ -402,7 +525,12 @@ class WorkflowManager:
pos_prompt_text = self._get_qwen_default_prompts(context, is_initial_image).format(main_prompt=user_prompt)
prompt[NODES['pos_prompt']]['inputs']['prompt'] = pos_prompt_text
elif context.scene.sequential_ipadapter: # Use previous generated image
- ref_cam_id = 0 if context.scene.sequential_ipadapter_mode == 'first' else self.operator._current_image - 1
+ if context.scene.sequential_ipadapter_mode == 'original_render':
+ # For original_render in Qwen context, fall back to first mode since
+ # the render is already used as the guidance map (Image 1).
+ ref_cam_id = 0
+ else:
+ ref_cam_id = 0 if context.scene.sequential_ipadapter_mode == 'first' else self.operator._current_image - 1
style_image_info = self.operator._get_uploaded_image_info(context, "generated", camera_id=ref_cam_id, material_id=self.operator._material_id)
if not style_image_info:
self.operator._error = f"Sequential mode error: Could not find previous image for camera {ref_cam_id} to use as style."
@@ -429,7 +557,11 @@ class WorkflowManager:
else:
# A style image is provided, so set the loader input.
prompt[NODES['style_map_loader']]['inputs']['image'] = style_image_info['name']
- if style_requires_scaling:
+ # External user-selected images can be arbitrarily large (10+ MP).
+ # Scale them down to ~1 MP so the VAEEncode in the reference
+ # latent chain doesn't blow up VRAM. StableGen's own renders
+ # are already roughly 1 MP and don't need this.
+ if use_external_this_frame:
scale_node_int = 600
while str(scale_node_int) in prompt:
scale_node_int += 1
@@ -443,12 +575,17 @@ class WorkflowManager:
},
"class_type": "ImageScaleToTotalPixels",
"_meta": {
- "title": "Scale Image to Total Pixels"
+ "title": "Scale External Style to 1MP"
}
}
+ # Point text-encode image2 at the scaled version so both
+ # VL processing and the reference latent chain see ~1 MP.
prompt[NODES['pos_prompt']]['inputs']['image2'] = [scale_node_key, 0]
prompt[NODES['neg_prompt']]['inputs']['image2'] = [scale_node_key, 0]
+ # --- Reference Latent chain (Qwen unzoom fix) ---
+ self._build_qwen_reference_latent_chain(prompt, NODES)
+
# --- Configure Sampler ---
prompt[NODES['sampler']]['inputs']['seed'] = context.scene.seed
prompt[NODES['sampler']]['inputs']['steps'] = context.scene.steps
@@ -1125,7 +1262,12 @@ class WorkflowManager:
prompt[NODES['clip_skip']]["inputs"]["clip"] = final_lora_clip_out
# If using IPAdapter, set the model input
- if (context.scene.use_ipadapter or (context.scene.sequential_ipadapter and self.operator._current_image > 0)) and context.scene.generation_method != 'uv_inpaint':
+ _is_original_render_ipadapter = (
+ context.scene.sequential_ipadapter
+ and context.scene.sequential_ipadapter_mode == 'original_render'
+ and context.scene.generation_method == 'local_edit'
+ )
+ if (context.scene.use_ipadapter or _is_original_render_ipadapter or (context.scene.sequential_ipadapter and self.operator._current_image > 0)) and context.scene.generation_method != 'uv_inpaint':
# Set the model input for IPAdapter
prompt[NODES['ipadapter_loader']]["inputs"]["model"] = current_model_out
current_model_out = [NODES['ipadapter'], 0]
@@ -1396,7 +1538,12 @@ class WorkflowManager:
prompt[NODES['sampler']]["inputs"]["latent_image"] = [NODES['instruct_pix'], 2]
# If using ipadapter, set the apply_ipadapter_flux node to use the flux_lora_image
- if context.scene.use_ipadapter or (context.scene.generation_method == 'separate' and context.scene.sequential_ipadapter and self.operator._current_image > 0):
+ _is_original_render_ipadapter = (
+ context.scene.sequential_ipadapter
+ and context.scene.sequential_ipadapter_mode == 'original_render'
+ and context.scene.generation_method == 'local_edit'
+ )
+ if context.scene.use_ipadapter or _is_original_render_ipadapter or (context.scene.generation_method == 'separate' and context.scene.sequential_ipadapter and self.operator._current_image > 0):
prompt[NODES['ipadapter']]["inputs"]["model"] = [NODES['flux_lora'], 0]
else:
prompt[NODES['guider']]["inputs"]["model"] = [NODES['flux_lora'], 0]