Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some opt #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions Editor/AddressableImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
{
// Skip if all imported and deleted assets are addressables configurations.
var isConfigurationPass =
(importedAssets.Length > 0 && importedAssets.All(x => x.StartsWith("Assets/AddressableAssetsData"))) &&
(deletedAssets.Length > 0 && deletedAssets.All(x => x.StartsWith("Assets/AddressableAssetsData")));
(importedAssets.Length == 0 || importedAssets.All(x => x.StartsWith("Assets/AddressableAssetsData"))) &&
(deletedAssets.Length == 0 || deletedAssets.All(x => x.StartsWith("Assets/AddressableAssetsData"))) &&
movedAssets.Length == 0 && movedFromAssetPaths.Length == 0;

if (isConfigurationPass)
{
return;
Expand Down Expand Up @@ -93,7 +95,7 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse

if (importSettingsList.ShowImportProgressBar && EditorUtility.DisplayCancelableProgressBar(
"Processing addressable import settings", $"[{i}/{importedAssets.Length}] {importedAsset}",
(float) i / importedAssets.Length))
(float)i / importedAssets.Length))
break;

foreach (var importSettings in hasRuleSettingsList)
Expand Down Expand Up @@ -229,7 +231,8 @@ static AddressableAssetEntry CreateOrUpdateAddressableAssetEntry(

// Set group settings from template if necessary
if (rule.groupTemplate != null && (newGroup || rule.groupTemplateApplicationMode ==
GroupTemplateApplicationMode.AlwaysOverwriteGroupSettings)) {
GroupTemplateApplicationMode.AlwaysOverwriteGroupSettings))
{
// Due to ApplyToAddressableAssetGroup only applies schema values for the group to the schema
// values found in the source template, all schema objects of the source template should be
// manually added to the target group before run the ApplyToAddressableAssetGroup function.
Expand Down Expand Up @@ -277,8 +280,11 @@ static AddressableAssetEntry CreateOrUpdateAddressableAssetEntry(
foreach (var dynamicLabel in rule.dynamicLabels)
{
var label = rule.ParseReplacement(assetPath, dynamicLabel);
settings.AddLabel(label);
entry.labels.Add(label);
if (!string.IsNullOrEmpty(label))
{
settings.AddLabel(label);
entry.labels.Add(label);
}
}
}
}
Expand Down Expand Up @@ -357,16 +363,17 @@ public static void ReimportFolders(IEnumerable<String> assetPaths, bool showConf
if (!dir.StartsWith(".") && !dir.EndsWith("~"))
{
pathsToImport.Add(dir.Replace('\\', '/'));
}
}
// Add files.
var filesToAdd = Directory.GetFiles(assetPath, "*", SearchOption.AllDirectories);
foreach (var file in filesToAdd)
{
// Filter out meta and DS_Store files.
if (!IsAssetIgnored(file))
{
pathsToImport.Add(file.Replace('\\', '/'));

// Add files.
var filesToAdd = Directory.GetFiles(dir, "*", SearchOption.TopDirectoryOnly);
foreach (var file in filesToAdd)
{
// Filter out meta and DS_Store files.
if (!IsAssetIgnored(file))
{
pathsToImport.Add(file.Replace('\\', '/'));
}
}
}
}
}
Expand Down