mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-03-01 10:54:23 +01:00
parent
fa9d1120c4
commit
45a1c98332
@ -446,6 +446,7 @@ void SpriteFramesEditor::_notification(int p_what) {
|
|||||||
zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons"));
|
zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons"));
|
||||||
new_anim->set_icon(get_icon("New", "EditorIcons"));
|
new_anim->set_icon(get_icon("New", "EditorIcons"));
|
||||||
remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
|
remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
|
||||||
|
anim_search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||||
split_sheet_zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
|
split_sheet_zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
|
||||||
split_sheet_zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
|
split_sheet_zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
|
||||||
split_sheet_zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons"));
|
split_sheet_zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons"));
|
||||||
@ -776,7 +777,7 @@ void SpriteFramesEditor::_animation_name_edited() {
|
|||||||
undo_redo->add_do_method(this, "_update_library");
|
undo_redo->add_do_method(this, "_update_library");
|
||||||
undo_redo->add_undo_method(this, "_update_library");
|
undo_redo->add_undo_method(this, "_update_library");
|
||||||
|
|
||||||
edited_anim = new_name;
|
edited_anim = name;
|
||||||
|
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
}
|
}
|
||||||
@ -842,6 +843,10 @@ void SpriteFramesEditor::_animation_remove_confirmed() {
|
|||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpriteFramesEditor::_animation_search_text_changed(const String &p_text) {
|
||||||
|
_update_library();
|
||||||
|
}
|
||||||
|
|
||||||
void SpriteFramesEditor::_animation_loop_changed() {
|
void SpriteFramesEditor::_animation_loop_changed() {
|
||||||
if (updating) {
|
if (updating) {
|
||||||
return;
|
return;
|
||||||
@ -931,9 +936,16 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
|
|||||||
|
|
||||||
anim_names.sort_custom<StringName::AlphCompare>();
|
anim_names.sort_custom<StringName::AlphCompare>();
|
||||||
|
|
||||||
|
bool searching = anim_search_box->get_text().size();
|
||||||
|
String searched_string = searching ? anim_search_box->get_text().to_lower() : String();
|
||||||
|
|
||||||
for (List<StringName>::Element *E = anim_names.front(); E; E = E->next()) {
|
for (List<StringName>::Element *E = anim_names.front(); E; E = E->next()) {
|
||||||
String name = E->get();
|
String name = E->get();
|
||||||
|
|
||||||
|
if (searching && name.to_lower().find(searched_string) < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
TreeItem *it = animations->create_item(anim_root);
|
TreeItem *it = animations->create_item(anim_root);
|
||||||
|
|
||||||
it->set_metadata(0, name);
|
it->set_metadata(0, name);
|
||||||
@ -996,7 +1008,6 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
|
|||||||
anim_loop->set_pressed(frames->get_animation_loop(edited_anim));
|
anim_loop->set_pressed(frames->get_animation_loop(edited_anim));
|
||||||
|
|
||||||
updating = false;
|
updating = false;
|
||||||
//player->add_resource("default",resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
|
void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
|
||||||
@ -1168,6 +1179,7 @@ void SpriteFramesEditor::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("_animation_add"), &SpriteFramesEditor::_animation_add);
|
ClassDB::bind_method(D_METHOD("_animation_add"), &SpriteFramesEditor::_animation_add);
|
||||||
ClassDB::bind_method(D_METHOD("_animation_remove"), &SpriteFramesEditor::_animation_remove);
|
ClassDB::bind_method(D_METHOD("_animation_remove"), &SpriteFramesEditor::_animation_remove);
|
||||||
ClassDB::bind_method(D_METHOD("_animation_remove_confirmed"), &SpriteFramesEditor::_animation_remove_confirmed);
|
ClassDB::bind_method(D_METHOD("_animation_remove_confirmed"), &SpriteFramesEditor::_animation_remove_confirmed);
|
||||||
|
ClassDB::bind_method(D_METHOD("_animation_search_text_changed"), &SpriteFramesEditor::_animation_search_text_changed);
|
||||||
ClassDB::bind_method(D_METHOD("_animation_loop_changed"), &SpriteFramesEditor::_animation_loop_changed);
|
ClassDB::bind_method(D_METHOD("_animation_loop_changed"), &SpriteFramesEditor::_animation_loop_changed);
|
||||||
ClassDB::bind_method(D_METHOD("_animation_fps_changed"), &SpriteFramesEditor::_animation_fps_changed);
|
ClassDB::bind_method(D_METHOD("_animation_fps_changed"), &SpriteFramesEditor::_animation_fps_changed);
|
||||||
ClassDB::bind_method(D_METHOD("_tree_input"), &SpriteFramesEditor::_tree_input);
|
ClassDB::bind_method(D_METHOD("_tree_input"), &SpriteFramesEditor::_tree_input);
|
||||||
@ -1212,6 +1224,13 @@ SpriteFramesEditor::SpriteFramesEditor() {
|
|||||||
hbc_animlist->add_child(remove_anim);
|
hbc_animlist->add_child(remove_anim);
|
||||||
remove_anim->connect("pressed", this, "_animation_remove");
|
remove_anim->connect("pressed", this, "_animation_remove");
|
||||||
|
|
||||||
|
anim_search_box = memnew(LineEdit);
|
||||||
|
hbc_animlist->add_child(anim_search_box);
|
||||||
|
anim_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
anim_search_box->set_placeholder(TTR("Filter animations"));
|
||||||
|
anim_search_box->set_clear_button_enabled(true);
|
||||||
|
anim_search_box->connect("text_changed", this, "_animation_search_text_changed");
|
||||||
|
|
||||||
animations = memnew(Tree);
|
animations = memnew(Tree);
|
||||||
sub_vb->add_child(animations);
|
sub_vb->add_child(animations);
|
||||||
animations->set_v_size_flags(SIZE_EXPAND_FILL);
|
animations->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
@ -1493,6 +1512,10 @@ SpriteFramesEditor::SpriteFramesEditor() {
|
|||||||
updating_split_settings = false;
|
updating_split_settings = false;
|
||||||
|
|
||||||
_zoom_reset();
|
_zoom_reset();
|
||||||
|
|
||||||
|
// Ensure the anim search box is wide enough by default.
|
||||||
|
// Not by setting its minimum size so it can still be shrinked if desired.
|
||||||
|
set_split_offset(56 * EDSCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFramesEditorPlugin::edit(Object *p_object) {
|
void SpriteFramesEditorPlugin::edit(Object *p_object) {
|
||||||
|
@ -58,6 +58,7 @@ class TextureRect;
|
|||||||
class ToolButton;
|
class ToolButton;
|
||||||
class Tree;
|
class Tree;
|
||||||
class UndoRedo;
|
class UndoRedo;
|
||||||
|
class LineEdit;
|
||||||
|
|
||||||
class SpriteFramesEditor : public HSplitContainer {
|
class SpriteFramesEditor : public HSplitContainer {
|
||||||
GDCLASS(SpriteFramesEditor, HSplitContainer);
|
GDCLASS(SpriteFramesEditor, HSplitContainer);
|
||||||
@ -87,6 +88,7 @@ class SpriteFramesEditor : public HSplitContainer {
|
|||||||
|
|
||||||
ToolButton *new_anim;
|
ToolButton *new_anim;
|
||||||
ToolButton *remove_anim;
|
ToolButton *remove_anim;
|
||||||
|
LineEdit *anim_search_box;
|
||||||
|
|
||||||
Tree *animations;
|
Tree *animations;
|
||||||
SpinBox *anim_speed;
|
SpinBox *anim_speed;
|
||||||
@ -151,6 +153,7 @@ class SpriteFramesEditor : public HSplitContainer {
|
|||||||
void _animation_add();
|
void _animation_add();
|
||||||
void _animation_remove();
|
void _animation_remove();
|
||||||
void _animation_remove_confirmed();
|
void _animation_remove_confirmed();
|
||||||
|
void _animation_search_text_changed(const String &p_text);
|
||||||
void _animation_loop_changed();
|
void _animation_loop_changed();
|
||||||
void _animation_fps_changed(double p_value);
|
void _animation_fps_changed(double p_value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user