Give Data directory priority over CoreData. Give autoload paths priority over the default directories/packages. Fix the resource path/package add priority (index) having no effect, which would result in the editor not giving highest priority to the user's resource data directory. Closes #499.

This commit is contained in:
Lasse Öörni 2014-10-23 11:20:35 +03:00
Родитель 59a38bbdb6
Коммит 3f51cee989
3 изменённых файлов: 7 добавлений и 9 удалений

Просмотреть файл

@ -129,7 +129,7 @@ The full list of supported parameters, their datatypes and default values:
- LogName (string) %Log filename. Default "Urho3D.log".
- FrameLimiter (bool) Whether to cap maximum framerate to 200 (desktop) or 60 (Android/iOS.) Default true.
- WorkerThreads (bool) Whether to create worker threads for the %WorkQueue subsystem according to available CPU cores. Default true.
- ResourcePaths (string) A semicolon-separated list of resource paths to use. If corresponding packages (ie. Data.pak for Data directory) exist they will be used instead. Default "CoreData;Data".
- ResourcePaths (string) A semicolon-separated list of resource paths to use. If corresponding packages (ie. Data.pak for Data directory) exist they will be used instead. Default "Data;CoreData".
- ResourcePackages (string) A semicolon-separated list of resource packages to use. Default empty.
- AutoloadPaths (string) A semicolon-separated list of autoload paths to use. Any resource packages and subdirectories inside an autoload path will be added to the resource system. Default "Extra".
- ForceSM2 (bool) Whether to force %Shader %Model 2, effective in Direct3D9 mode only. Default false.

Просмотреть файл

@ -196,7 +196,7 @@ bool Engine::Initialize(const VariantMap& parameters)
FileSystem* fileSystem = GetSubsystem<FileSystem>();
String exePath = fileSystem->GetProgramDir();
Vector<String> resourcePaths = GetParameter(parameters, "ResourcePaths", "CoreData;Data").GetString().Split(';');
Vector<String> resourcePaths = GetParameter(parameters, "ResourcePaths", "Data;CoreData").GetString().Split(';');
Vector<String> resourcePackages = GetParameter(parameters, "ResourcePackages").GetString().Split(';');
Vector<String> autoloadFolders = GetParameter(parameters, "AutoloadPaths", "Extra").GetString().Split(';');
@ -262,7 +262,7 @@ bool Engine::Initialize(const VariantMap& parameters)
}
}
// Add auto load folders
// Add auto load folders. Prioritize these (if exist) before the default folders
for (unsigned i = 0; i < autoloadFolders.Size(); ++i)
{
bool success = true;
@ -279,7 +279,7 @@ bool Engine::Initialize(const VariantMap& parameters)
continue;
String autoResourceDir = exePath + autoloadFolder + "/" + folder;
success = cache->AddResourceDir(autoResourceDir);
success = cache->AddResourceDir(autoResourceDir, 0);
if (!success)
{
badResource = folder;
@ -300,7 +300,7 @@ bool Engine::Initialize(const VariantMap& parameters)
String autoResourcePak = exePath + autoloadFolder + "/" + pak;
SharedPtr<PackageFile> package(new PackageFile(context_));
if (package->Open(autoResourcePak))
cache->AddPackageFile(package);
cache->AddPackageFile(package, 0);
else
{
badResource = autoResourcePak;

Просмотреть файл

@ -107,8 +107,7 @@ bool ResourceCache::AddResourceDir(const String& pathName, unsigned priority)
return true;
}
// If the priority isn't last or greater than size insert at position otherwise push.
if (priority > PRIORITY_LAST && priority < resourceDirs_.Size())
if (priority < resourceDirs_.Size())
resourceDirs_.Insert(priority, fixedPath);
else
resourceDirs_.Push(fixedPath);
@ -133,8 +132,7 @@ void ResourceCache::AddPackageFile(PackageFile* package, unsigned priority)
if (!package || !package->GetNumFiles())
return;
// If the priority isn't last or greater than size insert at position otherwise push.
if (priority > PRIORITY_LAST && priority < packages_.Size())
if (priority < packages_.Size())
packages_.Insert(priority, SharedPtr<PackageFile>(package));
else
packages_.Push(SharedPtr<PackageFile>(package));