Exemplo n.º 1
0
        public override void Sanitize()
        {
            if (VFXBuiltInExpression.Find(m_expressionOp) == null)
            {
                switch (m_expressionOp)
                {
                // Due to reorganization, some indices have changed
                case VFXExpressionOperation.Tan:         m_expressionOp = VFXExpressionOperation.DeltaTime; break;

                case VFXExpressionOperation.ASin:        m_expressionOp = VFXExpressionOperation.TotalTime; break;

                case VFXExpressionOperation.ACos:        m_expressionOp = VFXExpressionOperation.SystemSeed; break;

                case VFXExpressionOperation.RGBtoHSV:    m_expressionOp = VFXExpressionOperation.LocalToWorld; break;

                case VFXExpressionOperation.HSVtoRGB:    m_expressionOp = VFXExpressionOperation.WorldToLocal; break;

                default:
                    Debug.LogWarning(string.Format("Expression operator for the BuiltInParameter is invalid ({0}). Reset to none", m_expressionOp));
                    m_expressionOp = VFXExpressionOperation.None;
                    break;
                }
            }

            if (outputSlots.Count > 0 && outputSlots[0].GetType() == typeof(Matrix4x4))
            {
                outputSlots[0].Detach(); // In order not to have a bad conversion
            }
            base.Sanitize();             // Will call ResyncSlots
        }
        protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
        {
            var expression = VFXBuiltInExpression.Find(m_expressionOp);

            if (expression == null)
            {
                return new VFXExpression[] {}
            }
            ;
            return(new VFXExpression[] { expression });
        }
        private Type GetOutputType()
        {
            switch (m_expressionOp)
            {
            case VFXExpressionOperation.LocalToWorld:
            case VFXExpressionOperation.WorldToLocal:
                return(typeof(Transform));

            default:
            {
                var exp = VFXBuiltInExpression.Find(m_expressionOp);
                if (exp != null)
                {
                    return(VFXExpression.TypeToType(VFXBuiltInExpression.Find(m_expressionOp).valueType));
                }
                return(null);
            }
            }
        }