public MaterialExpressionTransform(string name, int editorX, int editorY, ParsedPropertyBag input, MaterialVectorCoordTransformSource transformSourceType, MaterialVectorCoordTransform transformType)
     : base(name, editorX, editorY)
 {
     Input = input;
     TransformSourceType = transformSourceType;
     TransformType       = transformType;
 }
Esempio n. 2
0
        private string FindNameFromParameterInfo(ParsedPropertyBag parameter)
        {
            // FIXME: this should be handled by the parser
            var tmpBag = ValueUtil.ParseAttributeList(parameter.FindPropertyValue("ParameterInfo"));

            return(tmpBag.FindPropertyValue("Name"));
        }
Esempio n. 3
0
        private bool ValidateProperties(ParsedNode node, ParsedPropertyBag propertyBag, PropertyDefinition[] propertyDefinitions, string[] ignoredPropertyNames, DocumentProcessorState state)
        {
            bool presenceValidationResult = ValidatePresenceOfProperties(node.FindAttributeValue("Name"), propertyBag, propertyDefinitions, ignoredPropertyNames, state);
            bool valueValidationResult    = ValidatePropertiesValues(node.FindAttributeValue("Name"), propertyBag, propertyDefinitions, state);

            return(presenceValidationResult && valueValidationResult);
        }
Esempio n. 4
0
 public MaterialExpressionSceneTexture(string name, int editorX, int editorY, ParsedPropertyBag coordinates, SceneTextureId sceneTextureId, bool bFiltered)
     : base(name, editorX, editorY)
 {
     Coordinates    = coordinates;
     SceneTextureId = sceneTextureId;
     Filtered       = bFiltered;
 }
Esempio n. 5
0
 public Material(string name, int editorX, int editorY, Node[] children, ParsedPropertyBag ambientOcclusion, ShadingModel shadingModel, BlendMode blendMode, DecalBlendMode decalBlendMode, MaterialDomain materialDomain, TranslucencyLightingMode translucencyLightingMode, bool isTwoSided, ParsedPropertyBag baseColor, ParsedPropertyBag metallic, ParsedPropertyBag normal, ParsedPropertyBag refraction, ParsedPropertyBag roughness, ParsedPropertyBag specular, ParsedPropertyBag emissiveColor, ParsedPropertyBag opacity, ParsedPropertyBag opacityMask, float opacityMaskClipValue, ExpressionReference[] expressionReferences, ExpressionReference[] editorComments, int textureStreamingDataVersion, ParsedPropertyBag[] textureStreamingData, bool ditherOpacityMask)
     : base(name, editorX, editorY, children)
 {
     AmbientOcclusion         = ambientOcclusion;
     ShadingModel             = shadingModel;
     BlendMode                = blendMode;
     DecalBlendMode           = decalBlendMode;
     MaterialDomain           = materialDomain;
     TranslucencyLightingMode = translucencyLightingMode;
     IsTwoSided               = isTwoSided;
     BaseColor                = baseColor;
     Metallic                    = metallic;
     Normal                      = normal;
     Refraction                  = refraction;
     Roughness                   = roughness;
     Specular                    = specular;
     EmissiveColor               = emissiveColor;
     Opacity                     = opacity;
     OpacityMask                 = opacityMask;
     OpacityMaskClipValue        = opacityMaskClipValue;
     Expressions                 = expressionReferences;
     EditorComments              = editorComments;
     TextureStreamingDataVersion = textureStreamingDataVersion;
     TextureStreamingData        = textureStreamingData;
     DitherOpacityMask           = ditherOpacityMask;
 }
 public MaterialExpressionTextureSampleParameter2D(string name, int editorX, int editorY, string parameterName, ParsedPropertyBag coordinates, ResourceReference texture, SamplerType samplerType)
     : base(name, editorX, editorY, parameterName, null)
 {
     Coordinates = coordinates;
     Texture     = texture;
     SamplerType = samplerType;
 }
Esempio n. 7
0
 public MaterialExpressionSceneDepth(string name, int editorX, int editorY, MaterialSceneAttributeInputMode inputMode, ParsedPropertyBag input, Vector2 constInput)
     : base(name, editorX, editorY)
 {
     InputMode  = inputMode;
     Input      = input;
     ConstInput = constInput;
 }
 public MaterialExpressionDesaturation(string name, int editorX, int editorY, bool collapsed, ParsedPropertyBag input, ParsedPropertyBag fraction)
     : base(name, editorX, editorY)
 {
     Collapsed = collapsed;
     Input     = input;
     Fraction  = fraction;
 }
Esempio n. 9
0
 public MaterialExpressionTextureSample(string name, int editorX, int editorY, ParsedPropertyBag coordinates, ResourceReference texture, ParsedPropertyBag textureObject, SamplerType samplerType)
     : base(name, editorX, editorY)
 {
     Coordinates   = coordinates;
     Texture       = texture;
     TextureObject = textureObject;
     SamplerType   = samplerType;
 }
