protected override void OnClickPreviewButton() { ChromaSDKAnimation1D animation = GetAnimation(); EditorUtility.SetDirty(animation); var frames = animation.Frames; //copy Unload(); if (ChromaConnectionManager.Instance.Connected) { if (_mCurrentFrame >= 0 && _mCurrentFrame < frames.Count) { ChromaDevice1DEnum device = animation.Device; EffectArray1dInput colors = frames[_mCurrentFrame]; EffectResponseId effect = ChromaUtils.CreateEffectCustom1D(device, colors); if (null != effect && effect.Result == 0) { ChromaUtils.SetEffect(effect.Id); ChromaUtils.RemoveEffect(effect.Id); } } } }
/// <summary> /// Load the effects before playing /// </summary> public void Load() { //Debug.Log("Load:"); if (_mIsLoaded) { //Debug.LogError("Animation has already been loaded!"); return; } if (ChromaConnectionManager.Instance.Connected) { for (int i = 0; i < Frames.Count; ++i) { EffectArray1dInput frame = Frames[i]; EffectResponseId effect = ChromaUtils.CreateEffectCustom1D(Device, frame); /* * // app can check the effect list for null or non-zero result * if (null == effect || * effect.Result != 0) * { * Debug.LogError("Failed to create effect!"); * } */ _mEffects.Add(effect); } _mIsLoaded = true; } }
public void Load() { if (this._mIsLoaded) { Debug.LogError("Animation has already been loaded!"); return; } if (ChromaConnectionManager.Instance.Connected) { for (int i = 0; i < this.Frames.Count; i++) { EffectArray1dInput input = this.Frames[i]; EffectResponseId item = ChromaUtils.CreateEffectCustom1D(this.Device, input); this._mEffects.Add(item); } this._mIsLoaded = true; } }