Code cleanup, no functional changes.
This commit is contained in:
@@ -19,7 +19,7 @@ namespace AnimatorAsCode.V1
|
|||||||
internal static AnimatorController NewAnimatorController(AacConfiguration component, string suffix)
|
internal static AnimatorController NewAnimatorController(AacConfiguration component, string suffix)
|
||||||
{
|
{
|
||||||
var animatorController = new AnimatorController();
|
var animatorController = new AnimatorController();
|
||||||
animatorController.name = AutoGeneratedPrefix + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
animatorController.name = Internal_GenerateAnimationName(component, suffix); // FIXME animation name conflict
|
||||||
animatorController.hideFlags = HideFlags.None;
|
animatorController.hideFlags = HideFlags.None;
|
||||||
if (component.AsPersistentContainerRequired() != null) AssetDatabase.AddObjectToAsset(animatorController, component.AsPersistentContainerRequired());
|
if (component.AsPersistentContainerRequired() != null) AssetDatabase.AddObjectToAsset(animatorController, component.AsPersistentContainerRequired());
|
||||||
return animatorController;
|
return animatorController;
|
||||||
@@ -32,7 +32,7 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
internal static AnimationClip RegisterClip(AacConfiguration component, string suffix, AnimationClip clip)
|
internal static AnimationClip RegisterClip(AacConfiguration component, string suffix, AnimationClip clip)
|
||||||
{
|
{
|
||||||
clip.name = AutoGeneratedPrefix + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
clip.name = Internal_GenerateAnimationName(component, suffix);
|
||||||
clip.hideFlags = HideFlags.None;
|
clip.hideFlags = HideFlags.None;
|
||||||
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(clip, component.AsRegularContainer());
|
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(clip, component.AsRegularContainer());
|
||||||
return clip;
|
return clip;
|
||||||
@@ -41,7 +41,7 @@ namespace AnimatorAsCode.V1
|
|||||||
internal static BlendTree NewBlendTreeAsRaw(AacConfiguration component, string suffix)
|
internal static BlendTree NewBlendTreeAsRaw(AacConfiguration component, string suffix)
|
||||||
{
|
{
|
||||||
var clip = new BlendTree();
|
var clip = new BlendTree();
|
||||||
clip.name = AutoGeneratedPrefix + component.AssetKey + "__" + suffix + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
clip.name = Internal_GenerateAnimationName(component, suffix);
|
||||||
clip.hideFlags = HideFlags.None;
|
clip.hideFlags = HideFlags.None;
|
||||||
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(clip, component.AsRegularContainer());
|
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(clip, component.AsRegularContainer());
|
||||||
return clip;
|
return clip;
|
||||||
@@ -50,12 +50,17 @@ namespace AnimatorAsCode.V1
|
|||||||
internal static T DuplicateAssetIntoContainer<T>(AacConfiguration component, T assetToDuplicate) where T : Object
|
internal static T DuplicateAssetIntoContainer<T>(AacConfiguration component, T assetToDuplicate) where T : Object
|
||||||
{
|
{
|
||||||
var duplicated = (T)Object.Instantiate(assetToDuplicate);
|
var duplicated = (T)Object.Instantiate(assetToDuplicate);
|
||||||
duplicated.name = AutoGeneratedPrefix + component.AssetKey + "__" + assetToDuplicate.name + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
duplicated.name = Internal_GenerateAnimationName(component, assetToDuplicate.name);
|
||||||
duplicated.hideFlags = HideFlags.None;
|
duplicated.hideFlags = HideFlags.None;
|
||||||
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(duplicated, component.AsRegularContainer());
|
if (component.AsRegularContainer() != null) AssetDatabase.AddObjectToAsset(duplicated, component.AsRegularContainer());
|
||||||
return duplicated;
|
return duplicated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string Internal_GenerateAnimationName(AacConfiguration component, string middle)
|
||||||
|
{
|
||||||
|
return AutoGeneratedPrefix + component.AssetKey + "__" + middle + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||||
|
}
|
||||||
|
|
||||||
internal static AvatarMask NewAvatarMask(AacConfiguration component, string fullLayerName)
|
internal static AvatarMask NewAvatarMask(AacConfiguration component, string fullLayerName)
|
||||||
{
|
{
|
||||||
var avatarMask = new AvatarMask();
|
var avatarMask = new AvatarMask();
|
||||||
@@ -140,16 +145,18 @@ namespace AnimatorAsCode.V1
|
|||||||
|
|
||||||
private static void UndoDisable<T>(T state)
|
private static void UndoDisable<T>(T state)
|
||||||
{
|
{
|
||||||
typeof(T)
|
GetPushUndoProperty<T>().SetValue(state, false);
|
||||||
.GetProperty("pushUndo", BindingFlags.Instance | BindingFlags.NonPublic)
|
|
||||||
.SetValue(state, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UndoEnable<T>(T state)
|
private static void UndoEnable<T>(T state)
|
||||||
{
|
{
|
||||||
typeof(T)
|
GetPushUndoProperty<T>().SetValue(state, true);
|
||||||
.GetProperty("pushUndo", BindingFlags.Instance | BindingFlags.NonPublic)
|
}
|
||||||
.SetValue(state, true);
|
|
||||||
|
private static PropertyInfo GetPushUndoProperty<T>()
|
||||||
|
{
|
||||||
|
return typeof(T)
|
||||||
|
.GetProperty("pushUndo", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user