switch (slotValue)
{
case ConcreteSlotValueType.Texture2D:
return PropertyType.Texture;
return PropertyType.Texture2D;
case ConcreteSlotValueType.Texture2DArray:
return PropertyType.Texture2DArray;
case ConcreteSlotValueType.Texture3D:
get
if (propType != PropertyType.Texture && propType != PropertyType.Texture2DArray && propType != PropertyType.Texture3D)
throw new ArgumentException(string.Format(k_GetErrorMessage, PropertyType.Texture, propType));
if (propType != PropertyType.Texture2D && propType != PropertyType.Texture2DArray && propType != PropertyType.Texture3D)
throw new ArgumentException(string.Format(k_GetErrorMessage, PropertyType.Texture2D, propType));
throw new ArgumentException(string.Format(k_SetErrorMessage, PropertyType.Texture, propType));
throw new ArgumentException(string.Format(k_SetErrorMessage, PropertyType.Texture2D, propType));
m_Data.textureValue = value;
}
set
if (propType != PropertyType.Vector2 && propType != PropertyType.Vector3 && propType != PropertyType.Vector4
&& propType != PropertyType.Matrix2 && propType != PropertyType.Matrix3 && propType != PropertyType.Matrix4)
throw new ArgumentException(string.Format(k_SetErrorMessage, PropertyType.Vector4, propType));
m_Data.vector4Value = value;
public void SetMaterialPropertyBlockValue(MaterialPropertyBlock block)
if ((propType == PropertyType.Texture || propType == PropertyType.Texture2DArray || propType == PropertyType.Texture3D) && textureValue != null)
if ((propType == PropertyType.Texture2D || propType == PropertyType.Texture2DArray || propType == PropertyType.Texture3D) && textureValue != null)
block.SetTexture(name, m_Data.textureValue);
else if (propType == PropertyType.Cubemap && cubemapValue != null)
block.SetTexture(name, m_Data.cubemapValue);
public override PreviewProperty GetPreviewMaterialProperty()
return new PreviewProperty(PropertyType.Texture)
return new PreviewProperty(PropertyType.Texture2D)
name = referenceName,
textureValue = value.textureArray
public override void GetPreviewProperties(List<PreviewProperty> properties, string name)
var pp = new PreviewProperty(PropertyType.Texture)
var pp = new PreviewProperty(PropertyType.Texture2D)
name = name,
textureValue = texture,
public override PropertyType propertyType
get { return PropertyType.Texture; }
get { return PropertyType.Texture2D; }
public bool modifiable
textureValue = value.texture
public override void CollectPreviewMaterialProperties(List<PreviewProperty> properties)
properties.Add(new PreviewProperty(PropertyType.Texture)
properties.Add(new PreviewProperty(PropertyType.Texture2D)
name = GetVariableNameForSlot(OutputSlotId),
textureValue = texture
public enum PropertyType
Color,
Texture,
Texture2D,
Texture2DArray,
Texture3D,
Cubemap,
case PropertyType.Color:
slotType = SlotValueType.Vector4;
break;
case PropertyType.Texture:
case PropertyType.Texture2D:
slotType = SlotValueType.Texture2D;
case PropertyType.Texture2DArray:
var id = prop.guid.GetHashCode();
MaterialSlot slot = MaterialSlot.CreateMaterialSlot(slotType, id, prop.displayName, prop.referenceName, SlotType.Input, prop.defaultValue, ShaderStageCapability.Fragment);
// copy default for texture for niceness
if (slotType == SlotValueType.Texture2D && propType == PropertyType.Texture)
if (slotType == SlotValueType.Texture2D && propType == PropertyType.Texture2D)
var tSlot = slot as Texture2DInputMaterialSlot;
var tProp = prop as TextureShaderProperty;