public void DrawButton(SF_EditorNodeData entry, ref Rect btnRect) { GUI.color = entry.isProperty ? SF_Node.colorExposed : Color.white; bool usable = !(!entry.availableInDeferredPrePass && editor.ps.catLighting.renderPath == SFPSC_Lighting.RenderPath.Deferred); if (!usable) { //GUI.color = Color.red; GUI.enabled = false; } bool mouseOver = btnRect.Contains(Event.current.mousePosition); if (usable) { if (dragNode == entry) { GUI.color = SF_GUI.selectionColorBright; } else if (mouseOver && dragNode == null) { GUI.color = SF_GUI.selectionColorBrighter; } } GUI.Label(btnRect, (usable ? string.Empty : " ") + entry.nodeName, styleButton); if (mouseOver && Event.current.type == EventType.MouseDown && Event.current.button == 0 && usable) { OnStartDrag(entry); } else if (Event.current.type == EventType.ContextClick) { Vector2 mousePos = Event.current.mousePosition; if (btnRect.Contains(mousePos)) { // Now create the menu, add items and show it GenericMenu menu = new GenericMenu(); editor.ResetRunningOutdatedTimer(); //menu.AddItem( new GUIContent("Edit Comment"), false, ContextClick, "cmt_edit" ); menu.AddItem(new GUIContent("What does " + entry.nodeName + " do?"), false, ContextClick, entry); menu.ShowAsContext(); Event.current.Use(); } } GUI.color = Color.white; if (entry.isNew || entry.isUnstable) { GUIStyle miniStyle = new GUIStyle(EditorStyles.miniBoldLabel); miniStyle.alignment = TextAnchor.UpperRight; miniStyle.normal.textColor = Color.red; GUI.Label(btnRect, entry.isNew ? "New" : "Unstable", miniStyle); } if (usable) { SF_GUI.AssignCursor(btnRect, MouseCursor.Pan); } else { if (Event.current.type == EventType.Repaint) { GUI.enabled = true; SF_GUI.DrawLock(btnRect.PadTop(4), "Forward rendering only", TextAlignment.Right); //Draw(btnRect.PadTop(4), false, true, true, false); // Draw lock GUI.enabled = false; } } GUI.enabled = true; btnRect.y += btnRect.height; }
public void Draw(Vector2 pos) { bool isUnconnectedChild = IsChild() && !IsConnected(); if (ShouldBeInvisible()) { return; } // Don't draw if invalid rect = new Rect(pos.x, pos.y, defaultConnectorWidth, 14); if (conType == ConType.cInput) { rect.x -= node.rect.width + rect.width; } if (conType == ConType.cInput) { rect.xMin -= node.extraWidthInput; } else { rect.width += node.extraWidthOutput; } //GUIStyle cStyle = conType == ConType.cInput ? EditorStyles.miniButtonRight : EditorStyles.miniButtonLeft; //GUIStyle cStyle = (GUIStyle)"ShurikenModuleTitle"; if (!DisplayLock()) { GUI.color = GetConnectorColor(); GUI.Box(rect, string.Empty); if (SF_GUI.ProSkin) { GUI.Box(rect, string.Empty); GUI.Box(rect, string.Empty); GUI.Box(rect, string.Empty); } } if (SF_GUI.ProSkin) { GUI.color = DisplayAsValid() ? Color.white : Color.grey; } else { GUI.color = DisplayAsValid() ? Color.white : new Color(1f, 1f, 1f, 0.25f); } bool showConditionA = !(Hovering(true) && canValidlyConnectToPending); bool showConditionB = !(SF_NodeConnector.pendingConnectionSource == this); if (HasErrors() && (showConditionA && showConditionB)) { Rect iconRect = new Rect(rect); iconRect.x -= SF_Styles.IconErrorSmall.width; iconRect.height = iconRect.width = 16; iconRect.y -= 1; GUI.DrawTexture(iconRect, SF_Styles.IconErrorSmall); } Rect labelRect = rect; if (SF_Debug.nodes) { Rect typeRect = rect; typeRect.width *= 3f; if (conType == ConType.cInput) { GUI.skin.label.alignment = TextAnchor.MiddleLeft; typeRect.x += rect.width; } else { GUI.skin.label.alignment = TextAnchor.MiddleRight; typeRect.x -= typeRect.width; } GUI.Label(typeRect, valueType.ToString()); GUI.skin.label.alignment = TextAnchor.MiddleLeft; } if (outerLabel) { labelRect.width = node.rect.width; //labelRect.x -= EditorStyles.miniLabel.CalcSize( new GUIContent( label ) ).x + 4; labelRect.x += rect.width + 4; } GUI.Label(labelRect, isUnconnectedChild ? "+" : label, isUnconnectedChild ? EditorStyles.boldLabel : SF_Styles.MiniLabelOverflow); if (DisplayLock()) { Rect lockRect = labelRect; lockRect.xMin = node.rect.xMin - lockRect.height - 3; lockRect.xMax = node.rect.xMax; lockRect.yMin -= 3; lockRect.yMax += 4; GUI.color = new Color(0.8f, 0.8f, 0.8f, 0.3f); GUI.Box(lockRect, string.Empty, GUI.skin.button); GUI.color = Color.white; //GUI.color = Color.white; //GUI.Label(lockRect,"//"); //GUI.drawe //GUI.Box(lockRect, "", ); if (Event.current.type == EventType.Repaint) { SF_GUI.DrawLock(lockRect.PadTop(4), "Unavailable when using deferred rendering", TextAlignment.Right); } } CheckIfDeleted(); GUI.color = Color.white; }