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
6327c4a4
Unverified
Commit
6327c4a4
authored
Apr 24, 2021
by
Max Slater
Committed by
GitHub
Apr 24, 2021
Browse files
Merge pull request #16 from tchittesh/master
add move keyframe left/right buttons
parents
42b027ac
42dc7b41
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/gui/animate.cpp
View file @
6327c4a4
...
...
@@ -410,6 +410,24 @@ void Animate::timeline(Manager& manager, Undo& undo, Scene& scene, Scene_Maybe o
ImGui
::
Text
(
"Keyframe:"
);
ImGui
::
SameLine
();
auto
all_keys
=
[](
Scene_Item
&
item
)
{
Anim_Pose
animation
=
item
.
animation
();
std
::
set
<
float
>
keys
=
animation
.
splines
.
keys
();
if
(
item
.
is
<
Scene_Light
>
())
{
std
::
set
<
float
>
more_keys
=
item
.
get
<
Scene_Light
>
().
lanim
.
splines
.
keys
();
keys
.
insert
(
more_keys
.
begin
(),
more_keys
.
end
());
}
if
(
item
.
is
<
Scene_Object
>
())
{
std
::
set
<
float
>
more_keys
=
item
.
get
<
Scene_Object
>
().
armature
.
keys
();
keys
.
insert
(
more_keys
.
begin
(),
more_keys
.
end
());
}
if
(
item
.
is
<
Scene_Particles
>
())
{
std
::
set
<
float
>
more_keys
=
item
.
get
<
Scene_Particles
>
().
panim
.
splines
.
keys
();
keys
.
insert
(
more_keys
.
begin
(),
more_keys
.
end
());
}
return
keys
;
};
auto
set_item
=
[
&
,
this
](
Scene_Item
&
item
)
{
if
(
item
.
is
<
Scene_Object
>
())
{
undo
.
anim_object
(
item
.
id
(),
(
float
)
current_frame
);
...
...
@@ -472,6 +490,40 @@ void Animate::timeline(Manager& manager, Undo& undo, Scene& scene, Scene_Maybe o
undo
.
bundle_last
(
undo
.
n_actions
()
-
n
);
}
ImGui
::
SameLine
();
if
(
ImGui
::
Button
(
"Move Left"
)
&&
current_frame
>
0
)
{
if
(
camera_selected
&&
anim_camera
.
splines
.
has
((
float
)
current_frame
))
{
undo
.
anim_clear_camera
(
anim_camera
,
(
float
)
current_frame
);
current_frame
--
;
undo
.
anim_camera
(
anim_camera
,
(
float
)
current_frame
,
ui_camera
.
get
());
camera_spline
();
undo
.
bundle_last
(
2
);
}
else
if
(
select
&&
all_keys
(
*
select
).
count
((
float
)
current_frame
))
{
clear_item
(
*
select
);
current_frame
--
;
set_item
(
*
select
);
undo
.
bundle_last
(
2
);
}
frame_changed
=
true
;
}
ImGui
::
SameLine
();
if
(
ImGui
::
Button
(
"Move Right"
)
&&
current_frame
<
max_frame
-
1
)
{
if
(
camera_selected
&&
anim_camera
.
splines
.
has
((
float
)
current_frame
))
{
undo
.
anim_clear_camera
(
anim_camera
,
(
float
)
current_frame
);
current_frame
++
;
undo
.
anim_camera
(
anim_camera
,
(
float
)
current_frame
,
ui_camera
.
get
());
camera_spline
();
undo
.
bundle_last
(
2
);
}
else
if
(
select
&&
all_keys
(
*
select
).
count
((
float
)
current_frame
))
{
clear_item
(
*
select
);
current_frame
++
;
set_item
(
*
select
);
undo
.
bundle_last
(
2
);
}
frame_changed
=
true
;
}
ImGui
::
Separator
();
ImGui
::
Dummy
({
74.0
f
,
1.0
f
});
ImGui
::
SameLine
();
...
...
@@ -560,21 +612,7 @@ void Animate::timeline(Manager& manager, Undo& undo, Scene& scene, Scene_Maybe o
ImGui
::
PushID
(
item
.
id
());
Anim_Pose
animation
=
item
.
animation
();
std
::
set
<
float
>
keys
=
animation
.
splines
.
keys
();
if
(
item
.
is
<
Scene_Light
>
())
{
std
::
set
<
float
>
more_keys
=
item
.
get
<
Scene_Light
>
().
lanim
.
splines
.
keys
();
keys
.
insert
(
more_keys
.
begin
(),
more_keys
.
end
());
}
if
(
item
.
is
<
Scene_Object
>
())
{
std
::
set
<
float
>
more_keys
=
item
.
get
<
Scene_Object
>
().
armature
.
keys
();
keys
.
insert
(
more_keys
.
begin
(),
more_keys
.
end
());
}
if
(
item
.
is
<
Scene_Particles
>
())
{
std
::
set
<
float
>
more_keys
=
item
.
get
<
Scene_Particles
>
().
panim
.
splines
.
keys
();
keys
.
insert
(
more_keys
.
begin
(),
more_keys
.
end
());
}
auto
keys
=
all_keys
(
item
);
for
(
float
f
:
keys
)
{
int
frame
=
(
int
)
std
::
round
(
f
);
if
(
frame
>=
0
&&
frame
<
max_frame
)
frames
[
frame
]
=
true
;
...
...
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