Skip to content
GitLab
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
abccb34f
Commit
abccb34f
authored
Apr 21, 2021
by
Gauthier Quesnel
Browse files
gui: enable generator/buffer external sources
parent
acb8b5f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/gui/node-editor.cpp
View file @
abccb34f
...
...
@@ -1910,6 +1910,23 @@ show_dynamics_inputs(buffer& dyn)
{
ImGui
::
InputDouble
(
"value"
,
&
dyn
.
default_value
);
ImGui
::
InputDouble
(
"offset"
,
&
dyn
.
default_offset
);
{
const
char
*
title
=
"Select time sources"
;
if
(
ImGui
::
Button
(
"Times"
))
ImGui
::
OpenPopup
(
title
);
ImGui
::
SameLine
();
if
(
dyn
.
default_lambda_source
.
data
==
nullptr
)
{
ImGui
::
TextUnformatted
(
"<None>"
);
}
else
{
ImGui
::
Text
(
"%"
PRIu32
"-%"
PRIu32
,
dyn
.
default_lambda_source
.
type
,
dyn
.
default_lambda_source
.
id
);
}
app
.
srcs
.
show_menu
(
title
,
dyn
.
default_lambda_source
);
}
}
static
void
...
...
@@ -1918,17 +1935,39 @@ show_dynamics_inputs(generator& dyn)
ImGui
::
InputDouble
(
"value"
,
&
dyn
.
default_value
);
ImGui
::
InputDouble
(
"offset"
,
&
dyn
.
default_offset
);
if
(
ImGui
::
Button
(
"Select.."
))
ImGui
::
OpenPopup
(
"Select source"
);
ImGui
::
SameLine
();
if
(
dyn
.
default_value_source_id
==
external_source_id
{
0
})
{
ImGui
::
TextUnformatted
(
"<None>"
);
}
else
{
ImGui
::
Text
(
"%"
PRIu64
,
static_cast
<
u64
>
(
dyn
.
default_value_source_id
));
{
const
char
*
title
=
"Select values sources"
;
if
(
ImGui
::
Button
(
"Values"
))
ImGui
::
OpenPopup
(
title
);
ImGui
::
SameLine
();
if
(
dyn
.
default_value_source
.
data
==
nullptr
)
{
ImGui
::
TextUnformatted
(
"<None>"
);
}
else
{
ImGui
::
Text
(
"%"
PRIu32
"-%"
PRIu32
,
dyn
.
default_value_source
.
type
,
dyn
.
default_value_source
.
id
);
}
app
.
srcs
.
show_menu
(
title
,
dyn
.
default_value_source
);
}
external_source
src
;
app
.
srcs
.
show_menu
(
src
);
{
const
char
*
title
=
"Select time sources"
;
if
(
ImGui
::
Button
(
"Times"
))
ImGui
::
OpenPopup
(
title
);
ImGui
::
SameLine
();
if
(
dyn
.
default_lambda_source
.
data
==
nullptr
)
{
ImGui
::
TextUnformatted
(
"<None>"
);
}
else
{
ImGui
::
Text
(
"%"
PRIu32
"-%"
PRIu32
,
dyn
.
default_lambda_source
.
type
,
dyn
.
default_lambda_source
.
id
);
}
app
.
srcs
.
show_menu
(
title
,
dyn
.
default_lambda_source
);
}
}
static
void
...
...
app/gui/node-editor.hpp
View file @
abccb34f
...
...
@@ -311,7 +311,7 @@ struct sources
irt
::
source
::
text_file
*
new_text_file
()
noexcept
;
void
show
(
bool
*
is_show
);
void
show_menu
(
external_source
&
src
);
void
show_menu
(
const
char
*
title
,
external_source
&
src
);
};
struct
editor
...
...
app/gui/sources.cpp
View file @
abccb34f
...
...
@@ -763,14 +763,14 @@ sources::show(bool* is_show)
}
void
sources
::
show_menu
(
external_source
&
src
)
sources
::
show_menu
(
const
char
*
title
,
external_source
&
src
)
{
small_string
<
16
>
tmp
;
std
::
pair
<
const
int
,
source
::
constant
>*
constant_ptr
=
nullptr
;
std
::
pair
<
const
int
,
source
::
binary_file
>*
binary_file_ptr
=
nullptr
;
std
::
pair
<
const
int
,
source
::
text_file
>*
text_file_ptr
=
nullptr
;
if
(
ImGui
::
BeginPopup
(
"Select source"
))
{
if
(
ImGui
::
BeginPopup
(
title
))
{
if
(
!
csts
.
empty
()
&&
ImGui
::
BeginMenu
(
"Constant"
))
{
for
(
auto
&
elem
:
csts
)
{
fmt
::
format_to_n
(
tmp
.
begin
(),
tmp
.
capacity
(),
"{}"
,
elem
.
first
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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