Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gauthier Quesnel
irritator
Commits
050ac29a
Commit
050ac29a
authored
Nov 04, 2020
by
Gauthier Quesnel
Browse files
gui: initialize model directly after theirs creations
parent
435f3f92
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/gui/node-editor.cpp
View file @
050ac29a
...
...
@@ -2126,7 +2126,7 @@ show_tooltip(editor& ed, const model& mdl, const model_id id)
mdl
.
tn
);
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
();
ed
.
sim
.
alloc
(
mdl
,
d_array
.
get_id
(
mdl
),
auto
&
dyn
=
d_array
.
alloc
();
ed
.
sim
.
alloc
(
dyn
,
d_array
.
get_id
(
dyn
),
dynamics_type_names
[
static_cast
<
i8
>
(
type
)]);
*
new_model
=
mdl
.
id
;
const
auto
mdl_id
=
dyn
.
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment