summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/asset_library_editor_plugin.cpp6
-rw-r--r--tools/editor/code_editor.cpp17
-rw-r--r--tools/editor/connections_dialog.cpp49
-rw-r--r--tools/editor/connections_dialog.h1
-rw-r--r--tools/editor/create_dialog.cpp6
-rw-r--r--tools/editor/editor_help.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp45
-rw-r--r--tools/editor/plugins/script_editor_plugin.h2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp8
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.cpp44
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.h2
-rw-r--r--tools/editor/property_editor.cpp2
-rw-r--r--tools/editor/quick_open.cpp4
-rw-r--r--tools/editor/scene_tree_editor.cpp2
14 files changed, 169 insertions, 21 deletions
diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp
index 928acdbcbb..c571310ded 100644
--- a/tools/editor/asset_library_editor_plugin.cpp
+++ b/tools/editor/asset_library_editor_plugin.cpp
@@ -541,8 +541,12 @@ void EditorAssetLibrary::_notification(int p_what) {
error_hb->add_child(tf);
error_label->raise();
+ }
- _repository_changed(0);
+ if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+ if(!is_hidden()) {
+ _repository_changed(0); // Update when shown for the first time
+ }
}
if (p_what==NOTIFICATION_PROCESS) {
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index f62209fafa..be5d9c47ff 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -247,8 +247,18 @@ void FindReplaceBar::_get_search_from(int& r_line, int& r_col) {
r_col=text_edit->cursor_get_column();
if (text_edit->is_selection_active() && !replace_all_mode) {
- r_line=text_edit->get_selection_from_line();
- r_col=text_edit->get_selection_to_column();
+
+ int selection_line=text_edit->get_selection_from_line();
+
+ if (text_edit->get_selection_text()==get_search_text() && r_line==selection_line) {
+
+ int selection_from_col=text_edit->get_selection_from_column();
+
+ if (r_col>=selection_from_col && r_col<=text_edit->get_selection_to_column()) {
+ r_col=selection_line;
+ r_col=selection_from_col;
+ }
+ }
}
if (r_line==result_line && r_col>=result_col && r_col<=result_col+get_search_text().length()) {
@@ -521,6 +531,9 @@ FindReplaceBar::FindReplaceBar() {
error_label = memnew(Label);
search_options->add_child(error_label);
+ error_label->add_color_override("font_color", Color(1,1,0,1));
+ error_label->add_color_override("font_color_shadow", Color(0,0,0,1));
+ error_label->add_constant_override("shadow_as_outline", 1);
search_options->add_spacer();
diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp
index 222e42f8a7..8847654ad7 100644
--- a/tools/editor/connections_dialog.cpp
+++ b/tools/editor/connections_dialog.cpp
@@ -35,6 +35,7 @@
#include "print_string.h"
#include "editor_settings.h"
#include "editor_node.h"
+#include "plugins/script_editor_plugin.h"
class ConnectDialogBinds : public Object {
@@ -766,11 +767,58 @@ void ConnectionsDock::_something_selected() {
}
+void ConnectionsDock::_something_activated() {
+
+ TreeItem *item = tree->get_selected();
+
+ if (!item)
+ return;
+
+ if (item->get_parent()==tree->get_root() || item->get_parent()->get_parent()==tree->get_root()) {
+ // a signal - connect
+ String signal=item->get_metadata(0).operator Dictionary()["name"];
+ String midname=node->get_name();
+ for(int i=0;i<midname.length();i++) {
+ CharType c = midname[i];
+ if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_') {
+ //all good
+ } else if (c==' ') {
+ c='_';
+ } else {
+ midname.remove(i);
+ i--;
+ continue;
+ }
+
+ midname[i]=c;
+ }
+
+ connect_dialog->edit(node);
+ connect_dialog->popup_centered_ratio();
+ connect_dialog->set_dst_method("_on_"+midname+"_"+signal);
+ connect_dialog->set_dst_node(node->get_owner()?node->get_owner():node);
+ } else {
+ // a slot - go to target method
+ Connection c=item->get_metadata(0);
+ ERR_FAIL_COND(c.source!=node); //shouldn't happen but...bugcheck
+
+ if (!c.target)
+ return;
+
+ Ref<Script> script = c.target->get_script();
+
+ if (script.is_valid() && ScriptEditor::get_singleton()->script_go_to_method(script,c.method)) {
+ editor->call("_editor_select",EditorNode::EDITOR_SCRIPT);
+ }
+ }
+}
+
void ConnectionsDock::_bind_methods() {
ObjectTypeDB::bind_method("_connect",&ConnectionsDock::_connect);
ObjectTypeDB::bind_method("_something_selected",&ConnectionsDock::_something_selected);
+ ObjectTypeDB::bind_method("_something_activated",&ConnectionsDock::_something_activated);
ObjectTypeDB::bind_method("_close",&ConnectionsDock::_close);
ObjectTypeDB::bind_method("_connect_pressed",&ConnectionsDock::_connect_pressed);
ObjectTypeDB::bind_method("update_tree",&ConnectionsDock::update_tree);
@@ -823,6 +871,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
remove_confirm->connect("confirmed", this,"_remove_confirm");
connect_dialog->connect("connected", this,"_connect");
tree->connect("item_selected", this,"_something_selected");
+ tree->connect("item_activated", this,"_something_activated");
add_constant_override("separation",3*EDSCALE);
}
diff --git a/tools/editor/connections_dialog.h b/tools/editor/connections_dialog.h
index 96ebaf85b0..73f52abc9e 100644
--- a/tools/editor/connections_dialog.h
+++ b/tools/editor/connections_dialog.h
@@ -111,6 +111,7 @@ class ConnectionsDock : public VBoxContainer {
void _close();
void _connect();
void _something_selected();
+ void _something_activated();
UndoRedo *undo_redo;
protected:
diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp
index b6137ddac0..5275e1beeb 100644
--- a/tools/editor/create_dialog.cpp
+++ b/tools/editor/create_dialog.cpp
@@ -103,7 +103,7 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty
item->set_selectable(0,false);
} else {
- if (!*to_select && (search_box->get_text()=="" || p_type.findn(search_box->get_text())!=-1)) {
+ if (!*to_select && (search_box->get_text().is_subsequence_ofi(p_type))) {
*to_select=item;
}
@@ -172,7 +172,7 @@ void CreateDialog::_update_search() {
bool found=false;
String type=I->get();
while(type!="" && ObjectTypeDB::is_type(type,base_type) && type!=base_type) {
- if (type.findn(search_box->get_text())!=-1) {
+ if (search_box->get_text().is_subsequence_ofi(type)) {
found=true;
break;
@@ -194,7 +194,7 @@ void CreateDialog::_update_search() {
const Vector<EditorData::CustomType> &ct = EditorNode::get_editor_data().get_custom_types()[type];
for(int i=0;i<ct.size();i++) {
- bool show = search_box->get_text()=="" || ct[i].name.findn(search_box->get_text())!=-1;
+ bool show = search_box->get_text().is_subsequence_ofi(ct[i].name);
if (!show)
continue;
diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp
index ac9feacd46..0b60db5ee3 100644
--- a/tools/editor/editor_help.cpp
+++ b/tools/editor/editor_help.cpp
@@ -453,7 +453,7 @@ void EditorHelpIndex::_update_class_list() {
String type = E->key();
while(type != "") {
- if (type.findn(filter)!=-1) {
+ if (filter.is_subsequence_ofi(type)) {
if (to_select.empty()) {
to_select = type;
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 8b7323ec08..a313b0053a 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -2503,6 +2503,51 @@ void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) {
}
}
+bool ScriptEditor::script_go_to_method(Ref<Script> p_script, const String& p_method) {
+
+ Vector<String> functions;
+ bool found=false;
+
+ for (int i=0;i<tab_container->get_child_count();i++) {
+ ScriptTextEditor *current = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
+
+ if (current && current->get_edited_script()==p_script) {
+ functions=current->get_functions();
+ found=true;
+ break;
+ }
+ }
+
+ if (!found) {
+ String errortxt;
+ int line=-1,col;
+ String text=p_script->get_source_code();
+ List<String> fnc;
+
+ if (p_script->get_language()->validate(text,line,col,errortxt,p_script->get_path(),&fnc)) {
+
+ for (List<String>::Element *E=fnc.front();E;E=E->next())
+ functions.push_back(E->get());
+ }
+ }
+
+ String method_search = p_method + ":";
+
+ for (int i=0;i<functions.size();i++) {
+ String function=functions[i];
+
+ if (function.begins_with(method_search)) {
+
+ edit(p_script);
+ int line=function.get_slice(":",1).to_int();
+ _goto_script_line2(line-1);
+ return true;
+ }
+ }
+
+ return false;
+}
+
void ScriptEditor::set_live_auto_reload_running_scripts(bool p_enabled) {
auto_reload_running_scripts=p_enabled;
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 5a9dce759e..3d723adfe9 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -325,6 +325,8 @@ public:
void set_scene_root_script( Ref<Script> p_script );
+ bool script_go_to_method(Ref<Script> p_script, const String& p_method);
+
virtual void edited_scene_changed();
ScriptEditorDebugger *get_debugger() { return debugger; }
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index e261b48f67..fdb654571a 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -996,26 +996,26 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
case TRANSFORM_VIEW: {
_edit.plane=TRANSFORM_X_AXIS;
- set_message(TTR("View Plane Transform."),2);
+ set_message(TTR("X-Axis Transform."),2);
name="";
_update_name();
} break;
case TRANSFORM_X_AXIS: {
_edit.plane=TRANSFORM_Y_AXIS;
- set_message(TTR("X-Axis Transform."),2);
+ set_message(TTR("Y-Axis Transform."),2);
} break;
case TRANSFORM_Y_AXIS: {
_edit.plane=TRANSFORM_Z_AXIS;
- set_message(TTR("Y-Axis Transform."),2);
+ set_message(TTR("Z-Axis Transform."),2);
} break;
case TRANSFORM_Z_AXIS: {
_edit.plane=TRANSFORM_VIEW;
- set_message(TTR("Z-Axis Transform."),2);
+ set_message(TTR("View Plane Transform."),2);
} break;
}
diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp
index b69b0d7a9b..57db19b736 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.cpp
+++ b/tools/editor/plugins/texture_region_editor_plugin.cpp
@@ -43,6 +43,8 @@ void TextureRegionEditor::_region_draw()
base_tex = node_patch9->get_texture();
else if(node_type == "StyleBoxTexture" && obj_styleBox)
base_tex = obj_styleBox->get_texture();
+ else if(node_type == "AtlasTexture" && atlas_tex)
+ base_tex = atlas_tex->get_atlas();
if (base_tex.is_null())
return;
@@ -164,6 +166,8 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
drag=true;
if(node_type == "Sprite" && node_sprite )
rect_prev=node_sprite->get_region_rect();
+ else if(node_type == "AtlasTexture" && atlas_tex)
+ rect_prev=atlas_tex->get_region();
else if(node_type == "Patch9Frame" && node_patch9)
rect_prev=node_patch9->get_region_rect();
else if(node_type == "StyleBoxTexture" && obj_styleBox)
@@ -191,10 +195,18 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
undo_redo->add_do_method(node_sprite ,"set_region_rect",node_sprite->get_region_rect());
undo_redo->add_undo_method(node_sprite,"set_region_rect",rect_prev);
}
+ else if(node_type == "AtlasTexture" && atlas_tex ){
+ undo_redo->add_do_method(atlas_tex ,"set_region",atlas_tex->get_region());
+ undo_redo->add_undo_method(atlas_tex,"set_region",rect_prev);
+ }
else if(node_type == "Patch9Frame" && node_patch9){
undo_redo->add_do_method(node_patch9 ,"set_region_rect",node_patch9->get_region_rect());
undo_redo->add_undo_method(node_patch9,"set_region_rect",rect_prev);
}
+ else if(node_type == "StyleBoxTexture" && obj_styleBox){
+ undo_redo->add_do_method(obj_styleBox ,"set_region_rect",obj_styleBox->get_region_rect());
+ undo_redo->add_undo_method(obj_styleBox,"set_region_rect",rect_prev);
+ }
undo_redo->add_do_method(edit_draw,"update");
undo_redo->add_undo_method(edit_draw,"update");
undo_redo->commit_action();
@@ -355,6 +367,8 @@ void TextureRegionEditor::apply_rect(const Rect2& rect){
node_patch9->set_region_rect(rect);
else if(obj_styleBox)
obj_styleBox->set_region_rect(rect);
+ else if(atlas_tex)
+ atlas_tex->set_region(rect);
}
else if(this->editing_region == REGION_PATCH_MARGIN) {
if(node_patch9) {
@@ -387,10 +401,11 @@ void TextureRegionEditor::_notification(int p_what)
void TextureRegionEditor::_node_removed(Object *p_obj)
{
- if(p_obj == node_sprite || p_obj == node_patch9 || p_obj == obj_styleBox) {
- node_patch9 = NULL;
- node_sprite = NULL;
+ if(p_obj == node_sprite || p_obj == node_patch9 || p_obj == obj_styleBox || p_obj == atlas_tex) {
+ node_patch9 = NULL;
+ node_sprite = NULL;
obj_styleBox = NULL;
+ atlas_tex = NULL;
hide();
}
}
@@ -421,30 +436,42 @@ void TextureRegionEditor::edit(Object *p_obj)
node_sprite = p_obj->cast_to<Sprite>();
node_patch9 = NULL;
obj_styleBox = NULL;
+ atlas_tex = NULL;
+ }
+ else if(node_type == "AtlasTexture") {
+ atlas_tex = p_obj->cast_to<AtlasTexture>();
+ node_sprite = NULL;
+ node_patch9 = NULL;
+ obj_styleBox = NULL;
}
else if(node_type == "Patch9Frame") {
node_patch9 = p_obj->cast_to<Patch9Frame>();
node_sprite = NULL;
obj_styleBox = NULL;
+ atlas_tex = NULL;
margin_button->show();
}
else if(node_type == "StyleBoxTexture") {
obj_styleBox = p_obj->cast_to<StyleBoxTexture>();
node_sprite = NULL;
node_patch9 = NULL;
+ atlas_tex = NULL;
margin_button->show();
}
p_obj->connect("exit_tree",this,"_node_removed",varray(p_obj),CONNECT_ONESHOT);
} else {
if(node_sprite)
node_sprite->disconnect("exit_tree",this,"_node_removed");
+ else if(atlas_tex)
+ atlas_tex->disconnect("exit_tree",this,"_node_removed");
else if(node_patch9)
node_patch9->disconnect("exit_tree",this,"_node_removed");
else if(obj_styleBox)
obj_styleBox->disconnect("exit_tree",this,"_node_removed");
- node_sprite = NULL;
- node_patch9 = NULL;
+ node_sprite = NULL;
+ node_patch9 = NULL;
obj_styleBox = NULL;
+ atlas_tex = NULL;
}
}
@@ -469,6 +496,8 @@ void TextureRegionEditor::_edit_node(int region)
texture = node_patch9->get_texture();
else if(node_type == "StyleBoxTexture" && obj_styleBox)
texture = obj_styleBox->get_texture();
+ else if(node_type == "AtlasTexture" && atlas_tex)
+ texture = atlas_tex->get_atlas();
if (texture.is_null()) {
error->set_text(TTR("No texture in this node.\nSet a texture to be able to edit region."));
@@ -482,6 +511,8 @@ void TextureRegionEditor::_edit_node(int region)
tex_region = node_patch9->get_region_rect();
else if(node_type == "StyleBoxTexture" && obj_styleBox)
tex_region = obj_styleBox->get_region_rect();
+ else if(node_type == "AtlasTexture" && atlas_tex)
+ tex_region = atlas_tex->get_region();
rect = tex_region;
if(region == REGION_PATCH_MARGIN) {
@@ -521,6 +552,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
{
node_sprite = NULL;
node_patch9 = NULL;
+ atlas_tex = NULL;
editor=p_editor;
undo_redo = editor->get_undo_redo();
@@ -661,7 +693,7 @@ void TextureRegionEditorPlugin::edit(Object *p_node)
bool TextureRegionEditorPlugin::handles(Object *p_obj) const
{
- return p_obj->is_type("Sprite") || p_obj->is_type("Patch9Frame") || p_obj->is_type("StyleBoxTexture");
+ return p_obj->is_type("Sprite") || p_obj->is_type("Patch9Frame") || p_obj->is_type("StyleBoxTexture") || p_obj->is_type("AtlasTexture");
}
void TextureRegionEditorPlugin::make_visible(bool p_visible)
diff --git a/tools/editor/plugins/texture_region_editor_plugin.h b/tools/editor/plugins/texture_region_editor_plugin.h
index 951b11e1e6..1e4888b06d 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.h
+++ b/tools/editor/plugins/texture_region_editor_plugin.h
@@ -38,6 +38,7 @@
#include "scene/2d/sprite.h"
#include "scene/gui/patch_9_frame.h"
#include "scene/resources/style_box.h"
+#include "scene/resources/texture.h"
class TextureRegionEditor : public HBoxContainer {
@@ -82,6 +83,7 @@ class TextureRegionEditor : public HBoxContainer {
Patch9Frame *node_patch9;
Sprite *node_sprite;
StyleBoxTexture *obj_styleBox;
+ AtlasTexture *atlas_tex;
int editing_region;
Rect2 rect;
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 7dfcf88e2c..763734f035 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -2812,7 +2812,7 @@ void PropertyEditor::update_tree() {
if (capitalize_paths)
cat = cat.capitalize();
- if (cat.findn(filter)==-1 && name.findn(filter)==-1)
+ if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name))
continue;
}
diff --git a/tools/editor/quick_open.cpp b/tools/editor/quick_open.cpp
index 72059c264f..fc2a2241ab 100644
--- a/tools/editor/quick_open.cpp
+++ b/tools/editor/quick_open.cpp
@@ -126,7 +126,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) {
path+="/";
if (path!="res://") {
path=path.substr(6,path.length());
- if (path.findn(search_box->get_text())!=-1) {
+ if (search_box->get_text().is_subsequence_ofi(path)) {
TreeItem *ti = search_options->create_item(root);
ti->set_text(0,path);
Ref<Texture> icon = get_icon("folder","FileDialog");
@@ -138,7 +138,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) {
String file = efsd->get_file_path(i);
file=file.substr(6,file.length());
- if (ObjectTypeDB::is_type(efsd->get_file_type(i),base_type) && (search_box->get_text()=="" || file.findn(search_box->get_text())!=-1)) {
+ if (ObjectTypeDB::is_type(efsd->get_file_type(i),base_type) && (search_box->get_text().is_subsequence_ofi(file))) {
TreeItem *ti = search_options->create_item(root);
ti->set_text(0,file);
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index 65e731dd4d..2de6fc5cf2 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -428,7 +428,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) {
item->set_as_cursor(0);
}
- bool keep= ( filter==String() || String(p_node->get_name()).to_lower().find(filter.to_lower())!=-1 );
+ bool keep= (filter.is_subsequence_ofi(String(p_node->get_name())));
for (int i=0;i<p_node->get_child_count();i++) {