200{
201 if (!op) {
203 "Cannot set null operator");
204 return;
205 }
206
209 "ParticleNetwork: unsupported operator type '{}' rejected as primary. "
210 "The primary must own PointVertex storage; a chain operator need not.",
211 op->get_type_name());
212 return;
213 }
214
216 const char* new_name = op->get_type_name().data();
217
219 "Switching operator: '{}' → '{}'",
220 old_name, new_name);
221
222 std::vector<PointVertex> vertices;
223
224 if (
auto* old_graphics =
dynamic_cast<PhysicsOperator*
>(
m_operator.get())) {
225 vertices = old_graphics->extract_vertices();
226
228 "Extracted {} vertices from old operator",
229 vertices.size());
230 }
else if (
auto* old_field =
dynamic_cast<FieldOperator*
>(
m_operator.get())) {
231 vertices = old_field->extract_point_vertices();
232
234 "Extracted {} vertices from old FieldOperator",
235 vertices.size());
238 }
239
240 if (auto* new_graphics = dynamic_cast<PhysicsOperator*>(op.get())) {
241 new_graphics->initialize(vertices);
242
243 if (auto* physics = dynamic_cast<PhysicsOperator*>(op.get())) {
245 }
246
248 "Initialized new graphics operator with {} points",
249 vertices.size());
250 }
251
252 if (auto* new_field = dynamic_cast<FieldOperator*>(op.get())) {
253 new_field->initialize(vertices);
254
256 "Initialized new FieldOperator with {} points",
257 vertices.size());
258 }
259
261
262 if (
auto* physics =
dynamic_cast<PhysicsOperator*
>(
m_operator.get())) {
263 bool should_interact = topology_interacts(
get_topology());
264 physics->enable_spatial_interactions(should_interact);
265 }
266
268 "Operator switched successfully to '{}'", new_name);
269}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
Topology get_topology() const
Get the current topology.
Kinesis::SamplerBounds m_bounds
std::vector< PointVertex > generate_initial_vertices()
static bool is_compatible(const NetworkOperator &op) noexcept
Whether an operator can serve as this network's primary.
std::unique_ptr< NetworkOperator > m_operator
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.