Esempio n. 10
0
 public MaterialExpressionSubtract(string name, int editorX, int editorY, ParsedPropertyBag a, ParsedPropertyBag b, float constA, float constB)
     : base(name, editorX, editorY)
 {
     A      = a;
     B      = b;
     ConstA = constA;
     ConstB = constB;
 }
 public MaterialExpressionPower(string name, int editorX, int editorY, bool collapsed, ParsedPropertyBag value, ParsedPropertyBag exponent, float constExponent)
     : base(name, editorX, editorY)
 {
     Collapsed     = collapsed;
     Value         = value;
     Exponent      = exponent;
     ConstExponent = constExponent;
 }
 public MaterialExpressionMultiply(string name, int editorX, int editorY, bool collapsed, ParsedPropertyBag a, ParsedPropertyBag b, float constA, float constB)
     : base(name, editorX, editorY)
 {
     Collapsed = collapsed;
     A         = a;
     B         = b;
     ConstA    = constA;
     ConstB    = constB;
 }
 public MaterialExpressionClamp(string name, int editorX, int editorY, ParsedPropertyBag input, ParsedPropertyBag min, ParsedPropertyBag max, float minDefault, float maxDefault)
     : base(name, editorX, editorY)
 {
     Input      = input;
     Min        = min;
     MinDefault = minDefault;
     Max        = max;
     MaxDefault = maxDefault;
 }
 public MaterialExpressionRotateAboutAxis(string name, int editorX, int editorY, ParsedPropertyBag normalizedRotationAxis, ParsedPropertyBag rotationAngle, ParsedPropertyBag pivotPoint, ParsedPropertyBag position, float period)
     : base(name, editorX, editorY)
 {
     NormalizedRotationAxis = normalizedRotationAxis;
     RotationAngle          = rotationAngle;
     PivotPoint             = pivotPoint;
     Position = position;
     Period   = period;
 }
Esempio n. 15
0
 public MaterialExpressionFresnel(string name, int editorX, int editorY, ParsedPropertyBag baseReflectFractionIn, float baseReflectFraction, ParsedPropertyBag exponentIn, float exponent, ParsedPropertyBag power, ParsedPropertyBag normal)
     : base(name, editorX, editorY)
 {
     BaseReflectFractionIn = baseReflectFractionIn;
     BaseReflectFraction   = baseReflectFraction;
     ExponentIn            = exponentIn;
     Exponent = exponent;
     Power    = power;
     Normal   = normal;
 }
 public MaterialExpressionPanner(string name, int editorX, int editorY, ParsedPropertyBag speed, ParsedPropertyBag coordinate, ParsedPropertyBag time, float speedX, float speedY, int constCoordinate, bool fractionalPart)
     : base(name, editorX, editorY)
 {
     Speed           = speed;
     Coordinate      = coordinate;
     Time            = time;
     SpeedX          = speedX;
     SpeedY          = speedY;
     ConstCoordinate = constCoordinate;
     FractionalPart  = fractionalPart;
 }
 public MaterialExpressionLinearInterpolate(string name, int editorX, int editorY, bool collapsed, ParsedPropertyBag a, ParsedPropertyBag b, ParsedPropertyBag alpha, float constA, float constB, float constAlpha)
     : base(name, editorX, editorY)
 {
     Collapsed  = collapsed;
     A          = a;
     B          = b;
     Alpha      = alpha;
     ConstA     = constA;
     ConstB     = constB;
     ConstAlpha = constAlpha;
 }
Esempio n. 18
0
        public void Connect(ParsedPropertyBag propertyBag, string toUnrealNodeName, int toSlotId)
        {
            if (null == propertyBag)
            {
                return;
            }

            if (!propertyBag.HasProperty("Expression"))
            {
                return;
            }

            var expressionValue = propertyBag.FindPropertyValue("Expression");
            var expression      = ValueUtil.ParseExpressionReference(expressionValue);

            Connect(expression.NodeName, toUnrealNodeName, toSlotId, propertyBag);
        }
