Browse Source

Fix problems reloading MeshLibrary

kobewi 2 years ago
parent
commit
0a4d0506d1
2 changed files with 4 additions and 0 deletions
  1. 3 0
      editor/editor_node.cpp
  2. 1 0
      editor/plugins/mesh_library_editor_plugin.cpp

+ 3 - 0
editor/editor_node.cpp

@@ -2027,6 +2027,9 @@ void EditorNode::_dialog_action(String p_file) {
 			if (err) {
 			if (err) {
 				show_accept(TTR("Error saving MeshLibrary!"), TTR("OK"));
 				show_accept(TTR("Error saving MeshLibrary!"), TTR("OK"));
 				return;
 				return;
+			} else if (ResourceCache::has(p_file)) {
+				// Make sure MeshLibrary is updated in the editor.
+				ResourceLoader::load(p_file)->reload_from_file();
 			}
 			}
 
 
 		} break;
 		} break;

+ 1 - 0
editor/plugins/mesh_library_editor_plugin.cpp

@@ -301,6 +301,7 @@ void MeshLibraryEditorPlugin::edit(Object *p_node) {
 		mesh_library_editor->edit(Object::cast_to<MeshLibrary>(p_node));
 		mesh_library_editor->edit(Object::cast_to<MeshLibrary>(p_node));
 		mesh_library_editor->show();
 		mesh_library_editor->show();
 	} else {
 	} else {
+		mesh_library_editor->edit(Ref<MeshLibrary>());
 		mesh_library_editor->hide();
 		mesh_library_editor->hide();
 	}
 	}
 }
 }