diff options
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r-- | tools/editor/plugins/animation_player_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | tools/editor/plugins/sample_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 22 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.h | 2 | ||||
-rw-r--r-- | tools/editor/plugins/shader_graph_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | tools/editor/plugins/sprite_frames_editor_plugin.cpp | 63 | ||||
-rw-r--r-- | tools/editor/plugins/tile_map_editor_plugin.cpp | 2 |
7 files changed, 93 insertions, 6 deletions
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 10c7bf79a3..203564e612 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -1404,6 +1404,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { hb->add_child(animation); animation->set_h_size_flags(SIZE_EXPAND_FILL); animation->set_tooltip(TTR("Display list of animations in player.")); + animation->set_clip_text(true); autoplay = memnew( ToolButton ); hb->add_child(autoplay); diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index b094184a29..69602ac995 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -324,12 +324,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag void SampleEditor::_update_sample() { player->stop_all(); - if (sample->get_format()==Sample::FORMAT_IMA_ADPCM) - return; //bye or unsupported generate_preview_texture(sample,peakdisplay); info_label->set_text(TTR("Length:")+" "+String::num(sample->get_length()/(float)sample->get_mix_rate(),2)+"s"); + if (library->has_sample("default")) + library->remove_sample("default"); + library->add_sample("default",sample); } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 10e4fc8475..ee83b6b032 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -585,7 +585,6 @@ void ScriptTextEditor::_code_complete_script(const String& p_code, List<String>* Error err = script->get_language()->complete_code(p_code,script->get_path().get_base_dir(),base,r_options,hint); if (hint!="") { get_text_edit()->set_code_hint(hint); - print_line("hint: "+hint.replace(String::chr(0xFFFF),"|")); } } @@ -2316,6 +2315,22 @@ void ScriptEditor::_script_split_dragged(float) { EditorNode::get_singleton()->save_layout(); } +void ScriptEditor::_unhandled_input(const InputEvent& p_event) { + if (p_event.key.pressed || !is_visible()) return; + if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) { + int next_tab = script_list->get_current() + 1; + next_tab %= script_list->get_item_count(); + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } + if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) { + int next_tab = script_list->get_current() - 1; + next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } +} + void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { if (!bool(EDITOR_DEF("text_editor/restore_scripts_on_load",true))) { @@ -2598,6 +2613,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_history_forward",&ScriptEditor::_history_forward); ObjectTypeDB::bind_method("_history_back",&ScriptEditor::_history_back); ObjectTypeDB::bind_method("_live_auto_reload_running_scripts",&ScriptEditor::_live_auto_reload_running_scripts); + ObjectTypeDB::bind_method("_unhandled_input",&ScriptEditor::_unhandled_input); } @@ -2631,6 +2647,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { tab_container->set_h_size_flags(SIZE_EXPAND_FILL); + ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_GREATER); + ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_LESS); + set_process_unhandled_input(true); + file_menu = memnew( MenuButton ); menu_hb->add_child(file_menu); file_menu->set_text(TTR("File")); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 0636190a41..85412087b4 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -279,6 +279,8 @@ class ScriptEditor : public VBoxContainer { void _script_split_dragged(float); + void _unhandled_input(const InputEvent& p_event); + void _history_forward(); void _history_back(); diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index d567c8e9b3..dea2fe4833 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -176,7 +176,9 @@ void GraphColorRampEdit::_input_event(const InputEvent& p_event) { void GraphColorRampEdit::_notification(int p_what){ if (p_what==NOTIFICATION_ENTER_TREE) { - picker->connect("color_changed",this,"_color_changed"); + if (!picker->is_connected("color_changed",this,"_color_changed")) { + picker->connect("color_changed",this,"_color_changed"); + } } if (p_what==NOTIFICATION_DRAW) { diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 4f59287994..e29a0c8d52 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -31,7 +31,7 @@ #include "io/resource_loader.h" #include "globals.h" #include "tools/editor/editor_settings.h" - +#include "scene/3d/sprite_3d.h" @@ -355,6 +355,35 @@ void SpriteFramesEditor::_animation_select() { } + +static void _find_anim_sprites(Node* p_node,List<Node*> *r_nodes,Ref<SpriteFrames> p_sfames) { + + Node *edited = EditorNode::get_singleton()->get_edited_scene(); + if (!edited) + return; + if (p_node!=edited && p_node->get_owner()!=edited) + return; + + { + AnimatedSprite *as = p_node->cast_to<AnimatedSprite>(); + if (as && as->get_sprite_frames()==p_sfames) { + r_nodes->push_back(p_node); + } + } + + { + AnimatedSprite3D *as = p_node->cast_to<AnimatedSprite3D>(); + if (as && as->get_sprite_frames()==p_sfames) { + r_nodes->push_back(p_node); + } + } + + for(int i=0;i<p_node->get_child_count();i++) { + _find_anim_sprites(p_node->get_child(i),r_nodes,p_sfames); + } + +} + void SpriteFramesEditor::_animation_name_edited(){ if (updating) @@ -381,9 +410,24 @@ void SpriteFramesEditor::_animation_name_edited(){ name=new_name+" "+itos(counter); } + List<Node*> nodes; + _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames)); + undo_redo->create_action(TTR("Rename Animation")); undo_redo->add_do_method(frames,"rename_animation",edited_anim,name); undo_redo->add_undo_method(frames,"rename_animation",name,edited_anim); + + for(List<Node*>::Element *E=nodes.front();E;E=E->next()) { + + String current = E->get()->call("get_animation"); + if (current!=edited_anim) + continue; + + undo_redo->add_do_method(E->get(),"set_animation",name); + undo_redo->add_undo_method(E->get(),"set_animation",edited_anim); + + } + undo_redo->add_do_method(this,"_update_library"); undo_redo->add_undo_method(this,"_update_library"); @@ -406,12 +450,28 @@ void SpriteFramesEditor::_animation_add(){ name=new_name+" "+itos(counter); } + List<Node*> nodes; + _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames)); + + undo_redo->create_action(TTR("Add Animation")); undo_redo->add_do_method(frames,"add_animation",name); undo_redo->add_undo_method(frames,"remove_animation",name); undo_redo->add_do_method(this,"_update_library"); undo_redo->add_undo_method(this,"_update_library"); + + for(List<Node*>::Element *E=nodes.front();E;E=E->next()) { + + String current = E->get()->call("get_animation"); + if (frames->has_animation(current)) + continue; + + undo_redo->add_do_method(E->get(),"set_animation",name); + undo_redo->add_undo_method(E->get(),"set_animation",current); + + } + edited_anim=new_name; undo_redo->commit_action(); @@ -426,6 +486,7 @@ void SpriteFramesEditor::_animation_remove(){ if (!frames->has_animation(edited_anim)) return; + undo_redo->create_action(TTR("Remove Animation")); undo_redo->add_do_method(frames,"remove_animation",edited_anim); undo_redo->add_undo_method(frames,"add_animation",edited_anim); diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index d5f85d3333..9d27ac8aa3 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -223,7 +223,7 @@ void TileMapEditor::_update_palette() { String name; if (tileset->tile_get_name(E->get())!="") { - name = tileset->tile_get_name(E->get()); + name = itos(E->get())+" - "+tileset->tile_get_name(E->get()); } else { name = "#"+itos(E->get()); } |