Upload from upload_mods.ps1
This commit is contained in:
34
KFAttached/RigAdaptors/Adaptors/RigAdaptorAbs.cs
Normal file
34
KFAttached/RigAdaptors/Adaptors/RigAdaptorAbs.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations.Rigging;
|
||||
|
||||
public abstract class RigAdaptorAbs : MonoBehaviour
|
||||
{
|
||||
[NonSerialized]
|
||||
public Transform targetRoot;
|
||||
[SerializeField]
|
||||
protected float weight = 1f;
|
||||
public abstract void ReadRigData();
|
||||
public abstract void FindRigTargets();
|
||||
|
||||
protected void WeightedTransformArrayToAdaptor(WeightedTransformArray array, out string[] transforms, out float[] weights)
|
||||
{
|
||||
transforms = new string[array.Count];
|
||||
weights = new float[array.Count];
|
||||
for (int i = 0; i < array.Count; i++)
|
||||
{
|
||||
transforms[i] = array[i].transform?.name;
|
||||
weights[i] = array[i].weight;
|
||||
}
|
||||
}
|
||||
|
||||
protected WeightedTransformArray WeightedTransformArrayFromAdaptor(Transform targetRoot, string[] transforms, float[] weights)
|
||||
{
|
||||
WeightedTransformArray array = new WeightedTransformArray();
|
||||
for (int i = 0; i < transforms.Length; i++)
|
||||
{
|
||||
array.Add(new WeightedTransform(targetRoot.FindInAllChildren(transforms[i]), weights[i]));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user