summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_node.cpp5
-rw-r--r--tools/editor/editor_resource_preview.cpp4
-rw-r--r--tools/editor/editor_resource_preview.h2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp77
-rw-r--r--tools/editor/plugins/script_editor_plugin.h4
-rw-r--r--tools/editor/project_manager.cpp4
-rw-r--r--tools/editor/property_editor.cpp4
7 files changed, 90 insertions, 10 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index ae632ab381..56d745dee6 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -3133,6 +3133,11 @@ void EditorNode::_remove_edited_scene() {
new_index=1;
}
+
+
+ if (editor_data.get_scene_path(old_index)!=String()) {
+ ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index));
+ }
_scene_tab_changed(new_index);
editor_data.remove_scene(old_index);
editor_data.get_undo_redo().clear_history();
diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp
index 1a0e996110..6e38d6460b 100644
--- a/tools/editor/editor_resource_preview.cpp
+++ b/tools/editor/editor_resource_preview.cpp
@@ -336,7 +336,7 @@ void EditorResourcePreview::_bind_methods() {
ADD_SIGNAL(MethodInfo("preview_invalidated",PropertyInfo(Variant::STRING,"path")));
}
-bool EditorResourcePreview::check_for_invalidation(const String& p_path) {
+void EditorResourcePreview::check_for_invalidation(const String& p_path) {
preview_mutex->lock();
@@ -356,7 +356,7 @@ bool EditorResourcePreview::check_for_invalidation(const String& p_path) {
call_deferred("emit_signal","preview_invalidated",p_path);
}
- return call_invalidated;
+
}
diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h
index fed8f129ed..51a00965eb 100644
--- a/tools/editor/editor_resource_preview.h
+++ b/tools/editor/editor_resource_preview.h
@@ -121,7 +121,7 @@ public:
void queue_edited_resource_preview(const Ref<Resource>& p_path, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata);
void add_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator);
- bool check_for_invalidation(const String& p_path);
+ void check_for_invalidation(const String& p_path);
EditorResourcePreview();
~EditorResourcePreview();
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index ee83b6b032..aa0f52d574 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -43,6 +43,28 @@
/*** SCRIPT EDITOR ****/
+static bool _can_open_in_editor(Script* p_script) {
+
+ String path = p_script->get_path();
+
+ if (path.find("::")!=-1) {
+ //refuse handling this if it can't be edited
+
+ bool valid=false;
+ for(int i=0;i<EditorNode::get_singleton()->get_editor_data().get_edited_scene_count();i++) {
+ if (path.begins_with(EditorNode::get_singleton()->get_editor_data().get_scene_path(i))) {
+ valid=true;
+ break;
+ }
+ }
+
+ return valid;
+ }
+
+ return true;
+}
+
+
class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache {
@@ -747,9 +769,9 @@ void ScriptEditor::_go_to_tab(int p_idx) {
_update_script_colors();
}
-void ScriptEditor::_close_current_tab() {
+void ScriptEditor::_close_tab(int p_idx) {
- int selected = tab_container->get_current_tab();
+ int selected = p_idx;
if (selected<0 || selected>=tab_container->get_child_count())
return;
@@ -795,6 +817,11 @@ void ScriptEditor::_close_current_tab() {
_update_script_names();
EditorNode::get_singleton()->save_layout();
+}
+
+void ScriptEditor::_close_current_tab() {
+
+ _close_tab(tab_container->get_current_tab());
}
@@ -1681,6 +1708,33 @@ void ScriptEditor::_notification(int p_what) {
}
+
+void ScriptEditor::close_builtin_scripts_from_scene(const String& p_scene) {
+
+
+
+ for(int i=0;i<tab_container->get_child_count();i++) {
+
+ ScriptTextEditor *ste = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
+
+ if (ste) {
+
+ Ref<Script> script = ste->get_edited_script();
+ if (!script.is_valid())
+ continue;
+
+ if (script->get_path().find("::")!=-1 && script->get_path().begins_with(p_scene)) { //is an internal script and belongs to scene being closed
+ _close_tab(i);
+ i--;
+
+ }
+ }
+
+ }
+
+
+}
+
void ScriptEditor::edited_scene_changed() {
_update_modified_scripts_for_external_editor();
@@ -2059,11 +2113,18 @@ void ScriptEditor::_update_script_names() {
}
+
+
void ScriptEditor::edit(const Ref<Script>& p_script) {
if (p_script.is_null())
return;
+ // refuse to open built-in if scene is not loaded
+
+
+
+
// see if already has it
bool open_dominant = EditorSettings::get_singleton()->get("text_editor/open_dominant_script_on_scene_change");
@@ -2527,7 +2588,7 @@ void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) {
if (bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor")))
return;
- if (open_dominant && p_script.is_valid()) {
+ if (open_dominant && p_script.is_valid() && _can_open_in_editor(p_script.ptr())) {
edit(p_script);
}
}
@@ -2915,6 +2976,16 @@ void ScriptEditorPlugin::edit(Object *p_object) {
bool ScriptEditorPlugin::handles(Object *p_object) const {
+ if (p_object->cast_to<Script>()) {
+
+ bool valid = _can_open_in_editor(p_object->cast_to<Script>());
+
+ if (!valid) { //user tried to open it by clicking
+ EditorNode::get_singleton()->show_warning(TTR("Built-in scripts can only be edited when the scene they belong to is loaded"));
+ }
+ return valid;
+ }
+
return p_object->is_type("Script");
}
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 85412087b4..2e6e2c035c 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -234,6 +234,8 @@ class ScriptEditor : public VBoxContainer {
bool _test_script_times_on_disk(Ref<Script> p_for_script=Ref<Script>());
+ void _close_tab(int p_idx);
+
void _close_current_tab();
bool grab_focus_block;
@@ -331,6 +333,8 @@ public:
virtual void edited_scene_changed();
+ void close_builtin_scripts_from_scene(const String& p_scene);
+
ScriptEditorDebugger *get_debugger() { return debugger; }
void set_live_auto_reload_running_scripts(bool p_enabled);
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index 860af4888b..497ff43a4d 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -46,7 +46,7 @@
#include "io/resource_saver.h"
#include "editor_themes.h"
-
+#include "editor_initialize_ssl.h"
#include "editor_scale.h"
class NewProjectDialog : public ConfirmationDialog {
@@ -1103,6 +1103,8 @@ void ProjectListFilter::_bind_methods() {
ProjectListFilter::ProjectListFilter() {
+ editor_initialize_certificates(); //for asset sharing
+
_current_filter = FILTER_NAME;
filter_option = memnew(OptionButton);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index e0dc76e733..4b3f245e44 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -2981,10 +2981,8 @@ void PropertyEditor::update_tree() {
else
item->set_cell_mode( 1, TreeItem::CELL_MODE_RANGE_EXPRESSION );
- if (p.hint==PROPERTY_HINT_SPRITE_FRAME) {
- item->set_range_config(1,0,99999,1);
- } else if (p.hint==PROPERTY_HINT_RANGE || p.hint==PROPERTY_HINT_EXP_RANGE) {
+ if (p.hint==PROPERTY_HINT_SPRITE_FRAME || p.hint==PROPERTY_HINT_RANGE || p.hint==PROPERTY_HINT_EXP_RANGE) {
int c = p.hint_string.get_slice_count(",");
float min=0,max=100,step=1;