chore: unexpose animation context for now

This API is still a bit unstable; it'll probably be added in a future release.
This commit is contained in:
bd_ 2023-09-24 14:37:10 +09:00
parent 6332825980
commit c9c9701e1d
14 changed files with 54 additions and 30 deletions

View File

@ -1,5 +1,5 @@
using nadena.dev.ndmf;
using nadena.dev.ndmf.animation;
using nadena.dev.modular_avatar.animation;
using NUnit.Framework;
using UnityEditor;

View File

@ -1,5 +1,5 @@
using System.Linq;
using nadena.dev.ndmf.animation;
using nadena.dev.modular_avatar.animation;
using NUnit.Framework;
using UnityEditor;
using UnityEditor.Animations;

View File

@ -1,5 +1,5 @@
using System.Linq;
using nadena.dev.ndmf.animation;
using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.core;
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework;

View File

@ -1,5 +1,5 @@
using System;
using nadena.dev.ndmf.animation;
using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.core;
using nadena.dev.modular_avatar.core.editor;
using nadena.dev.modular_avatar.editor.ErrorReporting;

View File

@ -1,4 +1,4 @@
using nadena.dev.ndmf.animation;
using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework;
using UnityEngine;

View File

@ -1,13 +1,18 @@
using System;
#region
using System;
using System.Collections.Generic;
using nadena.dev.ndmf;
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
using VRC.SDK3.Avatars.Components;
namespace nadena.dev.ndmf.animation
#endregion
namespace nadena.dev.modular_avatar.animation
{
public static class AnimationUtil
internal static class AnimationUtil
{
private const string SAMPLE_PATH_PACKAGE =
"Packages/com.vrchat.avatars/Samples/AV3 Demo Assets/Animation/Controllers";

View File

@ -22,19 +22,22 @@
* SOFTWARE.
*/
#region
using System;
using System.Collections.Generic;
using System.Linq;
using nadena.dev.ndmf.util;
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
using VRC.SDK3.Avatars.Components;
using Object = UnityEngine.Object;
namespace nadena.dev.ndmf.animation
#endregion
namespace nadena.dev.modular_avatar.animation
{
public class AnimatorCombiner
internal class AnimatorCombiner
{
private readonly AnimatorController _combined;
private bool isSaved;
@ -56,7 +59,7 @@ namespace nadena.dev.ndmf.animation
private int controllerBaseLayer = 0;
public AnimatorCombiner(String assetName, UnityEngine.Object assetContainer)
public AnimatorCombiner(String assetName, Object assetContainer)
{
_combined = new AnimatorController();
if (assetContainer != null)

View File

@ -1,10 +1,16 @@
namespace nadena.dev.ndmf.animation
#region
using nadena.dev.ndmf;
#endregion
namespace nadena.dev.modular_avatar.animation
{
/// <summary>
/// This interface tags components which supply additional animation controllers for merging. They will be given
/// an opportunity to apply animation path updates when the TrackObjectRenamesContext is committed.
/// </summary>
public interface IOnCommitObjectRenames
internal interface IOnCommitObjectRenames
{
void OnCommitObjectRenames(BuildContext buildContext, TrackObjectRenamesContext renameContext);
}

View File

@ -1,24 +1,33 @@
using System;
#region
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using nadena.dev.ndmf;
using nadena.dev.ndmf.util;
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
using VRC.Core;
using VRC.SDK3.Avatars.Components;
using Object = UnityEngine.Object;
namespace nadena.dev.ndmf.animation
#endregion
namespace nadena.dev.modular_avatar.animation
{
using UnityObject = UnityEngine.Object;
#region
using UnityObject = Object;
#endregion
/// <summary>
/// This extension context tracks when objects are renamed, and updates animations accordingly.
/// Users of this context need to be aware that, when creating new curves (or otherwise introducing new motions,
/// use context.ObjectPath to obtain a suitable path for the target objects).
/// </summary>
public sealed class TrackObjectRenamesContext : IExtensionContext
internal sealed class TrackObjectRenamesContext : IExtensionContext
{
private Dictionary<GameObject, List<string>>
_objectToOriginalPaths = new Dictionary<GameObject, List<string>>();

View File

@ -25,7 +25,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using nadena.dev.ndmf.animation;
using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEditor;
using UnityEngine;
@ -422,24 +422,25 @@ namespace nadena.dev.modular_avatar.core.editor
&& (
Vector3.SqrMagnitude(mergedSrcBone.transform.localScale - src.transform.localScale) > 0.00001f
|| Quaternion.Angle(mergedSrcBone.transform.localRotation, src.transform.localRotation) > 0.00001f
|| Vector3.SqrMagnitude(mergedSrcBone.transform.localPosition - src.transform.localPosition) > 0.00001f
|| Vector3.SqrMagnitude(mergedSrcBone.transform.localPosition - src.transform.localPosition) >
0.00001f
)
&& src.GetComponent<IConstraint>() != null
)
)
{
// Constraints are sensitive to changes in local reference frames in some cases. In this case we'll
// inject a dummy object in between in order to retain the local parent scale of the retargeted bone.
var objName = src.gameObject.name + "$ConstraintRef " + Guid.NewGuid();
var constraintScaleRef = new GameObject(objName);
constraintScaleRef.transform.SetParent(src.transform.parent);
constraintScaleRef.transform.localPosition = Vector3.zero;
constraintScaleRef.transform.localRotation = Quaternion.identity;
constraintScaleRef.transform.localScale = Vector3.one;
constraintScaleRef.transform.SetParent(newParent.transform, true);
mergedSrcBone = constraintScaleRef;
BoneDatabase.AddMergedBone(mergedSrcBone.transform);
BoneDatabase.RetainMergedBone(mergedSrcBone.transform);
PathMappings.MarkTransformLookthrough(mergedSrcBone);

View File

@ -25,7 +25,7 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using nadena.dev.ndmf.animation;
using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEngine;
@ -252,7 +252,7 @@ namespace nadena.dev.modular_avatar.core.editor
dst.bindposes = newBindPoses;
renderer.sharedMesh = dst;
}
var newRootBone = _boneDatabase.GetRetargetedBone(rootBone, true);
if (newRootBone == null)
{

View File

@ -1,7 +1,7 @@
using System;
using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.editor.ErrorReporting;
using nadena.dev.ndmf;
using nadena.dev.ndmf.animation;
using nadena.dev.ndmf.fluent;
using UnityEngine;

View File

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using nadena.dev.ndmf.animation;
using nadena.dev.modular_avatar.animation;
using nadena.dev.modular_avatar.editor.ErrorReporting;
using UnityEditor;
using UnityEngine;

@ -1 +1 @@
Subproject commit f6caa431ab9c8e6071edfc0ac75595519161b9e2
Subproject commit d1cbaa4aabd87b006b6e858de2a64192be5e42e9