Browse Source

Fix issue with renaming scene files. also removed defunct ProjectUnloaded event.

Shaddock Heath 9 years ago
parent
commit
1364448c2c

+ 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_FILECHANGED, HANDLER(ResourceEditor, HandleFileChanged));
     SubscribeToEvent(E_RENAMERESOURCENOTIFICATION, HANDLER(ResourceEditor, HandleRenameResourceNotification));
     SubscribeToEvent(E_RENAMERESOURCENOTIFICATION, HANDLER(ResourceEditor, HandleRenameResourceNotification));
-    
+
 }
 }
 
 
 ResourceEditor::~ResourceEditor()
 ResourceEditor::~ResourceEditor()
@@ -184,10 +184,14 @@ void ResourceEditor::HandleRenameResourceNotification(StringHash eventType, Vari
 {
 {
     using namespace RenameResourceNotification;
     using namespace RenameResourceNotification;
     const String& newPath = eventData[P_NEWRESOURCEPATH].GetString();
     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()
 void ResourceEditor::RequestClose()
 {
 {
     editorTabLayout_->RequestClose();
     editorTabLayout_->RequestClose();
@@ -228,11 +232,9 @@ void ResourceEditor::SetModified(bool modified)
         button_->SetText(filename.CString());
         button_->SetText(filename.CString());
     }
     }
 }
 }
-    
-    
-void ResourceEditor::ProjectUnloaded() {}
+
     
     
 void ResourceEditor::Delete() {}
 void ResourceEditor::Delete() {}
-    
-    
+
+
 }
 }

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

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