Ejemplo n.º 1
0
        public string GetSlotValue(int inputSlotId, GenerationMode generationMode)
        {
            var inputSlot = FindSlot <MaterialSlot>(inputSlotId);

            if (inputSlot == null)
            {
                return(string.Empty);
            }

            var edges = owner.GetEdges(inputSlot.slotReference).ToArray();

            if (edges.Any())
            {
                var fromSocketRef = edges[0].outputSlot;
                var fromNode      = owner.GetNodeFromGuid <AbstractMaterialNode>(fromSocketRef.nodeGuid);
                if (fromNode == null)
                {
                    return(string.Empty);
                }

                var slot = fromNode.FindOutputSlot <MaterialSlot>(fromSocketRef.slotId);
                if (slot == null)
                {
                    return(string.Empty);
                }

                return(ShaderGenerator.AdaptNodeOutput(fromNode, slot.id, inputSlot.concreteValueType));
            }

            return(inputSlot.GetDefaultValue(generationMode));
        }