Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
67a0f76
LabelRuleにアドレスとAddressableAssetGroupNameを渡すように変更
Haruma-K Jun 27, 2025
1c7fd67
VersionRuleにアドレスとAddressableAssetGroupNameを渡すように変更
Haruma-K Jun 27, 2025
d918926
remp
Haruma-K Jun 27, 2025
8c9556e
IProviderインターフェースを削除してIAddressProviderに統合
Haruma-K Jun 30, 2025
502b482
feat: IAssetFilterのIsMatchにアドレスとグループ情報を渡せるように拡張
Haruma-K Jun 30, 2025
e6f86e9
不要なファイルを削除
Haruma-K Jun 30, 2025
538a871
fix: AssetFilterBaseのIsMatchメソッドのシグネチャを修正
Haruma-K Jun 30, 2025
41b3d13
fix: AssetFilterテストのIsMatchメソッド呼び出しを修正
Haruma-K Jun 30, 2025
d29a436
feat: AddressBasedAssetFilterとそのDrawerを追加
Haruma-K Jun 30, 2025
6fcee89
feat: AddressableAssetGroupBasedAssetFilterとそのDrawerを追加
Haruma-K Jun 30, 2025
ddf7ee2
feat: Ruleタイプに基づくAssetFilterの使用制限機能を実装
Haruma-K Jun 30, 2025
b12dcb1
feat: AddressBasedLabelProviderとAddressBasedVersionProviderを追加
Haruma-K Jun 30, 2025
b7ad802
feat: AddressableAssetGroupNameBasedProviderを追加
Haruma-K Jun 30, 2025
f36caa8
docs: READMEに新しいAsset FilterとProviderの説明を追加
Haruma-K Jun 30, 2025
6317e4e
refactor: AssetFilterAssetの後方互換性のための実装を削除
Haruma-K Jun 30, 2025
ec0e35d
feat: 新しいProviderクラスのためのDrawerを追加
Haruma-K Jul 1, 2025
b0c0b4e
feat: 新しいProviderクラスのためのDrawerを追加
Haruma-K Jul 1, 2025
d00926e
Merge branch 'feature/wip_group-based-filter' of github.com:CyberAgen…
Haruma-K Jul 1, 2025
8a01f80
refactor: AddressBasedProviderからUseFullAddressプロパティを削除
Haruma-K Jul 1, 2025
cb5226c
test: 各種Provider及びAssetFilterのユニットテストを追加
Haruma-K Jul 1, 2025
4eb16ca
test: 不要な複雑なRegexパターンテストを削除
Haruma-K Jul 3, 2025
a380d75
不要なテストを削除
Haruma-K Jul 3, 2025
b6cee6c
test: AddressBasedAssetFilterTestから不要なテストケースを削除
Haruma-K Jul 3, 2025
6444eb9
refactor: DrawerクラスでGUI.enabledをEditorGUI.DisabledScopeに置き換え
Haruma-K Jul 3, 2025
2b1cfe7
refactor: AssetGroupPresenterクラスのruleContextフィールドをruleTypeに変更
Haruma-K Jul 3, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ private void OnEnable()
_groupCollection.Add(new AssetGroup());

