protected override void Initialize() { base.Initialize(); NodePortDrawerHelper.DisableDefaultPortDrawer(this); isUnfolded = Property.Context.GetPersistent(this, nameof(isUnfolded), GeneralDrawerConfig.Instance.ExpandFoldoutByDefault); }
protected override void DrawPort(GUIContent label) { SirenixEditorGUI.BeginBox(); SirenixEditorGUI.BeginBoxHeader(); isUnfolded.Value = SirenixEditorGUI.Foldout(isUnfolded.Value, label == null ? GUIContent.none : label); NodePortDrawerHelper.DrawPortHandle(NodePortInfo); SirenixEditorGUI.EndBoxHeader(); if (SirenixEditorGUI.BeginFadeGroup(this, isUnfolded.Value)) { CallNextDrawer(null); } SirenixEditorGUI.EndFadeGroup(); SirenixEditorGUI.EndBox(); }
protected sealed override void DrawPropertyLayout(GUIContent label) { if (NodePortDrawerHelper.DisplayMissingPort(Property, PortResolver, NodePortInfo)) { return; } if (Event.current.type == EventType.Layout && !NodeEditorWindow.current.IsDraggingPort) { switch (NodePortInfo.ShowBackingValue) { case ShowBackingValue.Always: DrawValue = true; break; case ShowBackingValue.Never: DrawValue = false; break; case ShowBackingValue.Unconnected: DrawValue = !NodePortInfo.Port.IsConnected; break; } IsVisible = !NodePortInfo.Node.folded; IsVisible |= NodePortInfo.ShowBackingValue == ShowBackingValue.Always; IsVisible |= PortResolver is IDynamicDataNodePropertyPortResolver; // Dynamics will be folded somewhere else IsVisible |= NodePortInfo.Port.IsConnected; IsVisible |= !CanFold; DrawValue &= NodePortInfo.HasValue; } if (!IsVisible) { return; } DrawPort(label); }
protected override void DrawPort(GUIContent label) { SirenixEditorGUI.BeginBox(); SirenixEditorGUI.BeginBoxHeader(); if (label != null) { EditorGUILayout.LabelField(label); } NodePortDrawerHelper.DrawPortHandle(NodePortInfo); SirenixEditorGUI.EndBoxHeader(); if (DrawValue) { CallNextDrawer(null); } else { GUILayout.Space(-3.5f); } SirenixEditorGUI.EndBox(); }
protected override void DrawPort(GUIContent label) { NodePortDrawerHelper.DrawPortHandle(NodePortInfo, 0); }
protected override void Initialize() { base.Initialize(); NodePortDrawerHelper.DisableDefaultPortDrawer(this); }
protected override void DrawPort(GUIContent label) { if (hideContents) { NodePortDrawerHelper.DrawPortHandle(NodePortInfo); // Offset back to make up for the port draw GUILayout.Space(-18); return; } using (new EditorGUILayout.HorizontalScope()) { NodePortDrawerHelper.DrawPortHandle(NodePortInfo); // Offset back to make up for the port draw GUILayout.Space(-4); // Collections don't have the same kinds of labels if (Property.ChildResolver is ICollectionResolver) { CallNextDrawer(label); return; } bool drawLabel = label != null && label != GUIContent.none; if (NodePortInfo.Port.IsInput) { if (drawLabel) { if (DrawValue) { EditorGUILayout.LabelField(label, GUILayout.Width(GUIHelper.BetterLabelWidth)); } else { EditorGUILayout.LabelField(label, GUILayout.MaxWidth(float.MaxValue), GUILayout.ExpandWidth(true)); } } if (DrawValue) { using (new EditorGUILayout.VerticalScope()) CallNextDrawer(null); } if (!DrawValue || drawLabel && Property.Parent != null && Property.Parent.ChildResolver is GroupPropertyResolver) { GUILayout.FlexibleSpace(); } } else { if (!DrawValue || drawLabel && Property.Parent != null && Property.Parent.ChildResolver is GroupPropertyResolver) { GUILayout.FlexibleSpace(); } if (DrawValue) { using (new EditorGUILayout.VerticalScope()) CallNextDrawer(null); } if (drawLabel) { if (DrawValue) { EditorGUILayout.LabelField(label, NodeEditorResources.OutputPort, GUILayout.Width(GUIHelper.BetterLabelWidth)); } else { EditorGUILayout.LabelField(label, NodeEditorResources.OutputPort, GUILayout.MaxWidth(float.MaxValue), GUILayout.ExpandWidth(true)); } } } } }