From f1c42fd8d103f5349c0275323974879868b131f6 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Wed, 8 Jul 2026 18:06:02 -0500 Subject: [PATCH 1/2] Adds support for Conditioning (Multiply) --- src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs | 8 ++++++++ src/Text2Image/T2IParamTypes.cs | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs b/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs index a78662b8d..ff93a8bcf 100644 --- a/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs +++ b/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs @@ -2525,6 +2525,14 @@ public JArray CreateConditioningDirect(string prompt, JArray clip, T2IModel mode ["text"] = prompt }, id); } + if (UserInput.TryGet(T2IParamTypes.ConditioningMultiplier, out double condMultiplier)) + { + node = CreateNode("ConditioningMultiply", new JObject() + { + ["conditioning"] = NodePath(node, 0), + ["multiplier"] = condMultiplier + }); + } NodeHelpers[trackerId] = node; return [node, 0]; } diff --git a/src/Text2Image/T2IParamTypes.cs b/src/Text2Image/T2IParamTypes.cs index 9b95f10a8..eea19f1a9 100644 --- a/src/Text2Image/T2IParamTypes.cs +++ b/src/Text2Image/T2IParamTypes.cs @@ -327,7 +327,7 @@ public static string ApplyStringEdit(string prior, string update) public static T2IRegisteredParam Images, Steps, Width, Height, SideLength, BatchSize, VAETileSize, VAETileOverlap, VAETemporalTileSize, VAETemporalTileOverlap, ClipStopAtLayer, VideoFrames, VideoMotionBucket, VideoFPS, VideoSteps, RefinerSteps, CascadeLatentCompression, MaskShrinkGrow, MaskBlur, MaskGrow, SegmentMaskBlur, SegmentMaskGrow, SegmentMaskOversize, SegmentSteps, Text2VideoFrames, TrimVideoStartFrames, TrimVideoEndFrames, VideoExtendFrameOverlap; public static T2IRegisteredParam Seed, VariationSeed, WildcardSeed, Text2AudioBPM; public static T2IRegisteredParam CFGScale, VariationSeedStrength, InitImageCreativity, InitImageResetToNorm, InitImageNoise, RefinerControl, RefinerUpscale, RefinerCFGScale, ReVisionStrength, AltResolutionHeightMult, - FreeUBlock1, FreeUBlock2, FreeUSkip1, FreeUSkip2, GlobalRegionFactor, EndStepsEarly, SamplerSigmaMin, SamplerSigmaMax, SamplerRho, VideoAugmentationLevel, VideoCFG, VideoMinCFG, Video2VideoCreativity, VideoSwapPercent, VideoExtendSwapPercent, IP2PCFG2, RegionalObjectCleanupFactor, SigmaShift, SegmentThresholdMax, SegmentCFGScale, FluxGuidanceScale, Text2AudioDuration; + FreeUBlock1, FreeUBlock2, FreeUSkip1, FreeUSkip2, GlobalRegionFactor, EndStepsEarly, SamplerSigmaMin, SamplerSigmaMax, SamplerRho, VideoAugmentationLevel, VideoCFG, VideoMinCFG, Video2VideoCreativity, VideoSwapPercent, VideoExtendSwapPercent, IP2PCFG2, RegionalObjectCleanupFactor, SigmaShift, SegmentThresholdMax, SegmentCFGScale, FluxGuidanceScale, Text2AudioDuration, ConditioningMultiplier; public static T2IRegisteredParam InitImage, MaskImage, VideoEndFrame; public static T2IRegisteredParam VideoAudioInput, VideoAudioReference; public static T2IRegisteredParam Model, RefinerModel, VAE, RegionalObjectInpaintingModel, SegmentModel, VideoModel, VideoSwapModel, RefinerVAE, ClipLModel, ClipGModel, ClipVisionModel, T5XXLModel, LLaVAModel, LLaMAModel, QwenModel, MistralModel, GemmaModel, GptOssModel, VideoExtendModel, VideoExtendSwapModel, NegativeModel; @@ -906,6 +906,9 @@ static bool isUncondName(string str) RemoveBackground = Register(new("Remove Background", "If enabled, removes the background from the generated image.\nThis internally uses RemBG.", "false", IgnoreIf: "false", IsAdvanced: true, Group: GroupAdvancedSampling, OrderPriority: -2 )); + ConditioningMultiplier = Register(new("Conditioning (Multiply)", "Multiplies the text conditioning.", + "1", Min: -100, Max: 100, Step: 0.01, Toggleable: true, IsAdvanced: true, Group: GroupAdvancedSampling, OrderPriority: -1 + )); EndStepsEarly = Register(new("End Steps Early", "Percentage of steps to cut off before the image is done generation.", "0", Toggleable: true, IgnoreIf: "0", VisibleNormally: false, Min: 0, Max: 1, Group: GroupAdvancedSampling, FeatureFlag: "endstepsearly" )); From 1d7b4cda0cc22571b3622e0a332061e85d2d37c4 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Wed, 8 Jul 2026 17:32:14 -0600 Subject: [PATCH 2/2] Only apply to plain text encoders --- src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs b/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs index ff93a8bcf..1ff3d8791 100644 --- a/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs +++ b/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs @@ -2311,6 +2311,7 @@ public JArray CreateConditioningDirect(string prompt, JArray clip, T2IModel mode return [nodeId, 0]; } string node; + bool isPlainTextEncode = false; double mult = isPositive ? 1.5 : 0.8; int width = UserInput.GetImageWidth(); int height = UserInput.GetImageHeight(); @@ -2501,6 +2502,7 @@ public JArray CreateConditioningDirect(string prompt, JArray clip, T2IModel mode ["target_height"] = height, ["guidance"] = UserInput.Get(T2IParamTypes.FluxGuidanceScale, defaultGuidance) }, id); + isPlainTextEncode = true; } else if (model is not null && model.ModelClass is not null && model.ModelClass.ID == "stable-diffusion-xl-v1-base") { @@ -2516,6 +2518,7 @@ public JArray CreateConditioningDirect(string prompt, JArray clip, T2IModel mode ["target_width"] = width, ["target_height"] = height }, id); + isPlainTextEncode = true; } else { @@ -2524,8 +2527,9 @@ public JArray CreateConditioningDirect(string prompt, JArray clip, T2IModel mode ["clip"] = clip, ["text"] = prompt }, id); + isPlainTextEncode = true; } - if (UserInput.TryGet(T2IParamTypes.ConditioningMultiplier, out double condMultiplier)) + if (isPlainTextEncode && UserInput.TryGet(T2IParamTypes.ConditioningMultiplier, out double condMultiplier) && condMultiplier != 1) { node = CreateNode("ConditioningMultiply", new JObject() {