本文整理汇总了C#中UnityEditor.MaterialEditor.TexturePropertySingleLine方法的典型用法代码示例。如果您正苦于以下问题:C# MaterialEditor.TexturePropertySingleLine方法的具体用法?C# MaterialEditor.TexturePropertySingleLine怎么用?C# MaterialEditor.TexturePropertySingleLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.MaterialEditor
的用法示例。
在下文中一共展示了MaterialEditor.TexturePropertySingleLine方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
// albedo
materialEditor.TexturePropertySingleLine(_albedoText, _mainTex, _color);
// metallic / smoothness
if (_metallicGlossMap.textureValue == null)
materialEditor.TexturePropertyTwoLines(_metallicText, _metallicGlossMap, _metallic, _smoothnessText, _glossiness);
else
materialEditor.TexturePropertySingleLine(_metallicText, _metallicGlossMap);
// normal map
materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, _bumpMap.textureValue != null ? _bumpScale : null);
// occlusion
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue != null ? _occlusionStrength : null);
// emission
bool hadEmissionTexture = _emissionMap.textureValue != null;
materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, _colorPickerHDRConfig, false);
// if texture was assigned and color was black set color to white
if (_emissionMap.textureValue != null && !hadEmissionTexture)
if (_emissionColor.colorValue.maxColorComponent <= 0)
_emissionColor.colorValue = Color.white;
return EditorGUI.EndChangeCheck();
}
示例2: DrawLayer
void DrawLayer(MaterialEditor editor, int i, MaterialProperty[] props, string[] keyWords, Workflow workflow,
bool hasGloss, bool hasSpec, bool isParallax, bool hasEmis, bool hasDistBlend)
{
EditorGUIUtility.labelWidth = 0f;
var albedoMap = FindProperty ("_Tex" + i, props);
var tint = FindProperty("_Tint" + i, props);
var normalMap = FindProperty ("_Normal" + i, props);
var smoothness = FindProperty("_Glossiness" + i, props);
var glossinessMap = FindProperty("_GlossinessTex" + i, props, false);
var metallic = FindProperty("_Metallic" + i, props, false);
var emissionTex = FindProperty("_Emissive" + i, props);
var emissionMult = FindProperty("_EmissiveMult" + i, props);
var parallax = FindProperty("_Parallax" + i, props);
var texScale = FindProperty("_TexScale" + i, props);
var specMap = FindProperty("_SpecGlossMap" + i, props, false);
var specColor = FindProperty("_SpecColor" + i, props, false);
var distUVScale = FindProperty("_DistUVScale" + i, props, false);
editor.TexturePropertySingleLine(new GUIContent("Albedo/Height"), albedoMap);
editor.ShaderProperty(tint, "Tint");
editor.TexturePropertySingleLine(new GUIContent("Normal"), normalMap);
if (workflow == Workflow.Metallic)
{
editor.TexturePropertySingleLine(new GUIContent("Metal(R)/Smoothness(A)"), glossinessMap);
}
else
{
editor.TexturePropertySingleLine(new GUIContent("Specular(RGB)/Gloss(A)"), specMap);
}
if (workflow == Workflow.Metallic && !hasGloss)
{
editor.ShaderProperty(smoothness, "Smoothness");
editor.ShaderProperty(metallic, "Metallic");
}
else if (workflow == Workflow.Specular && !hasSpec)
{
editor.ShaderProperty(smoothness, "Smoothness");
editor.ShaderProperty(specColor, "Specular Color");
}
editor.TexturePropertySingleLine(new GUIContent("Emission"), emissionTex);
editor.ShaderProperty(emissionMult, "Emissive Multiplier");
editor.ShaderProperty(texScale, "Texture Scale");
if (hasDistBlend)
{
editor.ShaderProperty(distUVScale, "Distance UV Scale");
}
if (isParallax)
{
editor.ShaderProperty(parallax, "Parallax Height");
}
if (i != 1)
{
editor.ShaderProperty(FindProperty("_Contrast"+i, props), "Interpolation Contrast");
}
}
示例3: OnGUI
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
{
FindProperties (props); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
// Use default labelWidth
EditorGUIUtility.labelWidth = 0f;
// Detect any changes to the material
EditorGUI.BeginChangeCheck();
{
GUILayout.Label (Styles.material0Header, EditorStyles.boldLabel);
// Texture
materialEditor.TexturePropertySingleLine (Styles.albedo, albedoMap);
materialEditor.TexturePropertySingleLine (Styles.specular, specularMap);
materialEditor.TexturePropertySingleLine (Styles.normal, bumpMap);
materialEditor.TextureScaleOffsetProperty (albedoMap);
GUILayout.Label (Styles.maskHeader, EditorStyles.boldLabel);
materialEditor.TexturePropertySingleLine (Styles.blendMask, blendMask);
materialEditor.TextureScaleOffsetProperty (blendMask);
GUILayout.Label (Styles.material1Header, EditorStyles.boldLabel);
materialEditor.TexturePropertySingleLine (Styles.albedo, albedoMap2);
materialEditor.TexturePropertySingleLine (Styles.specular, specularMap2);
materialEditor.TexturePropertySingleLine (Styles.normal, bumpMap2);
materialEditor.TextureScaleOffsetProperty (albedoMap2);
}
}
示例4: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.TexturePropertySingleLine(_textCubemap, _cubemap, _tint);
Vector3Property(materialEditor, _euler, "Rotation");
materialEditor.ShaderProperty(_exposure, "Exposure");
materialEditor.ShaderProperty(_saturation, "Saturation");
return EditorGUI.EndChangeCheck();
}
示例5: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.ShaderProperty(_colorMode, "Color Mode");
if (_colorMode.floatValue > 0)
{
var rect = EditorGUILayout.GetControlRect();
rect.x += EditorGUIUtility.labelWidth;
rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2;
materialEditor.ShaderProperty(rect, _color, "");
rect.x += rect.width + 4;
materialEditor.ShaderProperty(rect, _color2, "");
}
else
{
materialEditor.ShaderProperty(_color, " ");
}
EditorGUILayout.Space();
materialEditor.ShaderProperty(_metallic, "Metallic");
materialEditor.ShaderProperty(_smoothness, "Smoothness");
EditorGUILayout.Space();
materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, null);
materialEditor.TexturePropertySingleLine(_normalMapText, _normalMap, _normalMap.textureValue ? _normalScale : null);
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue ? _occlusionStr : null);
materialEditor.TextureScaleOffsetProperty(_albedoMap);
EditorGUILayout.Space();
materialEditor.ShaderProperty(_emission, "Emission");
EditorGUILayout.Space();
materialEditor.ShaderProperty(_randomUV, "Random UV");
return EditorGUI.EndChangeCheck();
}
示例6: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, _albedoColor);
materialEditor.ShaderProperty(_metallic, "Metallic");
materialEditor.ShaderProperty(_smoothness, "Smoothness");
EditorGUILayout.Space();
materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, null);
EditorGUILayout.Space();
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue ? _occlusionStrength : null);
EditorGUILayout.Space();
materialEditor.ShaderProperty(_mapScale, "Mapping Scale");
return EditorGUI.EndChangeCheck();
}
示例7: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.ShaderProperty(_color, "Color");
materialEditor.ShaderProperty(_metallic, "Metallic");
materialEditor.ShaderProperty(_smoothness, "Smoothness");
EditorGUILayout.Space();
materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, null);
var scale = _normalMap.textureValue ? _normalScale : null;
materialEditor.TexturePropertySingleLine(_normalMapText, _normalMap, scale);
var str = _occlusionMap.textureValue ? _occlusionStr : null;
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, str);
if (_albedoMap.textureValue || _normalMap.textureValue || _occlusionMap.textureValue)
materialEditor.ShaderProperty(_mapScale, "Scale");
return EditorGUI.EndChangeCheck();
}
示例8: DrawLayer
void DrawLayer(MaterialEditor editor, int i, MaterialProperty[] props, string[] keyWords, bool hasGloss, bool isParallax, bool hasEmis)
{
EditorGUIUtility.labelWidth = 0f;
var albedoMap = FindProperty ("_Tex" + i, props);
var normalMap = FindProperty ("_Normal" + i, props);
var smoothness = FindProperty("_Glossiness" + i, props);
var glossinessMap = FindProperty("_GlossinessTex" + i, props);
var metallic = FindProperty("_Metallic" + i, props);
var emissionTex = FindProperty("_Emissive" + i, props);
var emissionMult = FindProperty("_EmissiveMult" + i, props);
var parallax = FindProperty("_Parallax" + i, props);
var texScale = FindProperty("_TexScale" + i, props);
//editor.TexturePropertySingleLine("Albedo (RGB) Height (A)", albedoMap);
editor.TexturePropertySingleLine(new GUIContent("Albedo/Height"), albedoMap);
editor.TexturePropertySingleLine(new GUIContent("Normal"), normalMap);
editor.TexturePropertySingleLine(new GUIContent("Metal(R)/Smoothness(A)"), glossinessMap);
if (!hasGloss)
{
editor.ShaderProperty(smoothness, "Smoothness");
editor.ShaderProperty(metallic, "Metallic");
}
editor.TexturePropertySingleLine(new GUIContent("Emission"), emissionTex);
editor.ShaderProperty(emissionMult, "Emissive Multiplier");
editor.ShaderProperty(texScale, "Texture Scale");
if (isParallax)
{
editor.ShaderProperty(parallax, "Parallax Height");
}
if (i != 1)
{
editor.ShaderProperty(FindProperty("_Contrast"+i, props), "Interpolation Contrast");
}
}
示例9: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.TexturePropertySingleLine(_textCubemap, _cubemap, _tint);
Vector3Property(materialEditor, _euler, "Rotation");
materialEditor.ShaderProperty(_exposure, "Exposure");
materialEditor.ShaderProperty(_saturation, "Saturation");
materialEditor.ShaderProperty(_lod, "Specify MIP Level");
if (_lod.hasMixedValue || _lod.floatValue > 0)
{
EditorGUI.indentLevel++;
materialEditor.ShaderProperty(_lodLevel, "Level");
EditorGUI.indentLevel--;
}
return EditorGUI.EndChangeCheck();
}
示例10: ImmediateProperty
void ImmediateProperty(string name, MaterialEditor materialEditor, MaterialProperty[] props)
{
var p = FindProperty(name, props);
if (p.type == MaterialProperty.PropType.Texture)
materialEditor.TexturePropertySingleLine(new GUIContent(p.displayName), p);
else
materialEditor.ShaderProperty(p, p.displayName);
}
示例11: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.LabelField("Front-face properties", EditorStyles.boldLabel);
EditorGUILayout.Space();
// albedo
materialEditor.TexturePropertySingleLine(_albedoText, _mainTex, _color);
// metallic / smoothness
if (_metallicGlossMap.textureValue == null)
materialEditor.TexturePropertyTwoLines(_metallicText, _metallicGlossMap, _metallic, _smoothnessText, _glossiness);
else
materialEditor.TexturePropertySingleLine(_metallicText, _metallicGlossMap);
// normal map
materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, _bumpMap.textureValue != null ? _bumpScale : null);
// occlusion
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue != null ? _occlusionStrength : null);
// emission
bool hadEmissionTexture = _emissionMap.textureValue != null;
materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, _colorPickerHDRConfig, false);
// if texture was assigned and color was black set color to white
if (_emissionMap.textureValue != null && !hadEmissionTexture)
if (_emissionColor.colorValue.maxColorComponent <= 0)
_emissionColor.colorValue = Color.white;
EditorGUILayout.Space();
// backface properties
EditorGUILayout.LabelField("Back-face properties", EditorStyles.boldLabel);
EditorGUILayout.Space();
materialEditor.ShaderProperty(_backColor, "Color");
materialEditor.ShaderProperty(_backMetallic, "Matallic");
materialEditor.ShaderProperty(_backGlossiness, "Smoothness");
return EditorGUI.EndChangeCheck();
}
示例12: ImmediateProperty
bool ImmediateProperty(string name, MaterialEditor materialEditor, MaterialProperty[] props)
{
EditorGUI.BeginChangeCheck();
var p = FindProperty(name, props);
if(p.type == MaterialProperty.PropType.Texture)
materialEditor.TexturePropertySingleLine(new GUIContent(p.displayName), p);
else
materialEditor.ShaderProperty(p, p.displayName);
return EditorGUI.EndChangeCheck();
}