private readonly BaseProperty [ ] m_ChildProperties ;
public bool Foldout = false ;
public GroupProperty ( BaseMaterialGUI parent , BaseProperty [ ] childProperties , Func < object , bool > isVisible = null )
: this ( parent , string . Empty , childProperties , isVisible )
{
{
if ( ! string . IsNullOrEmpty ( m_Title ) )
{
EditorGUILayout . LabelField ( m_Title , EditorStyles . boldLabel ) ;
EditorGUI . indentLevel + + ;
Foldout = EditorGUILayout . Foldout ( Foldout , m_Title ) ;
foreach ( var c in m_ChildProperties )
else
c . OnGUI ( ) ;
Foldout = true ;
if ( ! string . IsNullOrEmpty ( m_Title ) )
if ( Foldout )
EditorGUI . indentLevel + + ;
foreach ( var c in m_ChildProperties )
{
c . OnGUI ( ) ;
}
EditorGUI . indentLevel - - ;
}
}
A ,
}
public enum UVSet
public enum UVMapping
{
UV0 ,
UV1 ,
public TextureOneLineProperty m_TextureProperty ;
public ComboProperty m_ChannelProperty ;
public ComboProperty m_UvSetProperty ;
public Property m_LocalOrWorldProperty ;
public ComboProperty m_UvSetProperty ;
public Property m_LocalOrWorldProperty ;
public Property m_ChannelProperty ;
public bool Foldout = false ;
public TextureProperty ( BaseMaterialGUI parent , string propertyName , string constantPropertyName , string guiText , bool isMandatory = true , bool isNormalMap = false )
: this ( parent , propertyName , constantPropertyName , guiText , string . Empty , isMandatory , isNormalMap )
{
m_TextureProperty = new TextureOneLineProperty ( parent , propertyName , constantPropertyName , guiText , toolTip , isMandatory ) ;
m_Channel Property = new ComboProperty ( parent , propertyName + "Channel" , "Channel " , Enum . GetNames ( typeof ( Channel ) ) , false ) ;
m_UvSet Property = new ComboProperty ( parent , propertyName + "UV" , "UV Mapping " , Enum . GetNames ( typeof ( UVMapping ) ) , false ) ;
m_LocalOrWorldProperty = new Property ( parent , propertyName + "LocalOrWorld" , "Local Space" , "Whether Planar or Triplanar is using Local or World space." , false ) ;
m_UvSetProperty = new ComboProperty ( parent , propertyName + "UV" , "UV Set" , Enum . GetNames ( typeof ( UVSet ) ) , false ) ;
m_LocalOrWorld Property = new Property ( parent , propertyName + "LocalOrWorld" , "Local Space" , "Whether Planar or Triplanar is using Local or World space. " , false ) ;
m_Channel Property = new Property ( parent , propertyName + "Channel" , "Channel " , false ) ;
m_RemapProperty = new Property ( parent , constantPropertyName + "Remap" , "Remapping" , "Defines the range to remap/scale the values in texture" , false ) ;
m_InvertRemapProperty = new Property ( parent , constantPropertyName + "RemapInverted" , "Invert Remapping" , "Whether the mapping values are inverted." , false ) ;
base . OnFindProperty ( props ) ;
m_TextureProperty . OnFindProperty ( props ) ;
m_TilingProperty . OnFindProperty ( props ) ;
m_TilingProperty . OnFindProperty ( props ) ;
m_ChannelProperty . OnFindProperty ( props ) ;
m_RemapProperty . OnFindProperty ( props ) ;
m_InvertRemapProperty . OnFindProperty ( props ) ;
}
if ( m_TextureProperty . IsValid
& & ( IsVisible = = null | | IsVisible ( this ) ) )
{
m_TextureProperty . OnGUI ( ) ;
if ( m_TextureProperty . TextureValue ! = null )
Foldout = EditorGUILayout . Foldout ( Foldout , PropertyText ) ;
if ( Foldout )
m_TilingProperty . OnGUI ( ) ;
m_UvSetProperty . OnGUI ( ) ;
m_LocalOrWorldProperty . OnGUI ( ) ;
m_TextureProperty . OnGUI ( ) ;
if ( m_RemapProperty . IsValid )
if ( m_TextureProperty . TextureValue ! = null )
// Display the remap of texture values.
Vector2 remap = m_RemapProperty . VectorValue ;
EditorGUI . BeginChangeCheck ( ) ;
EditorGUILayout . MinMaxSlider ( m_RemapProperty . PropertyText , ref remap . x , ref remap . y , 0.0f , 1.0f ) ;
if ( EditorGUI . EndChangeCheck ( ) )
m_UvSetProperty . OnGUI ( ) ;
m_LocalOrWorldProperty . OnGUI ( ) ;
m_TilingProperty . OnGUI ( ) ;
m_ChannelProperty . OnGUI ( ) ;
m_LocalOrWorldProperty . OnGUI ( ) ;
if ( m_RemapProperty . IsValid )
m_RemapProperty . VectorValue = remap ;
}
// Display the remap of texture values.
Vector2 remap = m_RemapProperty . VectorValue ;
EditorGUI . BeginChangeCheck ( ) ;
EditorGUILayout . MinMaxSlider ( m_RemapProperty . PropertyText , ref remap . x , ref remap . y ,
0.0f , 1.0f ) ;
if ( EditorGUI . EndChangeCheck ( ) )
{
m_RemapProperty . VectorValue = remap ;
}
m_InvertRemapProperty . OnGUI ( ) ;
m_InvertRemapProperty . OnGUI ( ) ;
}
}
EditorGUI . indentLevel - - ;