77 T& self,
const isf::descriptor& desc,
78 const ossia::flat_map<QString, ossia::value>& previous_values)
98 const ossia::flat_map<QString, ossia::value>& previous_values;
99 const isf::input& input;
111 auto nm = QString::fromStdString(input.name);
112 auto port =
new Process::FloatSlider(
115 self.m_inlets.push_back(port);
116 if(
auto it = previous_values.find(nm);
117 it != previous_values.end()
118 && it->second.get_type() == ossia::val_type::FLOAT)
119 port->setValue(it->second);
121 self.controlAdded(port->id());
127 auto nm = QString::fromStdString(input.name);
131 if(
auto it = previous_values.find(nm);
132 it != previous_values.end()
133 && it->second.get_type() == port->value().get_type())
134 port->setValue(it->second);
136 self.m_inlets.push_back(port);
137 self.controlAdded(port->id());
143 auto nm = QString::fromStdString(input.name);
146 self.m_inlets.push_back(port);
147 self.controlAdded(port->id());
153 auto nm = QString::fromStdString(input.name);
156 if(
auto it = previous_values.find(nm);
157 it != previous_values.end()
158 && it->second.get_type() == port->value().get_type())
159 port->setValue(it->second);
161 self.m_inlets.push_back(port);
162 self.controlAdded(port->id());
168 auto nm = QString::fromStdString(input.name);
169 ossia::vec2f min{-100., -100.};
170 ossia::vec2f max{100., 100.};
171 ossia::vec2f init{0.0, 0.0};
173 std::copy_n(v.def->begin(), 2, init.begin());
175 std::copy_n(v.min->begin(), 2, min.begin());
177 std::copy_n(v.max->begin(), 2, max.begin());
178 auto port =
new Process::XYSpinboxes{
187 if(
const QString win = ISFHelpers::firstWindowDeviceName(self); !win.isEmpty())
189 if(nm.contains(
"iMouse"))
192 else if(vsa && nm == QStringLiteral(
"mouse"))
195 else if(nm.contains(
"mouse", Qt::CaseInsensitive))
200 if(
auto it = previous_values.find(nm);
201 it != previous_values.end()
202 && it->second.get_type() == port->value().get_type())
203 port->setValue(it->second);
205 self.m_inlets.push_back(port);
206 self.controlAdded(port->id());
212 auto nm = QString::fromStdString(input.name);
213 ossia::vec3f min{-100., -100., -100.};
214 ossia::vec3f max{100., 100., 100.};
215 ossia::vec3f init{0., 0., 0.};
217 std::copy_n(v.def->begin(), 3, init.begin());
219 std::copy_n(v.min->begin(), 3, min.begin());
221 std::copy_n(v.max->begin(), 3, max.begin());
222 auto port =
new Process::XYZSpinboxes{
225 if(
auto it = previous_values.find(nm);
226 it != previous_values.end()
227 && it->second.get_type() == port->value().get_type())
228 port->setValue(it->second);
230 self.m_inlets.push_back(port);
231 self.controlAdded(port->id());
237 auto nm = QString::fromStdString(input.name);
238 ossia::vec4f init{0.5, 0.5, 0.5, 1.};
241 std::copy_n(v.def->begin(), 4, init.begin());
243 auto port =
new Process::HSVSlider(
246 if(
auto it = previous_values.find(nm);
247 it != previous_values.end()
248 && it->second.get_type() == port->value().get_type())
249 port->setValue(it->second);
251 self.m_inlets.push_back(port);
252 self.controlAdded(port->id());
257 auto port =
new Gfx::TextureInlet(
265 if(input.name ==
"touch" && v.dimensions == 2 && !v.is_array && !v.is_static
268 if(
const QString win = ISFHelpers::firstWindowDeviceName(self); !win.isEmpty())
272 port->setRenderSize(QSize{32, 240});
273 port->setTextureFormat(ossia::texture_format::RGBA32F);
274 port->setTextureFilter(ossia::texture_filter::NEAREST);
275 port->setTextureAddressMode(ossia::texture_address_mode::CLAMP_TO_EDGE);
279 self.m_inlets.push_back(port);
284 auto port =
new Gfx::TextureInlet(
287 self.m_inlets.push_back(port);
294 self.m_inlets.push_back(port);
301 self.m_inlets.push_back(port);
308 self.m_inlets.push_back(port);
320 if(v.access ==
"read_only")
326 auto port =
new Gfx::TextureInlet(
328 self.m_inlets.push_back(port);
334 auto outport =
new Gfx::TextureOutlet(
337 self.m_outlets.push_back(outport);
344 && v.layout.back().type.find(
"[]") != std::string::npos)
346 auto size_inl =
new Process::IntSpinBox{
348 QString::fromStdString(input.name) +
" size",
350 self.m_inlets.push_back(size_inl);
351 self.controlAdded(size_inl->id());
363 auto port =
new Gfx::TextureInlet(
365 self.m_inlets.push_back(port);
373 auto port =
new Gfx::TextureInlet(
375 self.m_inlets.push_back(port);
385 if(v.access ==
"read_only")
387 auto port =
new Gfx::TextureInlet(
389 self.m_inlets.push_back(port);
392 auto outport =
new Gfx::TextureOutlet(
395 self.m_outlets.push_back(outport);
398 Process::Inlet* operator()(
const geometry_input& v) {
return nullptr; }
404 static constexpr int storage_outlet_base = 20000;
405 int outlet_id = storage_outlet_base;
407 for(
const isf::input& input : desc.inputs)
411 previous_values, input, i, self, outlet_id,
412 desc.mode == isf::descriptor::VSA},
424 std::stable_partition(
425 self.m_outlets.begin(), self.m_outlets.end(),
426 [](
Process::Outlet* o) { return o->id().val() >= storage_outlet_base; });
432 if(!desc.outputs.empty())
434 for(
auto it = self.m_outlets.begin(); it != self.m_outlets.end();)
436 if((*it)->id().val() < storage_outlet_base)
439 it = self.m_outlets.erase(it);
448 for(
const auto& out : desc.outputs)
450 self.m_outlets.push_back(
new Gfx::TextureOutlet{
451 QString::fromStdString(out.name),