summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorMax Hilbrunner <mhilbrunner@users.noreply.github.com>2018-05-07 15:07:32 +0200
committerGitHub <noreply@github.com>2018-05-07 15:07:32 +0200
commitd4cdee5f9e4d39493e3f28ab229935a143a52015 (patch)
tree41302b02f1e3ebc9b5862cee9a797068076c1957 /editor
parent801657f64e4566d8c9bd86f2f2e70f31637b327f (diff)
parent80595ba92b089de6c22ef0ca17b11054a252587c (diff)
Merge pull request #15640 from willnationsdev/resource-saved-signal
Added EditorPlugin 'resource_saved' signal
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_data.cpp8
-rw-r--r--editor/editor_data.h1
-rw-r--r--editor/editor_node.cpp1
-rw-r--r--editor/editor_plugin.cpp5
-rw-r--r--editor/editor_plugin.h1
5 files changed, 16 insertions, 0 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 37a35b6ebf..b584107bcb 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -364,6 +364,14 @@ void EditorData::notify_edited_scene_changed() {
}
}
+void EditorData::notify_resource_saved(const Ref<Resource> &p_resource) {
+
+ for (int i = 0; i < editor_plugins.size(); i++) {
+
+ editor_plugins[i]->notify_resource_saved(p_resource);
+ }
+}
+
void EditorData::clear_editor_states() {
for (int i = 0; i < editor_plugins.size(); i++) {
diff --git a/editor/editor_data.h b/editor/editor_data.h
index 1a498a6150..5a0b58464a 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -204,6 +204,7 @@ public:
void save_edited_scene_state(EditorSelection *p_selection, EditorHistory *p_history, const Dictionary &p_custom);
Dictionary restore_edited_scene_state(EditorSelection *p_selection, EditorHistory *p_history);
void notify_edited_scene_changed();
+ void notify_resource_saved(const Ref<Resource> &p_resource);
EditorData();
};
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d8c85df83d..23c6ee4c3e 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -631,6 +631,7 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St
((Resource *)p_resource.ptr())->set_path(path);
emit_signal("resource_saved", p_resource);
+ editor_data.notify_resource_saved(p_resource);
}
void EditorNode::save_resource(const Ref<Resource> &p_resource) {
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 336eaf719c..2e4e887165 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -473,6 +473,10 @@ void EditorPlugin::notify_scene_closed(const String &scene_filepath) {
emit_signal("scene_closed", scene_filepath);
}
+void EditorPlugin::notify_resource_saved(const Ref<Resource> &p_resource) {
+ emit_signal("resource_saved", p_resource);
+}
+
Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial *p_spatial) {
//??
if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) {
@@ -757,6 +761,7 @@ void EditorPlugin::_bind_methods() {
ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath")));
ADD_SIGNAL(MethodInfo("main_screen_changed", PropertyInfo(Variant::STRING, "screen_name")));
+ ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
BIND_ENUM_CONSTANT(CONTAINER_TOOLBAR);
BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU);
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 05cc6e07e3..ebc4afdfeb 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -167,6 +167,7 @@ public:
void notify_main_screen_changed(const String &screen_name);
void notify_scene_changed(const Node *scn_root);
void notify_scene_closed(const String &scene_filepath);
+ void notify_resource_saved(const Ref<Resource> &p_resource);
virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);