| 208 | } |
| 209 | |
| 210 | Status DataProcessorService::updateFilter(NodeId node_id, std::shared_ptr<proc::DataProcessor> processor) { |
| 211 | if (!processor) { |
| 212 | return PJ::unexpected("DataProcessorService: null processor"); |
| 213 | } |
| 214 | if (Status replaced = |
| 215 | derived_->replaceSisoTransform(node_id, std::make_unique<proc::ProcessorSisoAdapter>(processor)); |
| 216 | !replaced.has_value()) { |
| 217 | return replaced; |
| 218 | } |
| 219 | for (auto& [out_tid, recipe] : recipes_) { |
| 220 | if (recipe.node_id == node_id) { |
| 221 | recipe.processor = processor; |
| 222 | recipe.processor_id = processor->id(); |
| 223 | // Re-capture the defining source (like applyFilter) so a layout re-saved after |
| 224 | // an in-place edit embeds the NEW filter's <source_fallback>, not the old one. |
| 225 | if (const auto* lua = dynamic_cast<const scripting::LuaSisoTransform*>(processor.get())) { |
| 226 | recipe.filter_source = lua->sourceText(); |
| 227 | } else { |
| 228 | recipe.filter_source.clear(); |
| 229 | } |
| 230 | break; |
| 231 | } |
| 232 | } |
| 233 | return PJ::okStatus(); |
| 234 | } |
| 235 | |
| 236 | std::vector<std::pair<std::string, std::string>> DataProcessorService::availableFilters() const { |
| 237 | std::vector<std::pair<std::string, std::string>> out; |