void PatchInputExpressions()
        {
            if (m_SubChildren == null)
            {
                return;
            }

            var toInvalidate = new HashSet <VFXSlot>();

            var inputExpressions = new List <VFXExpression>();

            foreach (var slot in inputSlots)
            {
                var expression = slot.GetExpression();
                if (expression == null)
                {
                    foreach (var subSlot in inputSlots.SelectMany(t => t.GetExpressionSlots()))
                    {
                        inputExpressions.Add(subSlot.GetExpression());
                    }
                }
                else
                {
                    inputExpressions.Add(expression);
                }
            }

            VFXSubgraphUtility.TransferExpressionToParameters(inputExpressions, GetParameters(t => VFXSubgraphUtility.InputPredicate(t)));
            foreach (var slot in toInvalidate)
            {
                slot.InvalidateExpressionTree();
            }
        }
        protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
        {
            if (subgraph == null)
            {
                return(new VFXExpression[0]);
            }

            if (m_SubChildren == null)
            {
                RecreateCopy();
            }

            // Change all the inputExpressions of the parameters.
            var parameters = GetParameters(t => VFXSubgraphUtility.InputPredicate(t)).OrderBy(t => t.order);

            var backedUpExpressions = new List <VFXExpression>();

            VFXSubgraphUtility.TransferExpressionToParameters(inputExpression, parameters, backedUpExpressions);

            List <VFXExpression> outputExpressions = new List <VFXExpression>();

            foreach (var param in GetParameters(t => VFXSubgraphUtility.OutputPredicate(t)))
            {
                outputExpressions.AddRange(param.inputSlots[0].GetExpressionSlots().Select(t => t.GetExpression()));
            }

            foreach (var param in parameters)
            {
                param.ResetOutputValueExpression();
            }

            VFXSubgraphUtility.TransferExpressionToParameters(backedUpExpressions, parameters);

            return(outputExpressions.ToArray());
        }
示例#3
0
        protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
        {
            if (m_Subgraph == null)
            {
                return(new VFXExpression[0]);
            }
            VFXGraph graph = m_Subgraph.GetResource().GetOrCreateGraph();

            // Change all the inputExpressions of the parameters.
            var parameters = GetParameters(t => VFXSubgraphUtility.InputPredicate(t));

            VFXSubgraphUtility.TransferExpressionToParameters(inputExpression, parameters);

            List <VFXExpression> outputExpressions = new List <VFXExpression>();

            foreach (var param in GetParameters(t => VFXSubgraphUtility.OutputPredicate(t)))
            {
                outputExpressions.AddRange(param.inputSlots[0].GetVFXValueTypeSlots().Select(t => t.GetExpression()));
            }

            foreach (var param in GetParameters(t => VFXSubgraphUtility.InputPredicate(t)))
            {
                param.ResetOutputValueExpression();
            }

            return(outputExpressions.ToArray());
        }
        public void PatchInputExpressions()
        {
            if (m_SubChildren == null)
            {
                return;
            }

            var inputExpressions = new List <VFXExpression>();

            foreach (var slot in inputSlots.SelectMany(t => t.GetExpressionSlots()))
            {
                inputExpressions.Add(slot.GetExpression());
            }

            VFXSubgraphUtility.TransferExpressionToParameters(inputExpressions, GetParameters(t => VFXSubgraphUtility.InputPredicate(t)).OrderBy(t => t.order));
        }