Пример #1
0
 public bool hasSamePropertyAs(AMITarget target, AMMaterialTrack _track)
 {
     if (_track.GetTarget(target) == GetTarget(target) && _track.GetMaterial(target) == GetMaterial(target) && _track.getTrackType() == getTrackType())
     {
         return(true);
     }
     return(false);
 }
Пример #2
0
        protected override void DoCopy(AMTrack track)
        {
            AMMaterialTrack ntrack = track as AMMaterialTrack;

            ntrack.obj           = obj;
            ntrack._matOverride  = _matOverride;
            ntrack._matInd       = _matInd;
            ntrack._property     = _property;
            ntrack._propertyType = _propertyType;
        }
Пример #3
0
        public override void build(AMSequence seq, AMTrack track, int index, UnityEngine.Object target)
        {
            AMMaterialTrack matTrack = track as AMMaterialTrack;

            AMMaterialTrack.ValueType propType = matTrack.propertyType;

            Material matInst = matTrack.materialInstance;

            string prop   = matTrack.property;
            int    propId = Shader.PropertyToID(prop);

            int frameRate = seq.take.frameRate;

            Tweener tween = null;

            int           keyCount   = track.keys.Count;
            AMMaterialKey endKey     = index + 1 < keyCount ? track.keys[index + 1] as AMMaterialKey : null;
            float         frameCount = endKey != null ? endKey.frame - frame + 1 : 1f;

            switch (propType)
            {
            case AMMaterialTrack.ValueType.Float:
            case AMMaterialTrack.ValueType.Range:
                if (!canTween || keyCount == 1)     //allow one key
                {
                    var setTween = DOTween.To(new AMPlugValueSet <float>(), () => val, (x) => matInst.SetFloat(propId, x), val, frameCount / frameRate);
                    setTween.plugOptions.SetSequence(seq);
                    seq.Insert(this, setTween);
                }
                else
                {
                    if (targetsAreEqual(propType, endKey))
                    {
                        return;
                    }

                    tween = DOTween.To(new FloatPlugin(), () => matInst.GetFloat(propId), (x) => matInst.SetFloat(propId, x), endKey.val, getTime(frameRate));
                }
                break;

            case AMMaterialTrack.ValueType.Vector:
                if (!canTween || keyCount == 1)     //allow one key
                {
                    var setTween = DOTween.To(new AMPlugValueSet <Vector4>(), () => vector, (x) => matInst.SetVector(propId, x), vector, frameCount / frameRate);
                    setTween.plugOptions.SetSequence(seq);
                    seq.Insert(this, setTween);
                }
                else
                {
                    if (targetsAreEqual(propType, endKey))
                    {
                        return;
                    }

                    tween = DOTween.To(AMPluginFactory.CreateVector4(), () => matInst.GetVector(propId), (x) => matInst.SetVector(propId, x), endKey.vector, getTime(frameRate));
                }
                break;

            case AMMaterialTrack.ValueType.Color:
                if (!canTween || keyCount == 1)     //allow one key
                {
                    var val      = color;
                    var setTween = DOTween.To(new AMPlugValueSet <Color>(), () => val, (x) => matInst.SetColor(propId, x), val, frameCount / frameRate);
                    setTween.plugOptions.SetSequence(seq);
                    seq.Insert(this, setTween);
                }
                else
                {
                    if (targetsAreEqual(propType, endKey))
                    {
                        return;
                    }

                    tween = DOTween.To(AMPluginFactory.CreateColor(), () => matInst.GetColor(propId), (x) => matInst.SetColor(propId, x), endKey.color, getTime(frameRate));
                }
                break;

            case AMMaterialTrack.ValueType.TexOfs:
                if (!canTween || keyCount == 1)     //allow one key
                {
                    var val      = texOfs;
                    var setTween = DOTween.To(new AMPlugValueSet <Vector2>(), () => val, (x) => matInst.SetTextureOffset(prop, x), val, frameCount / frameRate);
                    setTween.plugOptions.SetSequence(seq);
                    seq.Insert(this, setTween);
                }
                else
                {
                    if (targetsAreEqual(propType, endKey))
                    {
                        return;
                    }

                    tween = DOTween.To(AMPluginFactory.CreateVector2(), () => matInst.GetTextureOffset(prop), (x) => matInst.SetTextureOffset(prop, x), endKey.texOfs, getTime(frameRate));
                }
                break;

            case AMMaterialTrack.ValueType.TexScale:
                if (!canTween || keyCount == 1)     //allow one key
                {
                    var val      = texScale;
                    var setTween = DOTween.To(new AMPlugValueSet <Vector2>(), () => val, (x) => matInst.SetTextureScale(prop, x), val, frameCount / frameRate);
                    setTween.plugOptions.SetSequence(seq);
                    seq.Insert(this, setTween);
                }
                else
                {
                    if (targetsAreEqual(propType, endKey))
                    {
                        return;
                    }

                    tween = DOTween.To(AMPluginFactory.CreateVector2(), () => matInst.GetTextureScale(prop), (x) => matInst.SetTextureScale(prop, x), endKey.texScale, getTime(frameRate));
                }
                break;

            case AMMaterialTrack.ValueType.TexEnv:
                var texEnvTween = DOTween.To(new AMPlugValueSet <Texture>(), () => texture, (x) => matInst.SetTexture(propId, x), texture, frameCount / frameRate);
                texEnvTween.plugOptions.SetSequence(seq);
                seq.Insert(this, texEnvTween);
                break;
            }

            if (tween != null)
            {
                if (hasCustomEase())
                {
                    tween.SetEase(easeCurve);
                }
                else
                {
                    tween.SetEase((Ease)easeType, amplitude, period);
                }

                seq.Insert(this, tween);
            }
        }
Пример #4
0
        public static void Open(AMMaterialTrack track)
        {
            window = EditorWindow.GetWindow(typeof(AMMaterialEditor)) as AMMaterialEditor;

            window.mTrack = track;
        }