Fix filter_template expansion in test routes and select defaults
filter_template references were silently ignored in PP template test, picture source test, and KC target test routes — they created a no-op FilterTemplateFilter instead of expanding into the referenced template's filters. Centralized expansion logic into PostprocessingTemplateStore. resolve_filter_instances() and use it in all test routes + live stream manager. Also fixed empty template_id when adding filter_template filters: the select dropdown showed the first template visually but onchange never fired, saving "" instead. Now initializes with first choice's value and auto-corrects stale/empty values at render time. Other fixes: ScreenCapture dimensions now use actual image shape after filter processing; brightness source label emoji updates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1367,8 +1367,14 @@ export function renderModalFilterList() {
|
||||
const filteredChoices = (fi.filter_id === 'filter_template' && opt.key === 'template_id' && editingId)
|
||||
? opt.choices.filter(c => c.value !== editingId)
|
||||
: opt.choices;
|
||||
// Auto-correct if current value doesn't match any choice
|
||||
let selectVal = currentVal;
|
||||
if (filteredChoices.length > 0 && !filteredChoices.some(c => c.value === selectVal)) {
|
||||
selectVal = filteredChoices[0].value;
|
||||
fi.options[opt.key] = selectVal;
|
||||
}
|
||||
const options = filteredChoices.map(c =>
|
||||
`<option value="${escapeHtml(c.value)}"${c.value === currentVal ? ' selected' : ''}>${escapeHtml(c.label)}</option>`
|
||||
`<option value="${escapeHtml(c.value)}"${c.value === selectVal ? ' selected' : ''}>${escapeHtml(c.label)}</option>`
|
||||
).join('');
|
||||
html += `<div class="pp-filter-option">
|
||||
<label for="${inputId}"><span>${escapeHtml(opt.label)}:</span></label>
|
||||
@@ -1407,7 +1413,12 @@ export function addFilterFromSelect() {
|
||||
|
||||
const options = {};
|
||||
for (const opt of filterDef.options_schema) {
|
||||
options[opt.key] = opt.default;
|
||||
// For select options with empty default, use the first choice's value
|
||||
if (opt.type === 'select' && !opt.default && Array.isArray(opt.choices) && opt.choices.length > 0) {
|
||||
options[opt.key] = opt.choices[0].value;
|
||||
} else {
|
||||
options[opt.key] = opt.default;
|
||||
}
|
||||
}
|
||||
|
||||
_modalFilters.push({ filter_id: filterId, options, _expanded: true });
|
||||
|
||||
@@ -431,7 +431,7 @@
|
||||
"kc.pattern_template": "Pattern Template:",
|
||||
"kc.pattern_template.hint": "Select the rectangle pattern to use for color extraction",
|
||||
"kc.pattern_template.none": "-- Select a pattern template --",
|
||||
"kc.brightness_vs": "Brightness Source:",
|
||||
"kc.brightness_vs": "🔢 Brightness Source:",
|
||||
"kc.brightness_vs.hint": "Optional value source that dynamically controls brightness each frame (multiplied with the manual brightness slider)",
|
||||
"kc.brightness_vs.none": "None (manual brightness only)",
|
||||
"kc.created": "Key colors target created successfully",
|
||||
@@ -847,7 +847,7 @@
|
||||
"value_source.deleted": "Value source deleted",
|
||||
"value_source.delete.confirm": "Are you sure you want to delete this value source?",
|
||||
"value_source.error.name_required": "Please enter a name",
|
||||
"targets.brightness_vs": "Brightness Source:",
|
||||
"targets.brightness_vs": "🔢 Brightness Source:",
|
||||
"targets.brightness_vs.hint": "Optional value source that dynamically controls brightness each frame (overrides device brightness)",
|
||||
"targets.brightness_vs.none": "None (device brightness)"
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@
|
||||
"kc.pattern_template": "Шаблон Паттерна:",
|
||||
"kc.pattern_template.hint": "Выберите шаблон прямоугольников для извлечения цветов",
|
||||
"kc.pattern_template.none": "-- Выберите шаблон паттерна --",
|
||||
"kc.brightness_vs": "Источник Яркости:",
|
||||
"kc.brightness_vs": "🔢 Источник Яркости:",
|
||||
"kc.brightness_vs.hint": "Опциональный источник значений, динамически управляющий яркостью каждый кадр (умножается на ручной слайдер яркости)",
|
||||
"kc.brightness_vs.none": "Нет (только ручная яркость)",
|
||||
"kc.created": "Цель ключевых цветов успешно создана",
|
||||
@@ -847,7 +847,7 @@
|
||||
"value_source.deleted": "Источник значений удалён",
|
||||
"value_source.delete.confirm": "Удалить этот источник значений?",
|
||||
"value_source.error.name_required": "Введите название",
|
||||
"targets.brightness_vs": "Источник яркости:",
|
||||
"targets.brightness_vs": "🔢 Источник яркости:",
|
||||
"targets.brightness_vs.hint": "Необязательный источник значений для динамического управления яркостью каждый кадр (переопределяет яркость устройства)",
|
||||
"targets.brightness_vs.none": "Нет (яркость устройства)"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user