private AnimMixer CreateAnimMixer(int layer) { // Increase input count int inputCount = _mixerRoot.GetInputCount(); if (layer == 0 && inputCount == 0) { _mixerRoot.SetInputCount(1); } else { if (layer > inputCount - 1) { _mixerRoot.SetInputCount(layer + 1); } } var animMixer = new AnimMixer(_graph, layer); _mixers.Add(animMixer); return(animMixer); }
public override void OnPlayableCreate(Playable playable) { m_ActualPlayable = playable; layerMixer = AnimationLayerMixerPlayable.Create(graph, 1); var mixer = AnimationMixerPlayable.Create(graph, 1, true); mixers.Add(mixer); layerMixer.SetInputCount(5); layerMixer.SetInputWeight(0, 1.0f); graph.Connect(mixer, 0, layerMixer, 0); self.SetInputCount(1); self.SetInputWeight(0, 1); graph.Connect(layerMixer, 0, self, 0); }
public void AddLayer(int layerIndex) { if (-1 != m_StateLayers.FindIndex(l => l != null && l.layerIndex == layerIndex)) { Debug.LogErrorFormat("layer:{0} has existed!", layerIndex); return; } var layer = new StateLayer(layerIndex, m_Graph, m_Params); int emptyIndex = m_StateLayers.FindIndex(l => l == null); if (emptyIndex != -1) { m_StateLayers[emptyIndex] = layer; } else { m_StateLayers.Add(layer); m_LayerMixer.SetInputCount(m_StateLayers.Count); } layer.SetPlayableOutput(0, layer.layerIndex, m_LayerMixer); }
public virtual void Destroy(AnimationLayerMixerPlayable AnimationLayerMixerPlayable) { PlayableExtensions.DisconnectInput(AnimationLayerMixerPlayable, this.Inputhandler); AnimationLayerMixerPlayable.SetInputCount(AnimationLayerMixerPlayable.GetInputCount() - 1); }