public static VFXPropertyWithValue GetPropertyFromInputParameter(VFXParameter param) { List <object> attributes = new List <object>(); if (!string.IsNullOrEmpty(param.tooltip)) { attributes.Add(new TooltipAttribute(param.tooltip)); } if (param.hasRange) { attributes.Add(new RangeAttribute((float)VFXConverter.ConvertTo(param.m_Min.Get(), typeof(float)), (float)VFXConverter.ConvertTo(param.m_Max.Get(), typeof(float)))); } return(new VFXPropertyWithValue(new VFXProperty(param.type, param.exposedName, attributes.ToArray()), param.value)); }
public static VFXPropertyWithValue GetPropertyFromInputParameter(VFXParameter param) { List <object> attributes = new List <object>(); if (!string.IsNullOrEmpty(param.tooltip)) { attributes.Add(new TooltipAttribute(param.tooltip)); } if (param.valueFilter == VFXValueFilter.Range) { attributes.Add(new RangeAttribute((float)VFXConverter.ConvertTo(param.min, typeof(float)), (float)VFXConverter.ConvertTo(param.max, typeof(float)))); } else if (param.valueFilter == VFXValueFilter.Enum) { attributes.Add(new EnumAttribute(param.enumValues.ToArray())); } return(new VFXPropertyWithValue(new VFXProperty(param.type, param.exposedName, attributes.ToArray()), param.value)); }
public static object GetSGPropertyValue(AbstractShaderProperty property) { switch (property.propertyType) { case PropertyType.Texture2D: return(((Texture2DShaderProperty)property).value.texture); case PropertyType.Texture3D: return(((Texture3DShaderProperty)property).value.texture); case PropertyType.Cubemap: return(((CubemapShaderProperty)property).value.cubemap); case PropertyType.Texture2DArray: return(((Texture2DArrayShaderProperty)property).value.textureArray); default: { var type = GetSGPropertyType(property); PropertyInfo info = property.GetType().GetProperty("value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy); return(VFXConverter.ConvertTo(info?.GetValue(property), type)); } } }