Esempio n. 19
0
        private bool ValidatePresenceOfProperties(string nodeName, ParsedPropertyBag propertyBag, PropertyDefinition[] propertyDefinitions, string[] ignoredPropertyNames, DocumentProcessorState state)
        {
            IEnumerable <string> providedKeys        = propertyBag.Properties.Select(property => property.Name);
            IEnumerable <string> allDefinedKeys      = propertyDefinitions.Select(property => property.Name);
            IEnumerable <string> requiredDefinedKeys = propertyDefinitions.Where(attribute => attribute.IsRequired).Select(property => property.Name);

            string[] missingPropertiesInMaterial = providedKeys.Except(allDefinedKeys).ToList().Except(ignoredPropertyNames).ToArray();
            string[] missingRequiredProperties   = requiredDefinedKeys.Except(providedKeys).ToArray();

            foreach (string s in missingPropertiesInMaterial)
            {
                state.AddWarning("Unknown property found (property={0}, node={1})", s, nodeName);
            }

            foreach (string s in missingRequiredProperties)
            {
                state.AddError("Required property is missing (property={0}, node={1})", s, nodeName);
            }

            return(missingRequiredProperties.Length == 0);
        }
Esempio n. 20
0
        private bool ValidatePropertiesValues(string nodeName, ParsedPropertyBag propertyBag, PropertyDefinition[] propertyDefinitions, DocumentProcessorState state)
        {
            bool hasProblems = false;

            foreach (PropertyDefinition propertyDefinition in propertyDefinitions)
            {
                ParsedProperty parsedProperty = propertyBag.FindProperty(propertyDefinition.Name);

                if (null == parsedProperty)
                {
                    continue;
                }

                if (!ValidatePropertyValue(nodeName, parsedProperty, propertyDefinition, state))
                {
                    hasProblems = true;
                }
            }

            return(!hasProblems);
        }
Esempio n. 21
0
 public MaterialExpressionDDY(string name, int editorX, int editorY, ParsedPropertyBag value)
     : base(name, editorX, editorY)
 {
     Value = value;
 }
 public override int GetConnectionSlotId(AbstractMaterialNode from, AbstractMaterialNode to, int toSlotId, ParsedPropertyBag propertyBag)
 {
     return(1);
 }
 public MaterialExpressionFloor(string name, int editorX, int editorY, ParsedPropertyBag input)
     : base(name, editorX, editorY)
 {
     Input = input;
 }
Esempio n. 24
0
 public override int GetConnectionSlotId(AbstractMaterialNode from, AbstractMaterialNode to, int toSlotId, ParsedPropertyBag propertyBag)
 {
     return(SampleTexture2DNode.OutputSlotRGBAId);
 }
 public MaterialExpressionStaticSwitchParameter(string name, int editorX, int editorY, string parameterName, bool defaultValue, ParsedPropertyBag a, ParsedPropertyBag b)
     : base(name, editorX, editorY, parameterName, defaultValue)
 {
     A = a;
     B = b;
 }
Esempio n. 26
0
        public int FindSlotId(string fromUnrealName, string toUnrealName, int toSlotId, ParsedPropertyBag propertyBag)
        {
            var fromUnrealNode = _unrealMaterial.FindChildByName(fromUnrealName);
            var fromNode       = FindNodeByUnrealName(fromUnrealName);
            var toNode         = FindNodeByUnrealName(toUnrealName);

            if (fromUnrealNode == null || fromNode == null || toNode == null)
            {
                return(-1);
            }

            foreach (var converter in _nodeConverters)
            {
                if (converter.CanConvert(fromUnrealNode))
                {
                    return(converter.GetConnectionSlotId(fromNode, toNode, toSlotId, propertyBag));
                }
            }

            return(-1);
        }
Esempio n. 27
0
        public T FindSlot <T>(string fromUnrealName, string toUnrealName, int toSlotId, ParsedPropertyBag propertyBag)
            where T : ISlot
        {
            var slotId   = FindSlotId(fromUnrealName, toUnrealName, toSlotId, propertyBag);
            var fromNode = FindNodeByUnrealName(fromUnrealName);

            if (slotId == -1)
            {
                return(default);
Esempio n. 28
0
 public MaterialExpressionDotProduct(string name, int editorX, int editorY, ParsedPropertyBag a, ParsedPropertyBag b)
     : base(name, editorX, editorY)
 {
     A = a;
     B = b;
 }
        public override int GetConnectionSlotId(AbstractMaterialNode from, AbstractMaterialNode to, int toSlotId, ParsedPropertyBag propertyBag)
        {
            var toSlot = to.FindInputSlot <MaterialSlot>(toSlotId);

            if (toSlot.concreteValueType == ConcreteSlotValueType.Vector1 || toSlot.concreteValueType == ConcreteSlotValueType.Vector2)
            {
                return(6);
            }
            else if (toSlot.concreteValueType == ConcreteSlotValueType.Vector3)
            {
                return(5);
            }
            else if (toSlot.concreteValueType == ConcreteSlotValueType.Vector4)
            {
                return(4);
            }

            throw new System.Exception("FIXME: unhandled vector type");
        }
 public MaterialExpressionAppendVector(string name, int editorX, int editorY, ParsedPropertyBag a, ParsedPropertyBag b)
     : base(name, editorX, editorY)
 {
     A = a;
     B = b;
 }