|
1 | | -using FreneticUtilities.FreneticExtensions; |
| 1 | +using FreneticUtilities.FreneticExtensions; |
2 | 2 | using FreneticUtilities.FreneticToolkit; |
3 | 3 | using Newtonsoft.Json.Linq; |
4 | 4 | using SwarmUI.Accounts; |
@@ -90,6 +90,11 @@ public override void OnPreInit() |
90 | 90 | (call.LocalData as GridCallData).Additions.Add(val); |
91 | 91 | return true; |
92 | 92 | } |
| 93 | + else if (cleaned == PresetsParameter.Type.ID) |
| 94 | + { |
| 95 | + (call.LocalData as GridCallData).Presets.Add(val); |
| 96 | + return true; |
| 97 | + } |
93 | 98 | else if (cleaned == "width" || cleaned == "outwidth") |
94 | 99 | { |
95 | 100 | call.Grid.MinWidth = Math.Min(call.Grid.MinWidth, int.Parse(val)); |
@@ -130,6 +135,15 @@ public override void OnPreInit() |
130 | 135 | string prompt = param.InternalSet.Get(T2IParamTypes.Prompt, "") + " " + data.Additions.JoinString(" "); |
131 | 136 | param.InternalSet.Set(T2IParamTypes.Prompt, prompt.Trim()); |
132 | 137 | } |
| 138 | + if (data.Presets.Any()) |
| 139 | + { |
| 140 | + string presets = data.Presets.JoinString(","); |
| 141 | + if (param.InternalSet.TryGet(PresetsParameter, out string existing)) |
| 142 | + { |
| 143 | + presets += $",{existing}"; |
| 144 | + } |
| 145 | + param.InternalSet.Set(PresetsParameter, presets); |
| 146 | + } |
133 | 147 | }; |
134 | 148 | GridRunnerPreRunHook = (runner) => |
135 | 149 | { |
@@ -325,6 +339,8 @@ public class GridCallData |
325 | 339 | public List<string> Replacements = []; |
326 | 340 |
|
327 | 341 | public List<string> Additions = []; |
| 342 | + |
| 343 | + public List<string> Presets = []; |
328 | 344 | } |
329 | 345 |
|
330 | 346 | public class SwarmUIGridData |
|
0 commit comments