Added EditorPlugin 'resource_saved' signal

This commit is contained in:
Will Nations 2018-01-12 15:43:29 -06:00
parent 920715b97d
commit 80595ba92b
5 changed files with 16 additions and 0 deletions

View file

@ -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() { void EditorData::clear_editor_states() {
for (int i = 0; i < editor_plugins.size(); i++) { for (int i = 0; i < editor_plugins.size(); i++) {

View file

@ -203,6 +203,7 @@ public:
void save_edited_scene_state(EditorSelection *p_selection, EditorHistory *p_history, const Dictionary &p_custom); 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); Dictionary restore_edited_scene_state(EditorSelection *p_selection, EditorHistory *p_history);
void notify_edited_scene_changed(); void notify_edited_scene_changed();
void notify_resource_saved(const Ref<Resource> &p_resource);
EditorData(); EditorData();
}; };

View file

@ -596,6 +596,7 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St
((Resource *)p_resource.ptr())->set_path(path); ((Resource *)p_resource.ptr())->set_path(path);
emit_signal("resource_saved", p_resource); emit_signal("resource_saved", p_resource);
editor_data.notify_resource_saved(p_resource);
} }
void EditorNode::save_resource(const Ref<Resource> &p_resource) { void EditorNode::save_resource(const Ref<Resource> &p_resource) {

View file

@ -410,6 +410,10 @@ void EditorPlugin::notify_scene_closed(const String &scene_filepath) {
emit_signal("scene_closed", 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) { Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial *p_spatial) {
//?? //??
if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) { if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) {
@ -690,6 +694,7 @@ void EditorPlugin::_bind_methods() {
ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); 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("scene_closed", PropertyInfo(Variant::STRING, "filepath")));
ADD_SIGNAL(MethodInfo("main_screen_changed", PropertyInfo(Variant::STRING, "screen_name"))); 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_TOOLBAR);
BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU); BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU);

View file

@ -163,6 +163,7 @@ public:
void notify_main_screen_changed(const String &screen_name); void notify_main_screen_changed(const String &screen_name);
void notify_scene_changed(const Node *scn_root); void notify_scene_changed(const Node *scn_root);
void notify_scene_closed(const String &scene_filepath); 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 Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event); virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);