Browse Source

Merge pull request #794 from shaddockh/ATOMIC-TSH-792

Fix issue with scene files getting renamed when another file is renamed.
JoshEngebretson 9 years ago
parent
commit
72249873d5

+ 11 - 9
Source/AtomicEditor/Editors/ResourceEditor.cpp

@@ -156,7 +156,7 @@ ResourceEditor::ResourceEditor(Context* context, const String& fullpath, UITabCo
 
     SubscribeToEvent(E_FILECHANGED, HANDLER(ResourceEditor, HandleFileChanged));
     SubscribeToEvent(E_RENAMERESOURCENOTIFICATION, HANDLER(ResourceEditor, HandleRenameResourceNotification));
-    
+
 }
 
 ResourceEditor::~ResourceEditor()
@@ -184,10 +184,14 @@ void ResourceEditor::HandleRenameResourceNotification(StringHash eventType, Vari
 {
     using namespace RenameResourceNotification;
     const String& newPath = eventData[P_NEWRESOURCEPATH].GetString();
-    fullpath_ = newPath;
-    SetModified(modified_);
+    const String& path = eventData[P_RESOURCEPATH].GetString();
+
+    if (fullpath_.Compare(path) == 0) {
+        fullpath_ = newPath;
+        SetModified(modified_);
+    }
 }
-    
+
 void ResourceEditor::RequestClose()
 {
     editorTabLayout_->RequestClose();
@@ -228,11 +232,9 @@ void ResourceEditor::SetModified(bool modified)
         button_->SetText(filename.CString());
     }
 }
-    
-    
-void ResourceEditor::ProjectUnloaded() {}
+
     
 void ResourceEditor::Delete() {}
-    
-    
+
+
 }

+ 1 - 2
Source/AtomicEditor/Editors/ResourceEditor.h

@@ -65,8 +65,7 @@ public:
     virtual void Redo() {}
 
     virtual bool Save() { return true; }
-    
-    virtual void ProjectUnloaded();
+
     virtual void Delete();
 
     UIWidget* GetRootContentWidget() { return rootContentWidget_; }