Commit 050ac29a authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

gui: initialize model directly after theirs creations

parent 435f3f92
......@@ -2126,7 +2126,7 @@ show_tooltip(editor& ed, const model& mdl, const model_id id);
auto ret = ed.sim.dispatch(
mdl.type, [&]<typename DynamicsModels>(DynamicsModels & dyn_models) {
mdl.type, [&]<typename DynamicsModels>(DynamicsModels& dyn_models) {
using Dynamics = typename DynamicsModels::value_type;
if constexpr (is_detected_v<has_input_port_t, Dynamics>)
return make_input_tooltip(
......@@ -2251,11 +2251,16 @@ add_popup_menuitem(editor& ed, dynamics_type type, model_id* new_model)
if (!ed.sim.models.can_alloc(1) || !d_array.can_alloc(1))
return status::data_array_not_enough_memory;
auto& mdl = d_array.alloc();
auto& dyn = d_array.alloc();
*new_model =;
const auto mdl_id =;
auto* mdl = ed.sim.models.try_to_get(mdl_id);
ed.sim.make_initialize(*mdl, ed.simulation_current);
*new_model = mdl_id;
return status::success;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment