Change the zAutogenerated asset prefix to directory-like:
- Change the zAutogenerated__ prefix to zAutogenerated/ - This allows the zAutogenerated/ assets to display in a dedicated menu in the animation editor when the animator is selected. - For legacy compatibility, the old prefix is still matched for the invocation of ClearPreviousAssets() in addition to the new.
This commit is contained in:
@@ -553,7 +553,12 @@ namespace AnimatorAsCode.V1
|
||||
var allSubAssets = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(_configuration.AsPersistentContainerRequired()));
|
||||
foreach (var subAsset in allSubAssets)
|
||||
{
|
||||
if (subAsset.name.StartsWith($"zAutogenerated__{_configuration.AssetKey}__")
|
||||
if (
|
||||
(
|
||||
subAsset.name.StartsWith($"{AacInternals.AutoGeneratedPrefix}{_configuration.AssetKey}__")
|
||||
|| subAsset.name.StartsWith($"{AacInternals.AutoGeneratedLegacyPrefix}{_configuration.AssetKey}__")
|
||||
)
|
||||
|
||||
&& (subAsset is AnimationClip || subAsset is BlendTree || subAsset is AvatarMask))
|
||||
{
|
||||
AssetDatabase.RemoveObjectFromAsset(subAsset);
|
||||
|
||||
@@ -11,10 +11,13 @@ namespace AnimatorAsCode.V1
|
||||
{
|
||||
internal static class AacInternals
|
||||
{
|
||||
internal const string AutoGeneratedPrefix = "zAutogenerated/";
|
||||
internal const string AutoGeneratedLegacyPrefix = "zAutogenerated__";
|
||||
|
||||
internal static AnimatorController NewAnimatorController(AacConfiguration component, string suffix)
|
||||
{
|
||||
var animatorController = new AnimatorController();
|
||||
animatorController.name = "zAutogenerated__" + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
animatorController.name = AutoGeneratedPrefix + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
animatorController.hideFlags = HideFlags.None;
|
||||
if (component.AsPersistentContainerRequired() != null) AssetDatabase.AddObjectToAsset(animatorController, component.AsPersistentContainerRequired());
|
||||
return animatorController;
|
||||
@@ -27,7 +30,7 @@ namespace AnimatorAsCode.V1
|
||||
|
||||
internal static AnimationClip RegisterClip(AacConfiguration component, string suffix, AnimationClip clip)
|
||||
{
|
||||
clip.name = "zAutogenerated__" + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
clip.name = AutoGeneratedPrefix + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
clip.hideFlags = HideFlags.None;
|
||||
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(clip, component.AsRegularContainer());
|
||||
return clip;
|
||||
@@ -36,7 +39,7 @@ namespace AnimatorAsCode.V1
|
||||
internal static BlendTree NewBlendTreeAsRaw(AacConfiguration component, string suffix)
|
||||
{
|
||||
var clip = new BlendTree();
|
||||
clip.name = "zAutogenerated__" + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
clip.name = AutoGeneratedPrefix + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
clip.hideFlags = HideFlags.None;
|
||||
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(clip, component.AsRegularContainer());
|
||||
return clip;
|
||||
@@ -45,7 +48,7 @@ namespace AnimatorAsCode.V1
|
||||
internal static T DuplicateAssetIntoContainer<T>(AacConfiguration component, T assetToDuplicate) where T : Object
|
||||
{
|
||||
var duplicated = (T)Object.Instantiate(assetToDuplicate);
|
||||
duplicated.name = "zAutogenerated__" + component.AssetKey + "__" + assetToDuplicate.name + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
duplicated.name = AutoGeneratedPrefix + component.AssetKey + "__" + assetToDuplicate.name + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
duplicated.hideFlags = HideFlags.None;
|
||||
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(duplicated, component.AsRegularContainer());
|
||||
return duplicated;
|
||||
@@ -54,7 +57,7 @@ namespace AnimatorAsCode.V1
|
||||
internal static AvatarMask NewAvatarMask(AacConfiguration component, string fullLayerName)
|
||||
{
|
||||
var avatarMask = new AvatarMask();
|
||||
avatarMask.name = "zAutogenerated__" + component.AssetKey + "_" + fullLayerName + "__AvatarMask";
|
||||
avatarMask.name = AutoGeneratedPrefix + component.AssetKey + "_" + fullLayerName + "__AvatarMask";
|
||||
avatarMask.hideFlags = HideFlags.None;
|
||||
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(avatarMask, component.AsRegularContainer());
|
||||
return avatarMask;
|
||||
|
||||
Reference in New Issue
Block a user