Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions ss_player/ss_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ void SSEditorPlugin::_install_playback_panel() {
playback_panel = memnew(SSPlaybackPanel);
playback_panel->set_name(String::utf8("SSPlayback"));
playback_panel_button = add_control_to_bottom_panel(playback_panel, String::utf8("SpriteStudio"), Ref<Shortcut>());
// Contextual: only reveal the tab while a SpriteStudioPlayer2D is selected.
if (playback_panel_button) {
playback_panel_button->hide();
// Contextual: Godot 4.3+ bottom panels do not work well in floating windows if we hide the tab button.
// So we leave it visible and clear the player when nothing is selected.
// Additionally, add_control_to_bottom_panel disables floating by default for backwards compatibility.
// We can explicitly enable it by modifying the available_layouts property on the parent EditorDock.
if (playback_panel->get_parent()) {
// 2 (Horizontal) | 4 (Floating) = 6
playback_panel->get_parent()->set("available_layouts", 6);
}
}

Expand Down Expand Up @@ -124,16 +128,10 @@ void SSEditorPlugin::_make_visible(bool p_visible) {
void SSEditorPlugin::make_visible(bool p_visible) {
#endif
if (p_visible) {
if (playback_panel_button) {
playback_panel_button->show();
}
if (playback_panel) {
make_bottom_panel_item_visible(playback_panel);
}
} else {
if (playback_panel_button) {
playback_panel_button->hide();
}
if (playback_panel) {
playback_panel->set_player(nullptr);
}
Expand Down
7 changes: 3 additions & 4 deletions ss_player/ss_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ class SSEditorPlugin : public EditorPlugin {
Ref<SSResourceInspectorPlugin> inspector_plugin;
SSCanvasDropOverlay *canvas_drop_overlay = nullptr;

// Bottom-panel transport UI (AnimationPlayer-style) shown only while a
// SpriteStudioPlayer2D is selected. `playback_panel_button` is the tab
// toggle returned by add_control_to_bottom_panel; we hide/show it to make
// the panel contextual.
// Bottom-panel transport UI (AnimationPlayer-style) shown when a
// SpriteStudioPlayer2D is selected. The dock is always visible
// to support Godot 4.3+ floating windows, but disabled when unselected.
SSPlaybackPanel *playback_panel = nullptr;
Button *playback_panel_button = nullptr;

Expand Down
3 changes: 3 additions & 0 deletions ss_player/ss_playback_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ void SSPlaybackPanel::_build_ui() {
_frame_spin = memnew(SpinBox);
_frame_spin->set_min(0.0);
_frame_spin->set_step(0.01);
// Godot 4.3+ allows setting a custom step for the UI arrows while keeping a fine-grained underlying step.
// Using string "set" ensures compilation compatibility with older Godot 4.x GDExtension headers.
_frame_spin->set("custom_arrow_step", 1.0);
_frame_spin->set_tooltip_text(tr("Current frame."));
_frame_spin->connect("value_changed", callable_mp(this, &SSPlaybackPanel::_on_frame_spin_changed));
scrubber->add_child(_frame_spin);
Expand Down
Loading