本文整理汇总了C#中UnityEditor.MaterialEditor.TexturePropertyMiniThumbnail方法的典型用法代码示例。如果您正苦于以下问题:C# MaterialEditor.TexturePropertyMiniThumbnail方法的具体用法?C# MaterialEditor.TexturePropertyMiniThumbnail怎么用?C# MaterialEditor.TexturePropertyMiniThumbnail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.MaterialEditor
的用法示例。
在下文中一共展示了MaterialEditor.TexturePropertyMiniThumbnail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
override public void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) {
//Debug.Log("OnGUI: " + label + " RTP_MaterialProp");
if (!parsed)
{
parsed = true;
parsedLabel = RTP_MatPropStringParser.Parse(label);
}
label = parsedLabel;
if (editor is RTP_CustomShaderGUI)
{
RTP_CustomShaderGUI customEditor = editor as RTP_CustomShaderGUI;
if (customEditor.showFlag && (show_for_active_layer == -1 || customEditor.active_layer == show_for_active_layer) && prop.name!= "dummy_end") {
EditorGUI.BeginDisabledGroup(customEditor.inactiveFlag);
switch (prop.type)
{
//case MaterialProperty.PropType.Range: // float ranges
// {
// editor.RangeProperty(position, prop, label);
// break;
// }
//case MaterialProperty.PropType.Float: // floats
// {
// editor.FloatProperty(position, prop, label);
// break;
// }
case MaterialProperty.PropType.Color: // colors
{
EditorGUIUtility.labelWidth -= 30;
if (noAlphaFlag)
{
EditorGUI.ColorField(position, new GUIContent(label, ""), prop.colorValue, true, false, false, null);
}
else
{
editor.ColorProperty(position, prop, label);
}
break;
}
case MaterialProperty.PropType.Texture: // textures
{
EditorGUI.BeginChangeCheck();
if (miniThumbFlag)
{
editor.TexturePropertyMiniThumbnail(position, prop, label,"");
} else
{
editor.TextureProperty(position, prop, label, !noTileOffsetFlag);
}
if (EditorGUI.EndChangeCheck() && prop.textureValue!=null && sharedTextures!=null)
{
for(int j=0; j<sharedTextures.Length; j++)
{
foreach(Material mat in editor.targets)
{
if (mat.HasProperty(sharedTextures[j]))
{
mat.SetTexture(sharedTextures[j], prop.textureValue);
}
}
}
}
break;
}
case MaterialProperty.PropType.Vector: // vectors
{
if (byLayerFlag)
{
//
// affect single vector component depending on active layer
//
int layerNum = customEditor.active_layer;
float pval = prop.vectorValue[layerNum];
float nval;
if (minVal == maxVal)
{
// float
EditorGUIUtility.labelWidth -= 23;
nval = EditorGUI.FloatField(position, label, pval);
}
else
{
// slider
EditorGUIUtility.labelWidth = 160;
nval = EditorGUI.Slider(position, label, pval, minVal, maxVal);
}
if (pval!=nval)
{
for(int i=0; i< prop.targets.Length; i++)
{
Material mat = (prop.targets[i] as Material);
Vector4 vec = mat.GetVector(prop.name);
vec[layerNum] = nval;
mat.SetVector(prop.name, vec);
}
}
//.........这里部分代码省略.........