private BlendTree(AssetLayout layout, AssetInfo assetInfo, AnimatorController controller, StateConstant state, int nodeIndex) : base(layout) { AssetInfo = assetInfo; ObjectHideFlags = HideFlags.HideInHierarchy; VirtualSerializedFile virtualFile = (VirtualSerializedFile)assetInfo.File; BlendTreeNodeConstant node = state.GetBlendTree().NodeArray[nodeIndex].Instance; Name = nameof(BlendTree); Childs = new ChildMotion[node.ChildIndices.Length]; for (int i = 0; i < node.ChildIndices.Length; i++) { Childs[i] = new ChildMotion(virtualFile, controller, state, nodeIndex, i); } BlendParameter = node.BlendEventID == uint.MaxValue ? string.Empty : controller.TOS[node.BlendEventID]; BlendParameterY = node.BlendEventYID == uint.MaxValue ? string.Empty : controller.TOS[node.BlendEventYID]; MinThreshold = node.GetMinThreshold(controller.File.Version); MaxThreshold = node.GetMaxThreshold(controller.File.Version); UseAutomaticThresholds = false; NormalizedBlendValues = node.BlendDirectData.Instance.NormalizedBlendValues; BlendType = node.BlendType; }
public ChildMotion(VirtualSerializedFile file, AnimatorController controller, StateConstant state, int nodeIndex, int childIndex) { BlendTreeConstant treeConstant = state.GetBlendTree(); BlendTreeNodeConstant node = treeConstant.NodeArray[nodeIndex].Instance; int childNodeIndex = (int)node.ChildIndices[childIndex]; Motion = state.CreateMotion(file, controller, childNodeIndex); Threshold = node.GetThreshold(controller.File.Version, childIndex); Position = default; TimeScale = 1.0f; CycleOffset = node.CycleOffset; uint directID = node.GetDirectBlendParameter(controller.File.Version, childIndex); DirectBlendParameter = controller.TOS[directID]; Mirror = node.Mirror; }
public BlendTree(VirtualSerializedFile file, AnimatorController controller, StateConstant state, int nodeIndex) : base(file.CreateAssetInfo(ClassIDType.BlendTree)) { BlendTreeNodeConstant node = state.GetBlendTree().NodeArray[nodeIndex].Instance; ObjectHideFlags = 1; Name = nameof(BlendTree); m_childs = new ChildMotion[node.ChildIndices.Count]; for (int i = 0; i < node.ChildIndices.Count; i++) { m_childs[i] = new ChildMotion(file, controller, state, nodeIndex, i); } BlendParameter = node.BlendEventID == uint.MaxValue ? string.Empty : controller.TOS[node.BlendEventID]; BlendParameterY = node.BlendEventYID == uint.MaxValue ? string.Empty : controller.TOS[node.BlendEventYID]; MinThreshold = node.GetMinThreshold(controller.File.Version); MaxThreshold = node.GetMaxThreshold(controller.File.Version); UseAutomaticThresholds = false; NormalizedBlendValues = node.BlendDirectData.Instance.NormalizedBlendValues; BlendType = node.BlendType; file.AddAsset(this); }