_view = new AssetGroupPanelView();
_presenter = new AssetGroupPanelPresenter(_view, _history, _assetSaveService);
// Use Address rule type for development window
_presenter = new AssetGroupPanelPresenter(_view, _history, _assetSaveService, RuleType.Address);
_presenter.SetupView(_groupCollection, 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public bool TryProvideAddress(
return false;
}

if (!_assetGroups.Contains(assetPath, assetType, isFolder))
if (!_assetGroups.Contains(assetPath, assetType, isFolder, null, null))
{
address = null;
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
using SmartAddresser.Editor.Core.Models.Shared;
using System;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.AddressRules
{
/// <summary>
/// Provide addresses from asset information.
/// </summary>
public interface IAddressProvider : IProvider<string>
public interface IAddressProvider
{
void Setup();

string Provide(string assetPath, Type assetType, bool isFolder);

string GetDescription();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using SmartAddresser.Editor.Core.Models.Shared;
using UnityEditor.AddressableAssets.Settings;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
{
/// <summary>
/// Provide the label based on the addressable entry's address.
/// </summary>
[Serializable]
public sealed class AddressBasedLabelProvider : AddressBasedProvider, ILabelProvider
{
void ILabelProvider.Setup()
{
base.Setup();
}

string ILabelProvider.Provide(string assetPath, Type assetType, bool isFolder, string address,
AddressableAssetGroup addressableAssetGroup)
{
return base.Provide(address);
}

string ILabelProvider.GetDescription()
{
return base.GetDescription();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using SmartAddresser.Editor.Core.Models.Shared;
using UnityEditor.AddressableAssets.Settings;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
{
/// <summary>
/// Provide the label based on the addressable asset group name.
/// </summary>
[Serializable]
public sealed class AddressableAssetGroupNameBasedLabelProvider : AddressableAssetGroupNameBasedProvider,
ILabelProvider
{
void ILabelProvider.Setup()
{
base.Setup();
}

string ILabelProvider.Provide(string assetPath, Type assetType, bool isFolder, string address,
AddressableAssetGroup addressableAssetGroup)
{
if (addressableAssetGroup == null)
return null;

return base.Provide(addressableAssetGroup.Name);
}

string ILabelProvider.GetDescription()
{
return base.GetDescription();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using SmartAddresser.Editor.Core.Models.Shared;
using UnityEditor.AddressableAssets.Settings;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
{
Expand All @@ -9,5 +10,20 @@ namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
[Serializable]
public sealed class AssetPathBasedLabelProvider : AssetPathBasedProvider, ILabelProvider
{
void ILabelProvider.Setup()
{
base.Setup();
}

string ILabelProvider.Provide(string assetPath, Type assetType, bool isFolder, string address,
AddressableAssetGroup addressableAssetGroup)
{
return base.Provide(assetPath, assetType, isFolder);
}

string ILabelProvider.GetDescription()
{
return base.GetDescription();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using SmartAddresser.Editor.Core.Models.Shared;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
Expand All @@ -18,11 +18,11 @@ public string Label
set => _label = value;
}

void IProvider<string>.Setup()
public void Setup()
{
}

string IProvider<string>.Provide(string assetPath, Type assetType, bool isFolder)
public string Provide(string assetPath, Type assetType, bool isFolder, string address, AddressableAssetGroup addressableAssetGroup)
{
if (string.IsNullOrEmpty(_label))
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using UnityEditor.AddressableAssets.Settings;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
{
Expand All @@ -15,12 +16,12 @@ public void Setup()
labelProvider.Setup();
}

public string Provide(string assetPath, Type assetType, bool isFolder)
public string Provide(string assetPath, Type assetType, bool isFolder, string address, AddressableAssetGroup addressableAssetGroup)
{
if (labelProvider == null)
return null;

return labelProvider.Provide(assetPath, assetType, isFolder);
return labelProvider.Provide(assetPath, assetType, isFolder, address, addressableAssetGroup);
}

public string GetDescription()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
using SmartAddresser.Editor.Core.Models.Shared;
using System;
using UnityEditor.AddressableAssets.Settings;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
{
/// <summary>
/// Provide labels from asset information.
/// Provides a label for addressable asset entries with awareness of address and group information.
/// </summary>
public interface ILabelProvider : IProvider<string>
public interface ILabelProvider
{
/// <summary>
/// Setup the label provider.
/// </summary>
void Setup();

/// <summary>
/// Provide a label for the addressable asset.
/// </summary>
/// <param name="assetPath">The asset path.</param>
/// <param name="assetType">The type of the asset.</param>
/// <param name="isFolder">The asset is folder or not.</param>
/// <param name="address">The address assigned to the addressable entry.</param>
/// <param name="addressableAssetGroup">The addressable asset group.</param>
/// <returns>Returns the label. If the label cannot be provided, returns null.</returns>
string Provide(string assetPath, Type assetType, bool isFolder, string address, AddressableAssetGroup addressableAssetGroup);

/// <summary>
/// Get the description of this rule for display in the UI.
/// </summary>
/// <returns></returns>
string GetDescription();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using System;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
{
public abstract class LabelProviderAsset : ScriptableObject, ILabelProvider
{
public abstract void Setup();
public abstract string Provide(string assetPath, Type assetType, bool isFolder);

public abstract string Provide(string assetPath, Type assetType, bool isFolder, string address,
AddressableAssetGroup addressableAssetGroup);

public abstract string GetDescription();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using SmartAddresser.Editor.Core.Models.Shared.AssetGroups.ValidationError;
using SmartAddresser.Editor.Foundation.TinyRx.ObservableCollection;
using SmartAddresser.Editor.Foundation.TinyRx.ObservableProperty;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.LabelRules
Expand Down Expand Up @@ -79,12 +80,14 @@ public bool Validate(out LabelRuleValidationError error)
}

/// <summary>
/// Create a label from asset information.
/// Create a label from asset information with addressable context.
/// </summary>
/// <param name="assetPath"></param>
/// <param name="assetType"></param>
/// <param name="isFolder"></param>
/// <param name="label">If successful, assign the address. If not, null.</param>
/// <param name="address">The address assigned to the addressable entry.</param>
/// <param name="addressableAssetGroup">The addressable asset group.</param>
/// <param name="label">If successful, assign the label. If not, null.</param>
/// <param name="checkIsPathValidForEntry">
/// If true, check if the asset path is valid for entry.
/// You can pass false if it is guaranteed to be valid.
Expand All @@ -94,11 +97,13 @@ public bool TryProvideLabel(
string assetPath,
Type assetType,
bool isFolder,
string address,
AddressableAssetGroup addressableAssetGroup,
out string label,
bool checkIsPathValidForEntry = true
)
{
if (!_assetGroups.Contains(assetPath, assetType, isFolder))
if (!_assetGroups.Contains(assetPath, assetType, isFolder, address, addressableAssetGroup))
{
label = null;
return false;
Expand All @@ -110,7 +115,7 @@ public bool TryProvideLabel(
return false;
}

label = LabelProvider.Value.Provide(assetPath, assetType, isFolder);
label = LabelProvider.Value.Provide(assetPath, assetType, isFolder, address, addressableAssetGroup);

if (string.IsNullOrEmpty(label))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ out AddressableAssetGroup addressableGroup
}

/// <summary>
/// Provide the labels.
/// Provide the labels with addressable context.
/// </summary>
/// <param name="assetPath"></param>
/// <param name="assetType"></param>
/// <param name="isFolder"></param>
/// <param name="address">The address assigned to the addressable entry.</param>
/// <param name="addressableAssetGroup">The addressable asset group.</param>
/// <param name="doSetup"></param>
/// <param name="checkIsPathValidForEntry">
/// If true, check if the asset path is valid for entry.
Expand All @@ -120,6 +122,8 @@ public IReadOnlyCollection<string> ProvideLabels(
string assetPath,
Type assetType,
bool isFolder,
string address,
AddressableAssetGroup addressableAssetGroup,
bool doSetup,
bool checkIsPathValidForEntry = true
)
Expand All @@ -132,22 +136,22 @@ public IReadOnlyCollection<string> ProvideLabels(
if (doSetup)
labelRule.Setup();

if (labelRule.TryProvideLabel(assetPath, assetType, isFolder, out var label, checkIsPathValidForEntry))
if (labelRule.TryProvideLabel(assetPath, assetType, isFolder, address, addressableAssetGroup, out var label, checkIsPathValidForEntry))
labels.Add(label);
}

return labels;
}

public string ProvideVersion(string assetPath, Type assetType, bool isFolder, bool doSetup)
public string ProvideVersion(string assetPath, Type assetType, bool isFolder, string address, AddressableAssetGroup addressableAssetGroup, bool doSetup)
{
foreach (var versionRule in _versionRules)
{
if (doSetup)
versionRule.Setup();

// Adopt the first matching version.
if (versionRule.TryProvideVersion(assetPath, assetType, isFolder, out var version))
if (versionRule.TryProvideVersion(assetPath, assetType, isFolder, address, addressableAssetGroup, out var version))
return version;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using SmartAddresser.Editor.Core.Models.Shared;
using UnityEditor.AddressableAssets.Settings;

namespace SmartAddresser.Editor.Core.Models.LayoutRules.VersionRules
{
/// <summary>
/// Provide the version based on the addressable entry's address.
/// </summary>
[Serializable]
public sealed class AddressBasedVersionProvider : AddressBasedProvider, IVersionProvider
{
void IVersionProvider.Setup()
{
base.Setup();
}

string IVersionProvider.Provide(string assetPath, Type assetType, bool isFolder, string address,
AddressableAssetGroup addressableAssetGroup)
{
return base.Provide(address);
}

string IVersionProvider.GetDescription()
{
return base.GetDescription();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading