public void Draw( ParentNode owner ) { m_currentOwner = owner: bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines: NodeUtils.DrawNestedPropertyGroup( ref foldout, m_moduleName, DrawMainBody, DrawButtons ): owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines = foldout: }
void DrawReordableList() { if (m_reordableList != null) { if (m_propertyAdjustment == null) { m_propertyAdjustment = new GUIStyle(); m_propertyAdjustment.padding.left = 17; } //EditorGUILayout.BeginVertical( m_propertyAdjustment ); EditorGUILayout.Space(); if (m_nativeDirectives.Count > 0) { NodeUtils.DrawNestedPropertyGroup(ref m_nativeDirectivesFoldout, NativeFoldoutStr, DrawNativeItems, 4); } if (m_additionalDirectives.Count == 0) { EditorGUILayout.HelpBox("Your list is Empty!\nUse the plus button to add one.", MessageType.Info); } else { m_reordableList.DoLayoutList(); } EditorGUILayout.Space(); //EditorGUILayout.EndVertical(); } }
public void DrawCustomOptions(TemplateMultiPassMasterNode owner) { m_owner = owner; if (m_passCustomOptionsSizeCheck > 0) { NodeUtils.DrawNestedPropertyGroup(ref m_passCustomOptionsFoldout, m_passCustomOptionsLabel, DrawCustomOptionsBlock); } }
void DrawMain() { m_filterMode = (InlineSamplerFilteringMode)m_owner.EditorGUILayoutEnumPopup(m_filterMode); EditorGUILayout.BeginHorizontal(); m_mainWrapMode.WrapMode = (InlineSamplerWrapMode)m_owner.EditorGUILayoutEnumPopup(m_mainWrapMode.WrapMode); m_mainWrapMode.Coordinates = (InlineSamplerWrapCoordinates)m_owner.EditorGUILayoutEnumPopup(m_mainWrapMode.Coordinates); EditorGUILayout.EndHorizontal(); NodeUtils.DrawNestedPropertyGroup(ref m_visibleWrapsFoldout, AdditionalWrapsStr, DrawAdditionalWrapModes, DrawAddRemoveButtons); }
void DrawMainBody() { EditorGUILayout.Separator(); if (m_nativeItems.Count > 0) { NodeUtils.DrawNestedPropertyGroup(ref m_nativeItemsFoldout, NativeFoldoutStr, DrawNativeItems, 4); } int itemCount = m_additionalItems.Count; int markedToDelete = -1; for (int i = 0; i < itemCount; i++) { EditorGUILayout.BeginHorizontal(); { EditorGUI.BeginChangeCheck(); m_additionalItems[i] = EditorGUILayout.TextField(m_additionalItems[i]); if (EditorGUI.EndChangeCheck()) { m_additionalItems[i] = UIUtils.RemoveShaderInvalidCharacters(m_additionalItems[i]); m_isDirty = true; } // Add new port if (m_currentOwner.GUILayoutButton(string.Empty, UIUtils.PlusStyle, GUILayout.Width(ShaderKeywordButtonLayoutWidth))) { m_additionalItems.Insert(i + 1, string.Empty); EditorGUI.FocusTextInControl(null); m_isDirty = true; } //Remove port if (m_currentOwner.GUILayoutButton(string.Empty, UIUtils.MinusStyle, GUILayout.Width(ShaderKeywordButtonLayoutWidth))) { markedToDelete = i; m_isDirty = true; } } EditorGUILayout.EndHorizontal(); } if (markedToDelete > -1) { if (m_additionalItems.Count > markedToDelete) { m_additionalItems.RemoveAt(markedToDelete); EditorGUI.FocusTextInControl(null); } } EditorGUILayout.Separator(); EditorGUILayout.HelpBox(m_helpBoxMessage, MessageType.Info); }
public override void Draw(ParentNode owner, bool style = true) { m_currentOwner = owner; if (style) { NodeUtils.DrawPropertyGroup(ref m_foldoutValue, CustomTagsStr, DrawMainBody, DrawButtons); } else { NodeUtils.DrawNestedPropertyGroup(ref m_foldoutValue, CustomTagsStr, DrawMainBody, DrawButtons); } }
public override void Draw( UndoParentNode owner, bool style = true ) { m_currentOwner = owner: bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags: if( style ) { NodeUtils.DrawPropertyGroup( ref foldout, CustomTagsStr, DrawMainBody, DrawButtons ): } else { NodeUtils.DrawNestedPropertyGroup( ref foldout, CustomTagsStr, DrawMainBody, DrawButtons ): } owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags = foldout: }
public void Draw( ParentNode owner, bool isNested = false ) { m_currentOwner = owner: bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDependencies: if( isNested ) { NodeUtils.DrawNestedPropertyGroup( ref value, CustomDependencysStr, DrawMainBody, DrawButtons ): } else { NodeUtils.DrawPropertyGroup( ref value, CustomDependencysStr, DrawMainBody, DrawButtons ): } owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDependencies = value: }
public override void Draw(ParentNode owner, bool style = true) { if (style) { NodeUtils.DrawPropertyGroup(ref m_foldoutValue, BlendModeStr, () => { DrawBlock(owner, style); }); } else { NodeUtils.DrawNestedPropertyGroup(ref m_foldoutValue, BlendModeStr, () => { DrawBlock(owner, style); }); } }
public void Draw(UndoParentNode owner, CullMode cullMode, bool style = true) { if (style) { NodeUtils.DrawPropertyGroup(ref m_foldoutValue, FoldoutLabelStr, () => { DrawBlock(owner, cullMode); }); } else { NodeUtils.DrawNestedPropertyGroup(ref m_foldoutValue, FoldoutLabelStr, () => { DrawBlock(owner, cullMode); }); } }
public override void Draw(ParentNode owner, bool style = true) { if (style) { NodeUtils.DrawPropertyGroup(ref m_foldoutValue, ZBufferOpHelper.DepthParametersStr, () => { EditorGUI.indentLevel++; DrawBlock(owner); EditorGUI.indentLevel--; }); } else { NodeUtils.DrawNestedPropertyGroup(ref m_foldoutValue, ZBufferOpHelper.DepthParametersStr, () => { DrawBlock(owner); }); } }
public void Draw( UndoParentNode owner, CullMode cullMode , bool style = true ) { bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions: if( style ) { NodeUtils.DrawPropertyGroup( ref foldout, FoldoutLabelStr, () => { DrawBlock( owner, cullMode ): } ): } else { NodeUtils.DrawNestedPropertyGroup( owner, ref foldout, ref m_active, FoldoutLabelStr, () => { DrawBlock( owner, cullMode ): } ): } owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions = foldout: }
public override void Draw(UndoParentNode owner, bool style = true) { bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule; if (style) { NodeUtils.DrawPropertyGroup(ref foldout, BlendModeStr + Target, () => { DrawBlock(owner, style); }); } else { NodeUtils.DrawNestedPropertyGroup(ref foldout, BlendModeStr + Target, () => { DrawBlock(owner, style); }); } owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule = foldout; }
public void Draw(TemplateMultiPassMasterNode owner) { if (m_currentPasses.Length < 2) { return; } NodeUtils.DrawNestedPropertyGroup(ref m_foldout, Label, () => { for (int i = 0; i < m_currentPasses.Length; i++) { EditorGUI.BeginChangeCheck(); m_currentPasses[i].Visible = owner.EditorGUILayoutToggleLeft(m_currentPasses[i].Name, m_currentPasses[i].Visible); if (EditorGUI.EndChangeCheck()) { owner.ContainerGraph.GetMultiPassMasterNodes(owner.LODIndex)[m_currentPasses[i].Idx].IsInvisible = !m_currentPasses[i].Visible; } } EditorGUILayout.Space(); }); }
public override void Draw(UndoParentNode owner, bool style = true) { bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth; if (style) { NodeUtils.DrawPropertyGroup(ref foldout, ZBufferOpHelper.DepthParametersStr, () => { EditorGUI.indentLevel++; DrawBlock(owner); EditorGUI.indentLevel--; }); } else { NodeUtils.DrawNestedPropertyGroup(ref foldout, ZBufferOpHelper.DepthParametersStr, () => { DrawBlock(owner); }); } owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth = foldout; }
public override void Draw(UndoParentNode owner, bool style = true) { if (m_reordableList == null) { m_reordableList = new ReorderableList(m_additionalDirectives, typeof(AdditionalDirectiveContainer), true, false, false, false) { headerHeight = 0, footerHeight = 0, showDefaultBackground = false, drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { if (m_additionalDirectives[index] != null) { if (style) { rect.xMin -= 10; } else { rect.xMin -= 1; } float popUpWidth = style?75:65f; Rect popupPos = new Rect(rect.x, rect.y, popUpWidth, EditorGUIUtility.singleLineHeight); Rect buttonPlusPos = new Rect(rect.x + rect.width - 2 * Constants.PlusMinusButtonLayoutWidth, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth); Rect buttonMinusPos = new Rect(rect.x + rect.width - Constants.PlusMinusButtonLayoutWidth, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth); Rect labelPos = new Rect(rect.x + popupPos.width, rect.y, rect.width - popupPos.width - buttonPlusPos.width - buttonMinusPos.width, rect.height); labelPos.height = EditorGUIUtility.singleLineHeight; m_additionalDirectives[index].LineType = (AdditionalLineType)owner.EditorGUIEnumPopup(popupPos, m_additionalDirectives[index].LineType); m_additionalDirectives[index].LineValue = owner.EditorGUITextField(labelPos, string.Empty, m_additionalDirectives[index].LineValue); if (GUI.Button(buttonPlusPos, string.Empty, UIUtils.PlusStyle)) { m_actionType = ReordableAction.Add; m_actionIndex = index; } if (GUI.Button(buttonMinusPos, string.Empty, UIUtils.MinusStyle)) { m_actionType = ReordableAction.Remove; m_actionIndex = index; } } } }; } if (m_actionType != ReordableAction.None) { switch (m_actionType) { case ReordableAction.Add: AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance <AdditionalDirectiveContainer>(); newItem.hideFlags = HideFlags.HideAndDontSave; m_additionalDirectives.Insert(m_actionIndex + 1, newItem); break; case ReordableAction.Remove: AdditionalDirectiveContainer itemToDelete = m_additionalDirectives[m_actionIndex]; m_additionalDirectives.RemoveAt(m_actionIndex); ScriptableObject.DestroyImmediate(itemToDelete); break; } m_isDirty = true; m_actionType = ReordableAction.None; EditorGUI.FocusTextInControl(null); } bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDirectives; if (style) { NodeUtils.DrawPropertyGroup(ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons); } else { NodeUtils.DrawNestedPropertyGroup(ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons); } owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDirectives = foldoutValue; }
public void Draw(ParentNode owner) { m_currentOwner = owner; NodeUtils.DrawNestedPropertyGroup(ref m_foldoutValue, m_moduleName, DrawMainBody, DrawButtons); }
public void Draw(UndoParentNode owner) { m_owner = owner; NodeUtils.DrawNestedPropertyGroup(ref m_visibleMainFoldout, InlineSamplerStateStr, DrawMain); }
public void Draw(UndoParentNode owner, bool style = true) { if (m_owner == null) { m_owner = owner; } if (m_reordableList == null) { m_reordableList = new ReorderableList(m_items, typeof(UsePassItem), true, false, false, false) { headerHeight = 0, footerHeight = 0, showDefaultBackground = false, drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { if (m_items[index] != null) { float labelWidthMultiplier; float popUpWidth; float shaderSelectorMultiplier; float buttonPlusPosMultiplier; if (style) { rect.x -= 10; labelWidthMultiplier = 0.9f; popUpWidth = 0.31f; shaderSelectorMultiplier = 1.01f; buttonPlusPosMultiplier = 0.78f; } else { rect.x -= 1; labelWidthMultiplier = 1.01f; popUpWidth = 0.25f; shaderSelectorMultiplier = 1.0f; buttonPlusPosMultiplier = 0.55f; } Rect popupPos = new Rect(rect.x, rect.y + 2, popUpWidth * rect.width, rect.height); Rect labelPos = new Rect(rect.x + popupPos.width * labelWidthMultiplier, rect.y, 0.59f * rect.width, rect.height); Rect shaderSelectorPos = new Rect(labelPos.x + labelPos.width * shaderSelectorMultiplier, rect.y, 15, rect.height); Rect buttonPlusPos = new Rect(shaderSelectorPos.x + shaderSelectorPos.width * buttonPlusPosMultiplier, rect.y, ShaderKeywordButtonLayoutWidth, rect.height); Rect buttonMinusPos = new Rect(buttonPlusPos.x + buttonPlusPos.width, rect.y, ShaderKeywordButtonLayoutWidth, rect.height); EditorGUI.BeginChangeCheck(); m_items[index].Location = (UsePassLocation)owner.EditorGUIEnumPopup(popupPos, m_items[index].Location); if (EditorGUI.EndChangeCheck() && m_items[index].Location == UsePassLocation.Below && m_owner != null && m_owner.ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader) { m_items[index].Location = UsePassLocation.Above; UIUtils.ShowMessage("Below option still not available on templates"); } m_items[index].Value = owner.EditorGUITextField(labelPos, string.Empty, m_items[index].Value); if (GUI.Button(shaderSelectorPos, string.Empty, UIUtils.InspectorPopdropdownFallback)) { EditorGUI.FocusTextInControl(null); GUI.FocusControl(null); m_currentUsePassIdx = index; DisplayShaderContext(owner, GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.popup)); } if (GUI.Button(buttonPlusPos, string.Empty, UIUtils.PlusStyle)) { m_actionType = ReordableAction.Add; m_actionIndex = index; } if (GUI.Button(buttonMinusPos, string.Empty, UIUtils.MinusStyle)) { m_actionType = ReordableAction.Remove; m_actionIndex = index; } } } }; } if (m_actionType != ReordableAction.None) { switch (m_actionType) { case ReordableAction.Add: UsePassItem newItem = ScriptableObject.CreateInstance <UsePassItem>(); newItem.hideFlags = HideFlags.HideAndDontSave; m_items.Insert(m_actionIndex + 1, newItem); break; case ReordableAction.Remove: UsePassItem itemToDelete = m_items[m_actionIndex]; m_items.RemoveAt(m_actionIndex); ScriptableObject.DestroyImmediate(itemToDelete); break; } m_isDirty = true; m_actionType = ReordableAction.None; EditorGUI.FocusTextInControl(null); } bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedUsePass; if (style) { NodeUtils.DrawPropertyGroup(ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons); } else { NodeUtils.DrawNestedPropertyGroup(ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons); } owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedUsePass = foldoutValue; }
public override void Draw(UndoParentNode currOwner, bool style = true) { m_currOwner = currOwner; if (m_reordableList == null) { m_reordableList = new ReorderableList(m_additionalDirectives, typeof(AdditionalDirectiveContainer), true, false, false, false) { headerHeight = 0, footerHeight = 0, showDefaultBackground = false, elementHeightCallback = (index) => { if (m_additionalDirectives[index].Origin == AdditionalContainerOrigin.Native && m_nativeDirectivesFoldout) { return((m_nativeDirectives.Count + 1) * (EditorGUIUtility.singleLineHeight) + 5); } return(EditorGUIUtility.singleLineHeight + 5); }, drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { if (m_additionalDirectives[index].Origin == AdditionalContainerOrigin.Native && m_nativeDirectivesFoldout) { rect.height = (m_nativeDirectives.Count + 1) * (EditorGUIUtility.singleLineHeight) + 5; } if (m_additionalDirectives[index] != null) { float labelWidthStyleAdjust = 0; if (style) { rect.xMin -= 10; labelWidthStyleAdjust = 15; } else { rect.xMin -= 1; } float popUpWidth = style ? 75 : 60f; float widthAdjust = m_additionalDirectives[index].LineType == AdditionalLineType.Include ? -14 : 0; Rect popupPos = new Rect(rect.x, rect.y, popUpWidth, EditorGUIUtility.singleLineHeight); Rect GUIDTogglePos = m_additionalDirectives[index].LineType == AdditionalLineType.Include ? new Rect(rect.x + rect.width - 3 * Constants.PlusMinusButtonLayoutWidth, rect.y, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth) : new Rect(); Rect buttonPlusPos = new Rect(rect.x + rect.width - 2 * Constants.PlusMinusButtonLayoutWidth, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth); Rect buttonMinusPos = new Rect(rect.x + rect.width - Constants.PlusMinusButtonLayoutWidth, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth); float labelWidthBuffer = EditorGUIUtility.labelWidth; Rect labelPos = new Rect(rect.x + popupPos.width - labelWidthStyleAdjust, rect.y, labelWidthStyleAdjust + rect.width - popupPos.width - buttonPlusPos.width - buttonMinusPos.width + widthAdjust, EditorGUIUtility.singleLineHeight); if (m_additionalDirectives[index].Origin == AdditionalContainerOrigin.Native) { m_nativeRect = rect; m_nativeRect.xMin += 2; m_nativeRect.xMax -= 2; m_nativeRect.yMax -= 2; #if UNITY_2019_3_OR_NEWER EditorGUI.LabelField(m_nativeRect, NativeFoldoutStr); #else NodeUtils.DrawNestedPropertyGroup(ref m_nativeDirectivesFoldout, rect, NativeFoldoutStr, DrawNativeItemsRect, 4); #endif return; } m_additionalDirectives[index].LineType = (AdditionalLineType)m_currOwner.EditorGUIEnumPopup(popupPos, m_additionalDirectives[index].LineType); if (m_additionalDirectives[index].LineType == AdditionalLineType.Include) { if (m_additionalDirectives[index].GUIDToggle) { //if( m_additionalDirectives[ index ].LibObject == null && !string.IsNullOrEmpty( m_additionalDirectives[ index ].GUIDValue ) ) //{ // m_additionalDirectives[ index ].LibObject = AssetDatabase.LoadAssetAtPath<TextAsset>( AssetDatabase.GUIDToAssetPath( m_additionalDirectives[ index ].GUIDValue ) ); //} EditorGUI.BeginChangeCheck(); TextAsset obj = m_currOwner.EditorGUIObjectField(labelPos, m_additionalDirectives[index].LibObject, typeof(TextAsset), false) as TextAsset; if (EditorGUI.EndChangeCheck()) { string pathName = AssetDatabase.GetAssetPath(obj); string extension = Path.GetExtension(pathName); extension = extension.ToLower(); if (extension.Equals(".cginc") || extension.Equals(".hlsl")) { m_additionalDirectives[index].LibObject = obj; m_additionalDirectives[index].GUIDValue = AssetDatabase.AssetPathToGUID(pathName); } } } else { m_additionalDirectives[index].LineValue = m_currOwner.EditorGUITextField(labelPos, string.Empty, m_additionalDirectives[index].LineValue); } if (GUI.Button(GUIDTogglePos, m_additionalDirectives[index].GUIDToggle ? UIUtils.FloatIntIconOFF : UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF)) { m_additionalDirectives[index].GUIDToggle = !m_additionalDirectives[index].GUIDToggle; } } else { m_additionalDirectives[index].LineValue = m_currOwner.EditorGUITextField(labelPos, string.Empty, m_additionalDirectives[index].LineValue); } if (GUI.Button(buttonPlusPos, string.Empty, UIUtils.PlusStyle)) { m_actionType = ReordableAction.Add; m_actionIndex = index; } if (GUI.Button(buttonMinusPos, string.Empty, UIUtils.MinusStyle)) { m_actionType = ReordableAction.Remove; m_actionIndex = index; } } }, onReorderCallback = ( ReorderableList list ) => { UpdateNativeIndex(); } }; } if (m_actionType != ReordableAction.None) { switch (m_actionType) { case ReordableAction.Add: { AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance <AdditionalDirectiveContainer>(); newItem.hideFlags = HideFlags.HideAndDontSave; m_additionalDirectives.Insert(m_actionIndex + 1, newItem); } break; case ReordableAction.Remove: AdditionalDirectiveContainer itemToDelete = m_additionalDirectives[m_actionIndex]; m_additionalDirectives.RemoveAt(m_actionIndex); ScriptableObject.DestroyImmediate(itemToDelete); break; } m_isDirty = true; m_actionType = ReordableAction.None; EditorGUI.FocusTextInControl(null); } bool foldoutValue = currOwner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDirectives; if (style) { NodeUtils.DrawPropertyGroup(ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons); } else { NodeUtils.DrawNestedPropertyGroup(ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons); } currOwner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDirectives = foldoutValue; }