public void Draw(UndoParentNode owner, GUIStyle toolbarstyle, bool customBlendAvailable) { Color cachedColor = GUI.color; GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, 0.5f); EditorGUILayout.BeginHorizontal(toolbarstyle); GUI.color = cachedColor; EditorGUI.BeginChangeCheck(); m_parentSurface.ContainerGraph.ParentWindow.ExpandedDepth = owner.GUILayoutToggle(m_parentSurface.ContainerGraph.ParentWindow.ExpandedDepth, DepthParametersStr, UIUtils.MenuItemToggleStyle); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("ExpandedDepth", m_parentSurface.ContainerGraph.ParentWindow.ExpandedDepth); } EditorGUILayout.EndHorizontal(); if (m_parentSurface.ContainerGraph.ParentWindow.ExpandedDepth) { cachedColor = GUI.color; GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, (EditorGUIUtility.isProSkin ? 0.5f : 0.25f)); EditorGUILayout.BeginVertical(UIUtils.MenuItemBackgroundStyle); GUI.color = cachedColor; EditorGUI.indentLevel++; if (!customBlendAvailable) { EditorGUILayout.HelpBox("Depth Writing is only available for Opaque or Custom blend modes", MessageType.Warning); } EditorGUILayout.Separator(); EditorGUI.BeginDisabledGroup(!customBlendAvailable); m_zWriteMode = owner.EditorGUILayoutPopup(ZWriteModeStr, m_zWriteMode, ZWriteModeValues); m_zTestMode = owner.EditorGUILayoutPopup(ZTestModeStr, m_zTestMode, ZTestModeLabels); m_offsetEnabled = owner.EditorGUILayoutToggle(OffsetStr, m_offsetEnabled); if (m_offsetEnabled) { EditorGUI.indentLevel++; m_offsetFactor = owner.EditorGUILayoutFloatField(OffsetFactorStr, m_offsetFactor); m_offsetUnits = owner.EditorGUILayoutFloatField(OffsetUnitsStr, m_offsetUnits); EditorGUI.indentLevel--; } m_extraDepthPass = owner.EditorGUILayoutToggle(ExtraDepthPassStr, m_extraDepthPass); if (m_extraDepthPass) { EditorGUI.indentLevel++; m_extrazTestMode = owner.EditorGUILayoutPopup(DepthZTestStr, m_extrazTestMode, ZTestModeLabels); EditorGUI.indentLevel--; } EditorGUILayout.Separator(); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); } EditorGUI.EndDisabledGroup(); }
public void Draw(UndoParentNode owner) { if (m_isVisible) { EditorGUI.BeginChangeCheck(); switch (m_options.UIWidget) { case AseOptionsUIWidget.Dropdown: { m_currentOption = owner.EditorGUILayoutPopup(m_options.Name, m_currentOption, m_options.Options); } break; case AseOptionsUIWidget.Toggle: { m_currentOption = owner.EditorGUILayoutToggle(m_options.Name, m_currentOption == 1) ? 1 : 0; } break; } if (EditorGUI.EndChangeCheck()) { if (OnActionPerformedEvt != null) { OnActionPerformedEvt(this, m_options.ActionsPerOption[m_currentOption]); } } } }
public void Draw( UndoParentNode owner ) { if( m_isVisible ) { int lastOption = m_currentOption: EditorGUI.BeginChangeCheck(): switch( m_options.UIWidget ) { case AseOptionsUIWidget.Dropdown: { m_currentOption = owner.EditorGUILayoutPopup( m_options.Name, m_currentOption, m_options.Options ): } break: case AseOptionsUIWidget.Toggle: { m_currentOption = owner.EditorGUILayoutToggle( m_options.Name, m_currentOption == 1 ) ? 1 : 0: } break: } if( EditorGUI.EndChangeCheck() ) { if( OnActionPerformedEvt != null ) { if( m_invertActionOnDeselection ) OnActionPerformedEvt( false, true, this, m_options.ActionsPerOption[ lastOption ] ): OnActionPerformedEvt( false, false, this, m_options.ActionsPerOption[ m_currentOption ] ): } } } }
public void Draw(UndoParentNode owner, GUIStyle toolbarstyle) { bool foldoutValue = EditorVariablesManager.ExpandedStencilOptions.Value; NodeUtils.DrawPropertyGroup(owner, ref foldoutValue, ref m_active, FoldoutLabelStr, () => { m_refValue = owner.EditorGUILayoutIntSlider(ReferenceValueContent, m_refValue, 0, 255); m_readMask = owner.EditorGUILayoutIntSlider(ReadMaskContent, m_readMask, 0, 255); m_writeMask = owner.EditorGUILayoutIntSlider(WriteMaskContent, m_writeMask, 0, 255); m_comparisonFunctionIdx = owner.EditorGUILayoutPopup(ComparisonStr, m_comparisonFunctionIdx, ComparisonLabels); m_passStencilOpIdx = owner.EditorGUILayoutPopup(PassStr, m_passStencilOpIdx, StencilOpsLabels); m_failStencilOpIdx = owner.EditorGUILayoutPopup(FailStr, m_failStencilOpIdx, StencilOpsLabels); m_zFailStencilOpIdx = owner.EditorGUILayoutPopup(ZFailStr, m_zFailStencilOpIdx, StencilOpsLabels); }); EditorVariablesManager.ExpandedStencilOptions.Value = foldoutValue; }
public void Draw(UndoParentNode owner) { if (m_isVisible) { int lastOption = m_currentOption; EditorGUI.BeginChangeCheck(); switch (m_options.UIWidget) { case AseOptionsUIWidget.Dropdown: { m_currentOption = owner.EditorGUILayoutPopup(m_options.Name, m_currentOption, m_options.DisplayOptions); } break; case AseOptionsUIWidget.Toggle: { m_currentOption = owner.EditorGUILayoutToggle(m_options.Name, m_currentOption == 1) ? 1 : 0; } break; } if (EditorGUI.EndChangeCheck()) { if (OnActionPerformedEvt != null) { if (m_invertActionOnDeselection) { OnActionPerformedEvt(false, lastOption != m_options.DisableIdx, this, m_options.ActionsPerOption[lastOption]); } OnActionPerformedEvt(false, false, this, m_options.ActionsPerOption[m_currentOption]); } } } }
public override void Draw(UndoParentNode owner, bool style = true) { EditorGUI.BeginChangeCheck(); m_shaderModelIdx = owner.EditorGUILayoutPopup(ShaderModelStr, m_shaderModelIdx, TemplateHelperFunctions.AvailableShaderModels); if (EditorGUI.EndChangeCheck()) { m_isDirty = true; } }
public void EnumTypePopup(ref UndoParentNode owner, string content, string[] displayOptions) { if (!m_active) { EditorGUILayout.BeginHorizontal(); m_value = owner.EditorGUILayoutPopup(content, (int)m_value, displayOptions); if (GUILayout.Button(UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width(15), GUILayout.Height(15))) { m_active = !m_active; } EditorGUILayout.EndHorizontal(); } else { DrawPicker(ref owner, content); } }
void DrawBlock( UndoParentNode owner, bool style ) { EditorGUI.BeginChangeCheck(): { if( m_blendModeEnabled ) { // RGB EditorGUI.BeginChangeCheck(): m_currentRGBIndex = owner.EditorGUILayoutPopup( BlendModesRGBStr, m_currentRGBIndex, m_commonBlendTypesArr ): if( EditorGUI.EndChangeCheck() ) { if( m_currentRGBIndex > 1 ) { m_sourceFactorRGB = m_commonBlendTypes[ m_currentRGBIndex ].SourceFactor: m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB: m_sourceFactorRGBInline.SetInlineNodeValue(): m_destFactorRGB = m_commonBlendTypes[ m_currentRGBIndex ].DestFactor: m_destFactorRGBInline.IntValue = (int)m_destFactorRGB: m_destFactorRGBInline.SetInlineNodeValue(): } } EditorGUI.BeginDisabledGroup( m_currentRGBIndex == 0 ): EditorGUI.BeginChangeCheck(): float cached = EditorGUIUtility.labelWidth: if( style ) { EditorGUIUtility.labelWidth = 40: } else { EditorGUIUtility.labelWidth = 25: } EditorGUILayout.BeginHorizontal(): //m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB ): m_sourceFactorRGBInline.CustomDrawer( ref owner, ( x ) => { m_sourceFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB ): }, SourceFactorStr ): if( style ) { EditorGUI.indentLevel--: EditorGUIUtility.labelWidth = 25: } //m_destFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB ): m_destFactorRGBInline.CustomDrawer( ref owner, ( x ) => { m_destFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB ): }, DstFactorStr ): if( style ) EditorGUI.indentLevel++: EditorGUILayout.EndHorizontal(): EditorGUIUtility.labelWidth = cached: if( EditorGUI.EndChangeCheck() ) { CheckRGBIndex(): } EditorGUI.EndDisabledGroup(): // Alpha EditorGUILayout.Separator(): EditorGUI.BeginChangeCheck(): m_currentAlphaIndex = owner.EditorGUILayoutPopup( BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr ): if( EditorGUI.EndChangeCheck() ) { if( m_currentAlphaIndex > 0 ) { m_sourceFactorAlpha = m_commonBlendTypes[ m_currentAlphaIndex ].SourceFactor: m_sourceFactorAlphaInline.IntValue = (int)m_sourceFactorAlpha: m_sourceFactorAlphaInline.SetInlineNodeValue(): m_destFactorAlpha = m_commonBlendTypes[ m_currentAlphaIndex ].DestFactor: m_destFactorAlphaInline.IntValue = (int)m_destFactorAlpha: m_destFactorAlphaInline.SetInlineNodeValue(): } } EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 ): EditorGUI.BeginChangeCheck(): cached = EditorGUIUtility.labelWidth: if( style ) { EditorGUIUtility.labelWidth = 40: } else { EditorGUIUtility.labelWidth = 25: } EditorGUILayout.BeginHorizontal(): //m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha ): m_sourceFactorAlphaInline.CustomDrawer( ref owner, ( x ) => { m_sourceFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha ): }, SourceFactorStr ): if( style ) { EditorGUI.indentLevel--: EditorGUIUtility.labelWidth = 25: } //m_destFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha ): m_destFactorAlphaInline.CustomDrawer( ref owner, ( x ) => { m_destFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha ): }, DstFactorStr ): if( style ) EditorGUI.indentLevel++: EditorGUILayout.EndHorizontal(): EditorGUIUtility.labelWidth = cached: if( EditorGUI.EndChangeCheck() ) { CheckAlphaIndex(): } EditorGUI.EndDisabledGroup(): EditorGUILayout.Separator(): } if( m_blendOpEnabled ) { // Both these tests should be removed on a later stage // ASE v154dev004 changed AvailableBlendOps.OFF value from -1 to 0 // If importing the new package into an already opened ASE window makes // hotcode to preserve the -1 value on these variables if( (int)m_blendOpRGB == -1 ) m_blendOpRGB = AvailableBlendOps.OFF: if( (int)m_blendOpAlpha == -1 ) m_blendOpAlpha = AvailableBlendOps.OFF: //m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsRGBStr, m_blendOpRGB ): m_blendOpRGBInline.CustomDrawer( ref owner, ( x ) => { m_blendOpRGB = (AvailableBlendOps)x.EditorGUILayoutPopup( BlendOpsRGBStr, (int)m_blendOpRGB, BlendOpsHelper.BlendOpsLabels ): }, BlendOpsRGBStr ): EditorGUILayout.Separator(): //m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsAlphaStr, m_blendOpAlpha ): m_blendOpAlphaInline.CustomDrawer( ref owner, ( x ) => { m_blendOpAlpha = (AvailableBlendOps)x.EditorGUILayoutPopup( BlendOpsAlphaStr, (int)m_blendOpAlpha, BlendOpsHelper.BlendOpsLabels ): }, BlendOpsAlphaStr ): } if( m_validAlphaToMask ) { EditorGUILayout.Space(): m_alphaToMaskValue = owner.EditorGUILayoutToggle( AlphaToMaskStr, m_alphaToMaskValue ): } } if( EditorGUI.EndChangeCheck() ) { m_isDirty = true: } }
public void Draw(UndoParentNode owner) { if (m_isVisible) { int lastOption = m_currentOption; EditorGUI.BeginChangeCheck(); switch (m_options.UIWidget) { case AseOptionsUIWidget.Dropdown: { m_currentOption = owner.EditorGUILayoutPopup(m_options.Name, m_currentOption, m_options.DisplayOptions); } break; case AseOptionsUIWidget.Toggle: { m_currentOption = owner.EditorGUILayoutToggle(m_options.Name, m_currentOption == 1) ? 1 : 0; } break; case AseOptionsUIWidget.Float: { if (m_options.FieldInline) { m_options.FieldValue.FloatField(ref owner, m_options.Name); if (m_options.FieldValue.Active) { m_currentOption = 1; } else { m_currentOption = 0; } } else { m_options.FieldValue.FloatValue = owner.EditorGUILayoutFloatField(m_options.Name, m_options.FieldValue.FloatValue); } } break; case AseOptionsUIWidget.Int: { if (m_options.FieldInline) { m_options.FieldValue.IntField(ref owner, m_options.Name); if (m_options.FieldValue.Active) { m_currentOption = 1; } else { m_currentOption = 0; } } else { m_options.FieldValue.FloatValue = owner.EditorGUILayoutIntField(m_options.Name, (int)m_options.FieldValue.FloatValue); } } break; case AseOptionsUIWidget.FloatRange: { if (m_options.FieldInline) { m_options.FieldValue.SliderField(ref owner, m_options.Name, m_options.FieldMin, m_options.FieldMax); if (m_options.FieldValue.Active) { m_currentOption = 1; } else { m_currentOption = 0; } } else { m_options.FieldValue.FloatValue = owner.EditorGUILayoutSlider(m_options.Name, m_options.FieldValue.FloatValue, m_options.FieldMin, m_options.FieldMax); } } break; case AseOptionsUIWidget.IntRange: { if (m_options.FieldInline) { m_options.FieldValue.IntSlider(ref owner, m_options.Name, (int)m_options.FieldMin, (int)m_options.FieldMax); if (m_options.FieldValue.Active) { m_currentOption = 1; } else { m_currentOption = 0; } } else { m_options.FieldValue.FloatValue = owner.EditorGUILayoutIntSlider(m_options.Name, (int)m_options.FieldValue.FloatValue, (int)m_options.FieldMin, (int)m_options.FieldMax); } } break; } if (EditorGUI.EndChangeCheck()) { if (OnActionPerformedEvt != null) { if (m_invertActionOnDeselection) { OnActionPerformedEvt(false, lastOption != m_options.DisableIdx, this, m_options.ActionsPerOption[lastOption]); } OnActionPerformedEvt(false, false, this, m_options.ActionsPerOption[m_currentOption]); } } } }
public void Draw(UndoParentNode owner, bool customBlendAvailable) { m_enabled = customBlendAvailable; // RGB EditorGUI.BeginChangeCheck(); m_currentIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentIndex > 1) { m_sourceFactorRGB = m_commonBlendTypes[m_currentIndex].SourceFactor; m_destFactorRGB = m_commonBlendTypes[m_currentIndex].DestFactor; } } EditorGUI.BeginDisabledGroup(m_currentIndex == 0); EditorGUI.BeginChangeCheck(); float cached = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 40; EditorGUILayout.BeginHorizontal(); m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorRGB); EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; m_destFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorRGB); EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckRGBIndex(); } EditorGUI.BeginChangeCheck(); m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsRGBStr, m_blendOpRGB); if (EditorGUI.EndChangeCheck()) { m_blendOpEnabled = m_blendOpRGB != AvailableBlendOps.OFF; } EditorGUI.EndDisabledGroup(); //if ( m_currentIndex == 0 ) // m_currentAlphaIndex = 0; //if ( m_blendOpRGB == AvailableBlendOps.OFF ) // m_blendOpAlpha = AvailableBlendOps.OFF; // Alpha EditorGUILayout.Separator(); //EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 ); EditorGUI.BeginChangeCheck(); m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentAlphaIndex > 0) { m_sourceFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].SourceFactor; m_destFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].DestFactor; } } //EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0); //EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 ); EditorGUI.BeginChangeCheck(); cached = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 40; EditorGUILayout.BeginHorizontal(); m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorAlpha); EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; m_destFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorAlpha); EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckAlphaIndex(); } m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, m_blendOpAlpha); EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); }
public void Draw(UndoParentNode owner, CullMode cullMode) { bool foldoutValue = EditorVariablesManager.ExpandedStencilOptions.Value; NodeUtils.DrawPropertyGroup(ref foldoutValue, FoldoutLabelStr, () => { m_reference = owner.EditorGUILayoutIntSlider(ReferenceValueContent, m_reference, 0, 255); m_readMask = owner.EditorGUILayoutIntSlider(ReadMaskContent, m_readMask, 0, 255); m_writeMask = owner.EditorGUILayoutIntSlider(WriteMaskContent, m_writeMask, 0, 255); if (cullMode == CullMode.Off) { m_comparisonFunctionIdx = owner.EditorGUILayoutPopup(ComparisonFrontStr, m_comparisonFunctionIdx, StencilBufferOpHelper.StencilComparisonLabels); m_passStencilOpIdx = owner.EditorGUILayoutPopup(PassFrontStr, m_passStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); m_failStencilOpIdx = owner.EditorGUILayoutPopup(FailFrontStr, m_failStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); m_zFailStencilOpIdx = owner.EditorGUILayoutPopup(ZFailFrontStr, m_zFailStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); EditorGUILayout.Separator(); m_comparisonFunctionBackIdx = owner.EditorGUILayoutPopup(ComparisonBackStr, m_comparisonFunctionBackIdx, StencilBufferOpHelper.StencilComparisonLabels); m_passStencilOpBackIdx = owner.EditorGUILayoutPopup(PassBackStr, m_passStencilOpBackIdx, StencilBufferOpHelper.StencilOpsLabels); m_failStencilOpBackIdx = owner.EditorGUILayoutPopup(FailBackStr, m_failStencilOpBackIdx, StencilBufferOpHelper.StencilOpsLabels); m_zFailStencilOpBackIdx = owner.EditorGUILayoutPopup(ZFailBackStr, m_zFailStencilOpBackIdx, StencilBufferOpHelper.StencilOpsLabels); } else { m_comparisonFunctionIdx = owner.EditorGUILayoutPopup(ComparisonStr, m_comparisonFunctionIdx, StencilBufferOpHelper.StencilComparisonLabels); m_passStencilOpIdx = owner.EditorGUILayoutPopup(PassStr, m_passStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); m_failStencilOpIdx = owner.EditorGUILayoutPopup(FailStr, m_failStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); m_zFailStencilOpIdx = owner.EditorGUILayoutPopup(ZFailStr, m_zFailStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); } }); EditorVariablesManager.ExpandedStencilOptions.Value = foldoutValue; }
void DrawBlock(UndoParentNode owner, CullMode cullMode) { EditorGUI.BeginChangeCheck(); { m_reference = owner.EditorGUILayoutIntSlider(ReferenceValueContent, m_reference, 0, 255); m_readMask = owner.EditorGUILayoutIntSlider(ReadMaskContent, m_readMask, 0, 255); m_writeMask = owner.EditorGUILayoutIntSlider(WriteMaskContent, m_writeMask, 0, 255); if (cullMode == CullMode.Off) { m_comparisonFunctionIdx = owner.EditorGUILayoutPopup(ComparisonFrontStr, m_comparisonFunctionIdx, StencilBufferOpHelper.StencilComparisonLabels); m_passStencilOpIdx = owner.EditorGUILayoutPopup(PassFrontStr, m_passStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); m_failStencilOpIdx = owner.EditorGUILayoutPopup(FailFrontStr, m_failStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); m_zFailStencilOpIdx = owner.EditorGUILayoutPopup(ZFailFrontStr, m_zFailStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); EditorGUILayout.Separator(); m_comparisonFunctionBackIdx = owner.EditorGUILayoutPopup(ComparisonBackStr, m_comparisonFunctionBackIdx, StencilBufferOpHelper.StencilComparisonLabels); m_passStencilOpBackIdx = owner.EditorGUILayoutPopup(PassBackStr, m_passStencilOpBackIdx, StencilBufferOpHelper.StencilOpsLabels); m_failStencilOpBackIdx = owner.EditorGUILayoutPopup(FailBackStr, m_failStencilOpBackIdx, StencilBufferOpHelper.StencilOpsLabels); m_zFailStencilOpBackIdx = owner.EditorGUILayoutPopup(ZFailBackStr, m_zFailStencilOpBackIdx, StencilBufferOpHelper.StencilOpsLabels); } else { m_comparisonFunctionIdx = owner.EditorGUILayoutPopup(ComparisonStr, m_comparisonFunctionIdx, StencilBufferOpHelper.StencilComparisonLabels); m_passStencilOpIdx = owner.EditorGUILayoutPopup(PassStr, m_passStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); m_failStencilOpIdx = owner.EditorGUILayoutPopup(FailStr, m_failStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); m_zFailStencilOpIdx = owner.EditorGUILayoutPopup(ZFailStr, m_zFailStencilOpIdx, StencilBufferOpHelper.StencilOpsLabels); } } if (EditorGUI.EndChangeCheck()) { m_isDirty = true; } }
public override void Draw(UndoParentNode owner) { bool blendModeIsVisible = EditorVariablesManager.ExpandedBlendModeModule.Value; NodeUtils.DrawPropertyGroup(ref blendModeIsVisible, BlendModeStr, () => { if (m_blendModeEnabled) { // RGB EditorGUI.BeginChangeCheck(); m_currentRGBIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentRGBIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentRGBIndex > 1) { m_sourceFactorRGB = m_commonBlendTypes[m_currentRGBIndex].SourceFactor; m_destFactorRGB = m_commonBlendTypes[m_currentRGBIndex].DestFactor; } } EditorGUI.BeginDisabledGroup(m_currentRGBIndex == 0); EditorGUI.BeginChangeCheck(); float cached = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 40; EditorGUILayout.BeginHorizontal(); m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorRGB); EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; m_destFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorRGB); EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckRGBIndex(); } EditorGUI.EndDisabledGroup(); // Alpha EditorGUILayout.Separator(); EditorGUI.BeginChangeCheck(); m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentAlphaIndex > 0) { m_sourceFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].SourceFactor; m_destFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].DestFactor; } } EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0); EditorGUI.BeginChangeCheck(); cached = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 40; EditorGUILayout.BeginHorizontal(); m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorAlpha); EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; m_destFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorAlpha); EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckAlphaIndex(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); } if (m_blendOpEnabled) { m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsRGBStr, m_blendOpRGB); EditorGUILayout.Separator(); m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, m_blendOpAlpha); } }); EditorVariablesManager.ExpandedBlendModeModule.Value = blendModeIsVisible; }
public void Draw(UndoParentNode owner, bool customBlendAvailable) { m_enabled = customBlendAvailable; // RGB EditorGUI.BeginChangeCheck(); m_currentIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentIndex > 1) { m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[m_currentIndex].SourceFactor; m_sourceFactorRGB.SetInlineNodeValue(); m_destFactorRGB.IntValue = (int)m_commonBlendTypes[m_currentIndex].DestFactor; m_destFactorRGB.SetInlineNodeValue(); } } EditorGUI.BeginDisabledGroup(m_currentIndex == 0); EditorGUI.BeginChangeCheck(); float cached = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 40; EditorGUILayout.BeginHorizontal(); AvailableBlendFactor tempCast = (AvailableBlendFactor)m_sourceFactorRGB.IntValue; m_sourceFactorRGB.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, tempCast); }, SourceFactorStr); m_sourceFactorRGB.IntValue = (int)tempCast; EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; tempCast = (AvailableBlendFactor)m_destFactorRGB.IntValue; m_destFactorRGB.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, tempCast); }, DstFactorStr); m_destFactorRGB.IntValue = (int)tempCast; EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckRGBIndex(); } // Both these tests should be removed on a later stage // ASE v154dev004 changed AvailableBlendOps.OFF value from -1 to 0 // If importing the new package into an already opened ASE window makes // hotcode to preserve the -1 value on these variables if (m_blendOpRGB.FloatValue < 0) { m_blendOpRGB.FloatValue = 0; } if (m_blendOpAlpha.FloatValue < 0) { m_blendOpAlpha.FloatValue = 0; } EditorGUI.BeginChangeCheck(); //AvailableBlendOps tempOpCast = (AvailableBlendOps)m_blendOpRGB.IntValue; m_blendOpRGB.CustomDrawer(ref owner, (x) => { m_blendOpRGB.IntValue = x.EditorGUILayoutPopup(BlendOpsRGBStr, m_blendOpRGB.IntValue, BlendOpsLabels); }, BlendOpsRGBStr); //m_blendOpRGB.IntValue = (int)tempOpCast; if (EditorGUI.EndChangeCheck()) { m_blendOpEnabled = (!m_blendOpRGB.Active && m_blendOpRGB.IntValue > -1) || (m_blendOpRGB.Active && m_blendOpRGB.NodeId > -1);//AvailableBlendOps.OFF; m_blendOpRGB.SetInlineNodeValue(); } EditorGUI.EndDisabledGroup(); // Alpha EditorGUILayout.Separator(); EditorGUI.BeginChangeCheck(); m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentAlphaIndex > 0) { m_sourceFactorAlpha.IntValue = (int)m_commonBlendTypes[m_currentAlphaIndex].SourceFactor; m_sourceFactorAlpha.SetInlineNodeValue(); m_destFactorAlpha.IntValue = (int)m_commonBlendTypes[m_currentAlphaIndex].DestFactor; m_destFactorAlpha.SetInlineNodeValue(); } } EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0); EditorGUI.BeginChangeCheck(); cached = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 40; EditorGUILayout.BeginHorizontal(); tempCast = (AvailableBlendFactor)m_sourceFactorAlpha.IntValue; m_sourceFactorAlpha.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, tempCast); }, SourceFactorStr); m_sourceFactorAlpha.IntValue = (int)tempCast; EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; tempCast = (AvailableBlendFactor)m_destFactorAlpha.IntValue; m_destFactorAlpha.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, tempCast); }, DstFactorStr); m_destFactorAlpha.IntValue = (int)tempCast; EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckAlphaIndex(); } EditorGUI.BeginChangeCheck(); //tempOpCast = (AvailableBlendOps)m_blendOpAlpha.IntValue; m_blendOpAlpha.CustomDrawer(ref owner, (x) => { m_blendOpAlpha.IntValue = x.EditorGUILayoutPopup(BlendOpsAlphaStr, m_blendOpAlpha.IntValue, BlendOpsLabels); }, BlendOpsAlphaStr); //m_blendOpAlpha.IntValue = (int)tempOpCast; if (EditorGUI.EndChangeCheck()) { m_blendOpAlpha.SetInlineNodeValue(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); }
public void Draw(UndoParentNode owner, GUIStyle toolbarstyle) { bool foldoutValue = EditorVariablesManager.ExpandedStencilOptions.Value; NodeUtils.DrawPropertyGroup(owner, ref foldoutValue, ref m_active, FoldoutLabelStr, () => { m_refValue = owner.EditorGUILayoutIntSlider(ReferenceValueContent, m_refValue, 0, 255); m_readMask = owner.EditorGUILayoutIntSlider(ReadMaskContent, m_readMask, 0, 255); m_writeMask = owner.EditorGUILayoutIntSlider(WriteMaskContent, m_writeMask, 0, 255); if ((owner as StandardSurfaceOutputNode).CurrentCullMode == CullMode.Off) { m_comparisonFunctionIdx = owner.EditorGUILayoutPopup(ComparisonFrontStr, m_comparisonFunctionIdx, ComparisonLabels); m_passStencilOpIdx = owner.EditorGUILayoutPopup(PassFrontStr, m_passStencilOpIdx, StencilOpsLabels); m_failStencilOpIdx = owner.EditorGUILayoutPopup(FailFrontStr, m_failStencilOpIdx, StencilOpsLabels); m_zFailStencilOpIdx = owner.EditorGUILayoutPopup(ZFailFrontStr, m_zFailStencilOpIdx, StencilOpsLabels); EditorGUILayout.Separator(); m_comparisonFunctionBackIdx = owner.EditorGUILayoutPopup(ComparisonBackStr, m_comparisonFunctionBackIdx, ComparisonLabels); m_passStencilOpBackIdx = owner.EditorGUILayoutPopup(PassBackStr, m_passStencilOpBackIdx, StencilOpsLabels); m_failStencilOpBackIdx = owner.EditorGUILayoutPopup(FailBackStr, m_failStencilOpBackIdx, StencilOpsLabels); m_zFailStencilOpBackIdx = owner.EditorGUILayoutPopup(ZFailBackStr, m_zFailStencilOpBackIdx, StencilOpsLabels); } else { m_comparisonFunctionIdx = owner.EditorGUILayoutPopup(ComparisonStr, m_comparisonFunctionIdx, ComparisonLabels); m_passStencilOpIdx = owner.EditorGUILayoutPopup(PassStr, m_passStencilOpIdx, StencilOpsLabels); m_failStencilOpIdx = owner.EditorGUILayoutPopup(FailStr, m_failStencilOpIdx, StencilOpsLabels); m_zFailStencilOpIdx = owner.EditorGUILayoutPopup(ZFailStr, m_zFailStencilOpIdx, StencilOpsLabels); } }); EditorVariablesManager.ExpandedStencilOptions.Value = foldoutValue; }
void DrawBlock(UndoParentNode owner, bool style) { EditorGUI.BeginChangeCheck(); { if (m_blendModeEnabled) { // RGB EditorGUI.BeginChangeCheck(); m_currentRGBIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentRGBIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentRGBIndex > 1) { m_sourceFactorRGB = m_commonBlendTypes[m_currentRGBIndex].SourceFactor; m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB; m_sourceFactorRGBInline.SetInlineNodeValue(); m_destFactorRGB = m_commonBlendTypes[m_currentRGBIndex].DestFactor; m_destFactorRGBInline.IntValue = (int)m_destFactorRGB; m_destFactorRGBInline.SetInlineNodeValue(); } } EditorGUI.BeginDisabledGroup(m_currentRGBIndex == 0); EditorGUI.BeginChangeCheck(); float cached = EditorGUIUtility.labelWidth; if (style) { EditorGUIUtility.labelWidth = 40; } else { EditorGUIUtility.labelWidth = 25; } EditorGUILayout.BeginHorizontal(); //m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB ); m_sourceFactorRGBInline.CustomDrawer(ref owner, (x) => { m_sourceFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorRGB); }, SourceFactorStr); if (style) { EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; } //m_destFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB ); m_destFactorRGBInline.CustomDrawer(ref owner, (x) => { m_destFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorRGB); }, DstFactorStr); if (style) { EditorGUI.indentLevel++; } EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckRGBIndex(); } EditorGUI.EndDisabledGroup(); // Alpha EditorGUILayout.Separator(); EditorGUI.BeginChangeCheck(); m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentAlphaIndex > 0) { m_sourceFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].SourceFactor; m_sourceFactorAlphaInline.IntValue = (int)m_sourceFactorAlpha; m_sourceFactorAlphaInline.SetInlineNodeValue(); m_destFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].DestFactor; m_destFactorAlphaInline.IntValue = (int)m_destFactorAlpha; m_destFactorAlphaInline.SetInlineNodeValue(); } } EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0); EditorGUI.BeginChangeCheck(); cached = EditorGUIUtility.labelWidth; if (style) { EditorGUIUtility.labelWidth = 40; } else { EditorGUIUtility.labelWidth = 25; } EditorGUILayout.BeginHorizontal(); //m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha ); m_sourceFactorAlphaInline.CustomDrawer(ref owner, (x) => { m_sourceFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorAlpha); }, SourceFactorStr); if (style) { EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; } //m_destFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha ); m_destFactorAlphaInline.CustomDrawer(ref owner, (x) => { m_destFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorAlpha); }, DstFactorStr); if (style) { EditorGUI.indentLevel++; } EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckAlphaIndex(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); } if (m_blendOpEnabled) { //m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsRGBStr, m_blendOpRGB ); m_blendOpRGBInline.CustomDrawer(ref owner, (x) => { m_blendOpRGB = (AvailableBlendOps)x.EditorGUILayoutEnumPopup(BlendOpsRGBStr, m_blendOpRGB); }, BlendOpsRGBStr); EditorGUILayout.Separator(); //m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsAlphaStr, m_blendOpAlpha ); m_blendOpAlphaInline.CustomDrawer(ref owner, (x) => { m_blendOpAlpha = (AvailableBlendOps)x.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, m_blendOpAlpha); }, BlendOpsAlphaStr); } } if (EditorGUI.EndChangeCheck()) { m_isDirty = true; } }
public void Draw(UndoParentNode owner, bool customBlendAvailable) { m_enabled = customBlendAvailable; // RGB EditorGUI.BeginChangeCheck(); m_currentIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentIndex > 1) { m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[m_currentIndex].SourceFactor; m_sourceFactorRGB.SetInlineNodeValue(); m_destFactorRGB.IntValue = (int)m_commonBlendTypes[m_currentIndex].DestFactor; m_destFactorRGB.SetInlineNodeValue(); } } EditorGUI.BeginDisabledGroup(m_currentIndex == 0); EditorGUI.BeginChangeCheck(); float cached = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 40; EditorGUILayout.BeginHorizontal(); AvailableBlendFactor tempCast = (AvailableBlendFactor)m_sourceFactorRGB.IntValue; m_sourceFactorRGB.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, tempCast); }, SourceFactorStr); m_sourceFactorRGB.IntValue = (int)tempCast; EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; tempCast = (AvailableBlendFactor)m_destFactorRGB.IntValue; m_destFactorRGB.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, tempCast); }, DstFactorStr); m_destFactorRGB.IntValue = (int)tempCast; EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckRGBIndex(); } EditorGUI.BeginChangeCheck(); AvailableBlendOps tempOpCast = (AvailableBlendOps)m_blendOpRGB.IntValue; m_blendOpRGB.CustomDrawer(ref owner, (x) => { tempOpCast = (AvailableBlendOps)x.EditorGUILayoutEnumPopup(BlendOpsRGBStr, tempOpCast); }, BlendOpsRGBStr); m_blendOpRGB.IntValue = (int)tempOpCast; if (EditorGUI.EndChangeCheck()) { m_blendOpEnabled = (!m_blendOpRGB.Active && m_blendOpRGB.IntValue > -1) || (m_blendOpRGB.Active && m_blendOpRGB.NodeId > -1); //AvailableBlendOps.OFF; m_blendOpRGB.SetInlineNodeValue(); } EditorGUI.EndDisabledGroup(); // Alpha EditorGUILayout.Separator(); EditorGUI.BeginChangeCheck(); m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr); if (EditorGUI.EndChangeCheck()) { if (m_currentAlphaIndex > 0) { m_sourceFactorAlpha.IntValue = (int)m_commonBlendTypes[m_currentAlphaIndex].SourceFactor; m_sourceFactorAlpha.SetInlineNodeValue(); m_destFactorAlpha.IntValue = (int)m_commonBlendTypes[m_currentAlphaIndex].DestFactor; m_destFactorAlpha.SetInlineNodeValue(); } } EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0); EditorGUI.BeginChangeCheck(); cached = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 40; EditorGUILayout.BeginHorizontal(); tempCast = (AvailableBlendFactor)m_sourceFactorAlpha.IntValue; m_sourceFactorAlpha.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, tempCast); }, SourceFactorStr); m_sourceFactorAlpha.IntValue = (int)tempCast; EditorGUI.indentLevel--; EditorGUIUtility.labelWidth = 25; tempCast = (AvailableBlendFactor)m_destFactorAlpha.IntValue; m_destFactorAlpha.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, tempCast); }, DstFactorStr); m_destFactorAlpha.IntValue = (int)tempCast; EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = cached; if (EditorGUI.EndChangeCheck()) { CheckAlphaIndex(); } EditorGUI.BeginChangeCheck(); tempOpCast = (AvailableBlendOps)m_blendOpAlpha.IntValue; m_blendOpAlpha.CustomDrawer(ref owner, (x) => { tempOpCast = (AvailableBlendOps)x.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, tempOpCast); }, BlendOpsAlphaStr); m_blendOpAlpha.IntValue = (int)tempOpCast; if (EditorGUI.EndChangeCheck()) { m_blendOpAlpha.SetInlineNodeValue(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); }