diff options
Diffstat (limited to 'tools/editor')
26 files changed, 315 insertions, 108 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 e2b8f2884f..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 { @@ -294,47 +295,33 @@ void ConnectDialog::_bind_methods() { ConnectDialog::ConnectDialog() { - int margin = get_constant("margin","Dialogs"); - int button_margin = get_constant("button_margin","Dialogs"); + VBoxContainer *vbc = memnew( VBoxContainer ); + add_child(vbc); + set_child_rect(vbc); + HBoxContainer *main_hb = memnew( HBoxContainer ); + vbc->add_child(main_hb); + main_hb->set_v_size_flags(SIZE_EXPAND_FILL); - Label * label = memnew( Label ); - label->set_pos( Point2( 8,11) ); - label->set_text(TTR("Connect To Node:")); - - - add_child(label); - label = memnew( Label ); - label->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); - label->set_pos( Point2( 0.5,11) ); - label->set_text(TTR("Binds (Extra Params):")); - add_child(label); + VBoxContainer *vbc_left = memnew( VBoxContainer ); + main_hb->add_child(vbc_left); + vbc_left->set_h_size_flags(SIZE_EXPAND_FILL); tree = memnew(SceneTreeEditor(false)); - tree->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); - tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - tree->set_begin( Point2( 15,32) ); - tree->set_end( Point2( 0.5,127 ) ); + vbc_left->add_margin_child(TTR("Conect To Node:"),tree,true); - add_child(tree); - bind_editor = memnew( PropertyEditor ); - bind_editor->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - bind_editor->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); - bind_editor->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - bind_editor->set_begin( Point2( 0.51,42) ); - bind_editor->set_end( Point2( 15,127 ) ); - bind_editor->get_top_label()->hide(); - add_child(bind_editor); + VBoxContainer *vbc_right = memnew( VBoxContainer ); + main_hb->add_child(vbc_right); + vbc_right->set_h_size_flags(SIZE_EXPAND_FILL); + + HBoxContainer *add_bind_hb = memnew( HBoxContainer ); type_list = memnew( OptionButton ); - type_list->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); - type_list->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); - type_list->set_begin( Point2( 0.51,32) ); - type_list->set_end( Point2( 0.75,33 ) ); - add_child(type_list); + type_list->set_h_size_flags(SIZE_EXPAND_FILL); + add_bind_hb->add_child(type_list); type_list->add_item("bool",Variant::BOOL); @@ -356,65 +343,36 @@ ConnectDialog::ConnectDialog() { type_list->select(0); Button *add_bind = memnew( Button ); - add_bind->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); - add_bind->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); - add_bind->set_begin( Point2( 0.76,32) ); - add_bind->set_end( Point2( 0.84,33 ) ); + add_bind->set_text(TTR("Add")); - add_child(add_bind); + add_bind_hb->add_child(add_bind); add_bind->connect("pressed",this,"_add_bind"); Button *del_bind = memnew( Button ); - del_bind->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - del_bind->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); - del_bind->set_begin( Point2( 0.85,32) ); - del_bind->set_end( Point2( 15,33 ) ); del_bind->set_text(TTR("Remove")); - add_child(del_bind); + add_bind_hb->add_child(del_bind); del_bind->connect("pressed",this,"_remove_bind"); + vbc_right->add_margin_child(TTR("Add Extra Call Argument:"),add_bind_hb); - label = memnew( Label ); - label->set_anchor( MARGIN_TOP, ANCHOR_END ); - label->set_begin( Point2( 8,124) ); - label->set_end( Point2( 15,99) ); - label->set_text(TTR("Path To Node:")); + bind_editor = memnew( PropertyEditor ); + bind_editor->hide_top_label(); - add_child(label); + vbc_right->add_margin_child(TTR("Extra Call Arguments:"),bind_editor,true); - dst_path = memnew(LineEdit); - dst_path->set_anchor( MARGIN_TOP, ANCHOR_END ); - dst_path->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - dst_path->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - dst_path->set_begin( Point2( 15,105) ); - dst_path->set_end( Point2( 15,80 ) ); - add_child(dst_path); - label = memnew( Label ); - label->set_anchor( MARGIN_TOP, ANCHOR_END ); - label->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - label->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - label->set_begin( Point2( 8,78 ) ); - label->set_end( Point2( 15,52 ) ); - label->set_text(TTR("Method In Node:")); - add_child(label); + dst_path = memnew(LineEdit); + vbc->add_margin_child(TTR("Path to Node:"),dst_path); HBoxContainer *dstm_hb = memnew( HBoxContainer ); - dstm_hb->set_anchor( MARGIN_TOP, ANCHOR_END ); - dstm_hb->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - dstm_hb->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - dstm_hb->set_begin( Point2( 15,59) ); - dstm_hb->set_end( Point2( 15,39 ) ); - add_child(dstm_hb); + vbc->add_margin_child("Method In Node:",dstm_hb); dst_method = memnew(LineEdit); dst_method->set_h_size_flags(SIZE_EXPAND_FILL); dstm_hb->add_child(dst_method); - - /*dst_method_list = memnew( MenuButton ); dst_method_list->set_text("List.."); dst_method_list->set_anchor( MARGIN_RIGHT, ANCHOR_END ); @@ -567,6 +525,7 @@ void ConnectionsDock::_connect_pressed() { connect_dialog->edit(node); connect_dialog->popup_centered_ratio(); + connect_dialog->set_title(TTR("Connecting Signal:")+" "+signalname); connect_dialog->set_dst_method("_on_"+midname+"_"+signal); connect_dialog->set_dst_node(node->get_owner()?node->get_owner():node); @@ -808,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); @@ -865,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_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 185ec17459..e631aad7f6 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -443,7 +443,7 @@ void EditorFileDialog::update_file_list() { item_list->set_icon_mode(ItemList::ICON_MODE_TOP); item_list->set_fixed_column_width(thumbnail_size*3/2); item_list->set_max_text_lines(2); - item_list->set_min_icon_size(Size2(thumbnail_size,thumbnail_size)); + item_list->set_fixed_icon_size(Size2(thumbnail_size,thumbnail_size)); if (!has_icon("ResizedFolder","EditorIcons")) { Ref<ImageTexture> folder = get_icon("FolderBig","EditorIcons"); @@ -475,7 +475,7 @@ void EditorFileDialog::update_file_list() { item_list->set_max_columns(1); item_list->set_max_text_lines(1); item_list->set_fixed_column_width(0); - item_list->set_min_icon_size(Size2()); + item_list->set_fixed_icon_size(Size2()); if (preview->get_texture().is_valid()) preview_vb->show(); 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/editor_node.cpp b/tools/editor/editor_node.cpp index 26e40cf816..2e8bf0f311 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -217,7 +217,7 @@ void EditorNode::_notification(int p_what) { if (p_what==NOTIFICATION_EXIT_TREE) { editor_data.save_editor_external_data(); - + FileAccess::set_file_close_fail_notify_callback(NULL); log->deinit(); // do not get messages anymore } if (p_what==NOTIFICATION_PROCESS) { @@ -3089,6 +3089,7 @@ void EditorNode::set_addon_plugin_enabled(const String& p_addon,bool p_enabled) if (!p_enabled) { EditorPlugin *addon = plugin_addons[p_addon]; + editor_data.remove_editor_plugin( addon ); memdelete(addon); //bye plugin_addons.erase(p_addon); _update_addon_config(); @@ -5137,6 +5138,10 @@ void EditorNode::_dropped_files(const Vector<String>& p_files,int p_screen) { EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path); } } +void EditorNode::_file_access_close_error_notify(const String& p_str) { + + add_io_error("Unable to write to file '"+p_str+"', file in use, locked or lacking permissions."); +} void EditorNode::_bind_methods() { @@ -5232,7 +5237,6 @@ EditorNode::EditorNode() { SceneState::set_disable_placeholders(true); editor_initialize_certificates(); //for asset sharing - InputDefault *id = Input::get_singleton()->cast_to<InputDefault>(); if (id) { @@ -6274,7 +6278,7 @@ EditorNode::EditorNode() { logo->set_texture(gui_base->get_icon("Logo","EditorIcons") ); warning = memnew( AcceptDialog ); - add_child(warning); + gui_base->add_child(warning); @@ -6574,6 +6578,7 @@ EditorNode::EditorNode() { _load_docks(); + FileAccess::set_file_close_fail_notify_callback(_file_access_close_error_notify); } @@ -6581,6 +6586,7 @@ EditorNode::EditorNode() { EditorNode::~EditorNode() { + memdelete( EditorHelp::get_doc_data() ); memdelete(editor_selection); memdelete(editor_plugins_over); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 65a5687dce..7023c6c174 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -574,6 +574,7 @@ private: void _update_addon_config(); + static void _file_access_close_error_notify(const String& p_str); protected: void _notification(int p_what); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index bf01e02330..0d0008fcb8 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -86,6 +86,10 @@ bool EditorSettings::_set(const StringName& p_name, const Variant& p_value) { props[p_name].variant=p_value; else props[p_name]=VariantContainer(p_value,last_order++); + + if (save_changed_setting) { + props[p_name].save=true; + } } emit_signal("settings_changed"); @@ -126,6 +130,7 @@ struct _EVCSort { String name; Variant::Type type; int order; + bool save; bool operator<(const _EVCSort& p_vcs) const{ return order< p_vcs.order; } }; @@ -148,15 +153,24 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const { vc.name=*k; vc.order=v->order; vc.type=v->variant.get_type(); + vc.save=v->save; + vclist.insert(vc); } for(Set<_EVCSort>::Element *E=vclist.front();E;E=E->next()) { - int pinfo = PROPERTY_USAGE_STORAGE; - if (!E->get().name.begins_with("_")) + int pinfo = 0; + if (E->get().save) { + pinfo|=PROPERTY_USAGE_STORAGE; + } + + if (!E->get().name.begins_with("_") && !E->get().name.begins_with("projects/")) { pinfo|=PROPERTY_USAGE_EDITOR; + } else { + pinfo|=PROPERTY_USAGE_STORAGE; //hiddens must always be saved + } PropertyInfo pi(E->get().type, E->get().name); pi.usage=pinfo; @@ -330,6 +344,7 @@ void EditorSettings::create() { goto fail; } + singleton->save_changed_setting=true; singleton->config_file_path=config_file_path; singleton->project_config_path=pcp; singleton->settings_path=config_path+"/"+config_dir; @@ -363,6 +378,7 @@ void EditorSettings::create() { }; singleton = Ref<EditorSettings>( memnew( EditorSettings ) ); + singleton->save_changed_setting=true; singleton->config_file_path=config_file_path; singleton->settings_path=config_path+"/"+config_dir; singleton->_load_defaults(extra_config); @@ -975,6 +991,7 @@ EditorSettings::EditorSettings() { //singleton=this; last_order=0; + save_changed_setting=true; EditorTranslationList *etl=_editor_translations; @@ -999,6 +1016,7 @@ EditorSettings::EditorSettings() { } _load_defaults(); + save_changed_setting=false; } diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index 60333b5811..d975a7ef86 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -64,7 +64,8 @@ private: int order; Variant variant; bool hide_from_editor; - VariantContainer(){ order=0; hide_from_editor=false; } + bool save; + VariantContainer(){ order=0; hide_from_editor=false; save=false;} VariantContainer(const Variant& p_variant, int p_order) { variant=p_variant; order=p_order; hide_from_editor=false; } }; @@ -85,6 +86,9 @@ private: Ref<Resource> clipboard; + bool save_changed_setting; + + void _load_defaults(Ref<ConfigFile> p_extra_config = NULL); void _load_default_text_editor_theme(); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 8d00f2cd8a..4ab5dddef6 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -2147,12 +2147,17 @@ void ScriptEditor::save_all_scripts() { continue; Ref<Script> script = ste->get_edited_script(); + if (script.is_valid()) + ste->apply_code(); + if (script->get_path()!="" && script->get_path().find("local://")==-1 &&script->get_path().find("::")==-1) { //external script, save it - ste->apply_code(); + editor->save_resource(script); //ResourceSaver::save(script->get_path(),script); + } + } } @@ -2273,6 +2278,8 @@ void ScriptEditor::_editor_settings_changed() { ste->get_text_edit()->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter")); } + ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/auto_reload_and_parse_scripts_on_save",true)); + } void ScriptEditor::_autosave_scripts() { @@ -2496,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; @@ -2614,8 +2666,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { edit_menu->get_popup()->add_item(TTR("Auto Indent"),EDIT_AUTO_INDENT,KEY_MASK_CMD|KEY_I); edit_menu->get_popup()->connect("item_pressed", this,"_menu_option"); edit_menu->get_popup()->add_separator(); - edit_menu->get_popup()->add_item(TTR("Reload Tool Script"),FILE_TOOL_RELOAD,KEY_MASK_CMD|KEY_R); - edit_menu->get_popup()->add_item(TTR("Reload Tool Script (Soft)"),FILE_TOOL_RELOAD_SOFT,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_R); + edit_menu->get_popup()->add_item(TTR("Soft Reload Script"),FILE_TOOL_RELOAD_SOFT,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_R); search_menu = memnew( MenuButton ); @@ -2919,6 +2970,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { script_editor->hide(); EDITOR_DEF("text_editor/auto_reload_scripts_on_external_change",true); + ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/auto_reload_and_parse_scripts_on_save",true)); EDITOR_DEF("text_editor/open_dominant_script_on_scene_change",true); EDITOR_DEF("external_editor/use_external_editor",false); EDITOR_DEF("external_editor/exec_path",""); @@ -2930,6 +2982,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE)); EDITOR_DEF("external_editor/exec_flags",""); + } 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/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 4532e91e1f..4f59287994 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -825,7 +825,7 @@ SpriteFramesEditor::SpriteFramesEditor() { tree->set_icon_mode(ItemList::ICON_MODE_TOP); tree->set_fixed_column_width(thumbnail_size*3/2); tree->set_max_text_lines(2); - tree->set_max_icon_size(Size2(thumbnail_size,thumbnail_size)); + tree->set_fixed_icon_size(Size2(thumbnail_size,thumbnail_size)); //tree->set_min_icon_size(Size2(thumbnail_size,thumbnail_size)); tree->set_drag_forwarding(this); 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/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index 37cb0398e7..2673948365 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -583,6 +583,7 @@ ThemeEditor::ThemeEditor() { add_child(panel); panel->set_area_as_parent_rect(0); panel->set_margin(MARGIN_TOP,25); + panel->set_theme(Theme::get_default()); main_vb= memnew( VBoxContainer ); panel->add_child(main_vb); diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 6d5f2a519c..5a40777665 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -208,9 +208,14 @@ void TileMapEditor::_update_palette() { palette->set_max_columns(0); palette->add_constant_override("hseparation", 6); + + float min_size = EDITOR_DEF("tile_map/preview_size",64); + palette->set_fixed_icon_size(Size2(min_size, min_size)); + palette->set_fixed_column_width(min_size*3/2); palette->set_icon_mode(ItemList::ICON_MODE_TOP); palette->set_max_text_lines(2); + String filter = search_box->get_text().strip_edges(); for (List<int>::Element *E=tiles.front();E;E=E->next()) { @@ -1434,6 +1439,7 @@ void TileMapEditorPlugin::make_visible(bool p_visible) { TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) { + EDITOR_DEF("tile_map/preview_size",64); tile_map_editor = memnew( TileMapEditor(p_node) ); add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor); tile_map_editor->hide(); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 2f0ba2da99..763734f035 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -1963,6 +1963,13 @@ bool PropertyEditor::_is_property_different(const Variant& p_current, const Vari return false; } + if (p_current.get_type()==Variant::REAL && p_orig.get_type()==Variant::REAL) { + float a = p_current; + float b = p_orig; + + return Math::abs(a-b)>CMP_EPSILON; //this must be done because, as some scenes save as text, there might be a tiny difference in floats due to numerical error + } + return bool(Variant::evaluate(Variant::OP_NOT_EQUAL,p_current,p_orig)); } @@ -2232,6 +2239,7 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) { if (_get_instanced_node_original_property(p_name,vorig) || usage) { Variant v = obj->get(p_name); + bool changed = _is_property_different(v,vorig,usage); //if ((found!=-1 && !is_disabled)!=changed) { @@ -2804,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_dock.cpp b/tools/editor/scene_tree_dock.cpp index 9612305a0f..5124505b90 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -201,6 +201,7 @@ static String _get_name_num_separator() { return " "; } + void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { current_option=p_tool; @@ -519,6 +520,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { EditorNode::get_singleton()->push_item(mne.ptr()); } break; + case TOOL_ERASE: { List<Node*> remove_list = editor_selection->get_selected_node_list(); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index f8ce121690..2de6fc5cf2 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -94,6 +94,29 @@ void SceneTreeEditor::_subscene_option(int p_idx) { case SCENE_MENU_CLEAR_INHERITANCE: { clear_inherit_confirm->popup_centered_minsize(); } break; + case SCENE_MENU_CLEAR_INSTANCING: { + + Node*root=EditorNode::get_singleton()->get_edited_scene(); + if (!root) + break; + + + ERR_FAIL_COND(node->get_filename()==String()); + + undo_redo->create_action("Discard Instancing"); + + undo_redo->add_do_method(node,"set_filename",""); + undo_redo->add_undo_method(node,"set_filename",node->get_filename()); + + _node_replace_owner(node,node,root); + + undo_redo->add_do_method(this,"update_tree"); + undo_redo->add_undo_method(this,"update_tree"); + + undo_redo->commit_action(); + + + } break; case SCENE_MENU_OPEN_INHERITED: { if (node && node->get_scene_inherited_state().is_valid()) { emit_signal("open",node->get_scene_inherited_state()->get_path()); @@ -108,11 +131,30 @@ void SceneTreeEditor::_subscene_option(int p_idx) { } break; + } } +void SceneTreeEditor::_node_replace_owner(Node* p_base,Node* p_node,Node* p_root) { + + if (p_base!=p_node) { + + if (p_node->get_owner()==p_base) { + + undo_redo->add_do_method(p_node,"set_owner",p_root); + undo_redo->add_undo_method(p_node,"set_owner",p_base); + } + } + + for(int i=0;i<p_node->get_child_count();i++) { + + _node_replace_owner(p_base,p_node->get_child(i),p_root); + } +} + + void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) { TreeItem *item=p_item->cast_to<TreeItem>(); @@ -386,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++) { @@ -606,7 +648,7 @@ void SceneTreeEditor::_notification(int p_what) { get_tree()->connect("node_removed",this,"_node_removed"); get_tree()->connect("node_configuration_warning_changed",this,"_warning_changed"); - instance_menu->set_item_icon(3,get_icon("Load","EditorIcons")); + instance_menu->set_item_icon(5,get_icon("Load","EditorIcons")); tree->connect("item_collapsed",this,"_cell_collapsed"); inheritance_menu->set_item_icon(2,get_icon("Load","EditorIcons")); clear_inherit_confirm->connect("confirmed",this,"_subscene_option",varray(SCENE_MENU_CLEAR_INHERITANCE_CONFIRM)); @@ -1109,6 +1151,8 @@ SceneTreeEditor::SceneTreeEditor(bool p_label,bool p_can_rename, bool p_can_open instance_menu->add_check_item(TTR("Editable Children"),SCENE_MENU_EDITABLE_CHILDREN); instance_menu->add_check_item(TTR("Load As Placeholder"),SCENE_MENU_USE_PLACEHOLDER); instance_menu->add_separator(); + instance_menu->add_item(TTR("Discard Instancing"),SCENE_MENU_CLEAR_INSTANCING); + instance_menu->add_separator(); instance_menu->add_item(TTR("Open in Editor"),SCENE_MENU_OPEN); instance_menu->connect("item_pressed",this,"_subscene_option"); add_child(instance_menu); diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h index ae0afa32ec..e184891200 100644 --- a/tools/editor/scene_tree_editor.h +++ b/tools/editor/scene_tree_editor.h @@ -61,6 +61,7 @@ class SceneTreeEditor : public Control { SCENE_MENU_CLEAR_INHERITANCE, SCENE_MENU_OPEN_INHERITED, SCENE_MENU_CLEAR_INHERITANCE_CONFIRM, + SCENE_MENU_CLEAR_INSTANCING, }; Tree *tree; @@ -117,6 +118,7 @@ class SceneTreeEditor : public Control { void _node_visibility_changed(Node *p_node); void _subscene_option(int p_idx); + void _node_replace_owner(Node* p_base,Node* p_node,Node* p_root); void _selection_changed(); diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp index 7953cf2739..44832c84eb 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/scenes_dock.cpp @@ -454,8 +454,7 @@ void ScenesDock::_update_files(bool p_keep_selection) { files->set_icon_mode(ItemList::ICON_MODE_TOP); files->set_fixed_column_width(thumbnail_size*3/2); files->set_max_text_lines(2); - files->set_min_icon_size(Size2(thumbnail_size,thumbnail_size)); - files->set_max_icon_size(Size2(thumbnail_size,thumbnail_size)); + files->set_fixed_icon_size(Size2(thumbnail_size,thumbnail_size)); if (!has_icon("ResizedFolder","EditorIcons")) { Ref<ImageTexture> folder = get_icon("FolderBig","EditorIcons"); @@ -485,7 +484,7 @@ void ScenesDock::_update_files(bool p_keep_selection) { files->set_max_columns(1); files->set_max_text_lines(1); files->set_fixed_column_width(0); - files->set_min_icon_size(Size2()); + files->set_fixed_icon_size(Size2()); } diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 37a90ba7be..6d8f54d88f 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -1731,15 +1731,17 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){ docontinue->set_tooltip(TTR("Continue")); docontinue->connect("pressed",this,"debug_continue"); - hbc->add_child( memnew( VSeparator) ); + //hbc->add_child( memnew( VSeparator) ); back = memnew( Button ); hbc->add_child(back); back->set_tooltip(TTR("Inspect Previous Instance")); + back->hide(); forward = memnew( Button ); hbc->add_child(forward); forward->set_tooltip(TTR("Inspect Next Instance")); + forward->hide(); HSplitContainer *sc = memnew( HSplitContainer ); |