Browse Source

Fixes for drag and drop import

Josh Engebretson 10 years ago
parent
commit
e59d4d00d7
2 changed files with 7 additions and 4 deletions
  1. 4 2
      Source/ToolCore/Assets/Asset.cpp
  2. 3 2
      Source/ToolCore/Assets/AssetDatabase.cpp

+ 4 - 2
Source/ToolCore/Assets/Asset.cpp

@@ -190,7 +190,8 @@ bool Asset::SetPath(const String& path)
     path_ = path;
     path_ = path;
 
 
     // create importer based on path
     // create importer based on path
-    CreateImporter();
+    if (!CreateImporter())
+        return false;
 
 
     String assetFilename = GetDotAssetFilename();
     String assetFilename = GetDotAssetFilename();
 
 
@@ -201,6 +202,7 @@ bool Asset::SetPath(const String& path)
     }
     }
     else
     else
     {
     {
+        dirty_ = true;
         guid_ = db->GenerateAssetGUID();
         guid_ = db->GenerateAssetGUID();
         timestamp_ = fs->GetLastModifiedTime(path);
         timestamp_ = fs->GetLastModifiedTime(path);
 
 
@@ -209,7 +211,7 @@ bool Asset::SetPath(const String& path)
 
 
     // TODO: handle failed
     // TODO: handle failed
 
 
-
+    return true;
 
 
 }
 }
 
 

+ 3 - 2
Source/ToolCore/Assets/AssetDatabase.cpp

@@ -215,8 +215,9 @@ void AssetDatabase::Scan()
         {
         {
             // new asset
             // new asset
             SharedPtr<Asset> asset(new Asset(context_));
             SharedPtr<Asset> asset(new Asset(context_));
-            asset->SetPath(path);
-            AddAsset(asset);
+
+            if (asset->SetPath(path))
+                AddAsset(asset);
         }
         }
         else
         else
         {
         {