|
|
|
|
|
|
PopupField<string> m_PopupField; |
|
|
|
string[] m_ValueNames; |
|
|
|
|
|
|
|
int m_PreviousChannelCount = -1; |
|
|
|
|
|
|
|
public ChannelEnumControlView(string label, int slotId, AbstractMaterialNode node, PropertyInfo propertyInfo) |
|
|
|
{ |
|
|
|
AddStyleSheetPath("Styles/Controls/ChannelEnumControlView"); |
|
|
|
|
|
|
|
|
|
|
void CreatePopup() |
|
|
|
{ |
|
|
|
int channelCount = SlotValueHelper.GetChannelCount(m_Node.FindSlot<MaterialSlot>(m_SlotId).concreteValueType); |
|
|
|
|
|
|
|
{ |
|
|
|
if(channelCount == m_PreviousChannelCount) |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
int channelCount = SlotValueHelper.GetChannelCount(m_Node.FindSlot<MaterialSlot>(m_SlotId).concreteValueType); |
|
|
|
m_PreviousChannelCount = channelCount; |
|
|
|
m_PopupField = new PopupField<string>(popupEntries, (int)m_PropertyInfo.GetValue(m_Node, null)); |
|
|
|
var value = (int)m_PropertyInfo.GetValue(m_Node, null); |
|
|
|
if(value >= channelCount) |
|
|
|
value = 0; |
|
|
|
|
|
|
|
m_PopupField = new PopupField<string>(popupEntries, value); |
|
|
|
m_PopupField.OnValueChanged(OnValueChanged); |
|
|
|
Add(m_PopupField); |
|
|
|
} |