Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Courses
Scotty3D
Commits
37b27f76
Commit
37b27f76
authored
Apr 25, 2021
by
TheNumbat
Browse files
add clear button
parent
6327c4a4
Changes
5
Show whitespace changes
Inline
Side-by-side
src/gui/animate.cpp
View file @
37b27f76
...
@@ -697,9 +697,14 @@ void Animate::set_max(int frames) {
...
@@ -697,9 +697,14 @@ void Animate::set_max(int frames) {
current_frame
=
std
::
min
(
current_frame
,
max_frame
-
1
);
current_frame
=
std
::
min
(
current_frame
,
max_frame
-
1
);
}
}
void
Animate
::
set
(
int
n_frames
,
int
fps
)
{
void
Animate
::
set
(
int
n_frames
,
int
fps
,
bool
replace
)
{
if
(
replace
)
{
max_frame
=
n_frames
;
max_frame
=
n_frames
;
frame_rate
=
fps
;
frame_rate
=
fps
;
}
else
{
max_frame
=
std
::
max
(
n_frames
,
max_frame
);
frame_rate
=
std
::
min
(
frame_rate
,
fps
);
}
current_frame
=
std
::
min
(
current_frame
,
max_frame
-
1
);
current_frame
=
std
::
min
(
current_frame
,
max_frame
-
1
);
}
}
...
...
src/gui/animate.h
View file @
37b27f76
...
@@ -57,7 +57,7 @@ public:
...
@@ -57,7 +57,7 @@ public:
const
Anim_Camera
&
camera
()
const
;
const
Anim_Camera
&
camera
()
const
;
Anim_Camera
&
camera
();
Anim_Camera
&
camera
();
Camera
current_camera
()
const
;
Camera
current_camera
()
const
;
void
set
(
int
n_frames
,
int
fps
);
void
set
(
int
n_frames
,
int
fps
,
bool
replace
);
void
set_max
(
int
frames
);
void
set_max
(
int
frames
);
void
invalidate
(
Skeleton
::
IK_Handle
*
handle
);
void
invalidate
(
Skeleton
::
IK_Handle
*
handle
);
void
invalidate
(
Joint
*
handle
);
void
invalidate
(
Joint
*
handle
);
...
...
src/gui/manager.cpp
View file @
37b27f76
...
@@ -531,7 +531,14 @@ void Manager::UIsidebar(Scene& scene, Undo& undo, float menu_height, Camera& cam
...
@@ -531,7 +531,14 @@ void Manager::UIsidebar(Scene& scene, Undo& undo, float menu_height, Camera& cam
ImGui
::
Text
(
"Edit Scene"
);
ImGui
::
Text
(
"Edit Scene"
);
if
(
ImGui
::
Button
(
"Open Scene"
))
load_scene
(
scene
,
undo
,
true
);
if
(
ImGui
::
Button
(
"Open Scene"
))
load_scene
(
scene
,
undo
,
true
);
if
(
wrap_button
(
"Export Scene"
))
write_scene
(
scene
);
if
(
wrap_button
(
"Export Scene"
))
write_scene
(
scene
);
if
(
wrap_button
(
"Settings"
))
settings_shown
=
true
;
if
(
wrap_button
(
"Clear"
))
{
std
::
vector
<
Scene_ID
>
ids
;
scene
.
for_items
([
&
](
Scene_Item
&
item
)
{
ids
.
push_back
(
item
.
id
());
});
for
(
auto
id
:
ids
)
undo
.
del_obj
(
id
);
undo
.
bundle_last
(
ids
.
size
());
}
if
(
ImGui
::
Button
(
"Import Objects"
))
{
if
(
ImGui
::
Button
(
"Import Objects"
))
{
load_scene
(
scene
,
undo
,
false
);
load_scene
(
scene
,
undo
,
false
);
...
@@ -544,6 +551,7 @@ void Manager::UIsidebar(Scene& scene, Undo& undo, float menu_height, Camera& cam
...
@@ -544,6 +551,7 @@ void Manager::UIsidebar(Scene& scene, Undo& undo, float menu_height, Camera& cam
new_light_window
=
true
;
new_light_window
=
true
;
new_light_focus
=
true
;
new_light_focus
=
true
;
}
}
ImGui
::
Separator
();
ImGui
::
Separator
();
}
}
...
...
src/scene/scene.cpp
View file @
37b27f76
...
@@ -972,7 +972,8 @@ std::string Scene::load(Scene::Load_Opts loader, Undo& undo, Gui::Manager& gui,
...
@@ -972,7 +972,8 @@ std::string Scene::load(Scene::Load_Opts loader, Undo& undo, Gui::Manager& gui,
if
(
anim
->
mDuration
>
0.0
f
)
{
if
(
anim
->
mDuration
>
0.0
f
)
{
gui
.
get_animate
().
set
((
int
)
std
::
ceil
(
anim
->
mDuration
),
gui
.
get_animate
().
set
((
int
)
std
::
ceil
(
anim
->
mDuration
),
(
int
)
std
::
round
(
anim
->
mTicksPerSecond
));
(
int
)
std
::
round
(
anim
->
mTicksPerSecond
),
loader
.
new_scene
);
}
}
}
}
gui
.
get_animate
().
refresh
(
*
this
);
gui
.
get_animate
().
refresh
(
*
this
);
...
...
src/scene/undo.cpp
View file @
37b27f76
...
@@ -742,6 +742,8 @@ void Undo::redo() {
...
@@ -742,6 +742,8 @@ void Undo::redo() {
void
Undo
::
bundle_last
(
size_t
n
)
{
void
Undo
::
bundle_last
(
size_t
n
)
{
if
(
!
n
)
return
;
std
::
vector
<
std
::
unique_ptr
<
Action_Base
>>
undo_pack
;
std
::
vector
<
std
::
unique_ptr
<
Action_Base
>>
undo_pack
;
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
undo_pack
.
push_back
(
std
::
move
(
undos
.
top
()));
undo_pack
.
push_back
(
std
::
move
(
undos
.
top
()));
...
...
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