private void SetNodeInputFieldLinkNodeID(NodeEditorField nodeField, int nodeId) { object inputValueInstance = nodeField.GetValue(); INodeInputField inputField = inputValueInstance as INodeInputField; inputField.SetSourceNode(nodeId); nodeField.SetValue(inputValueInstance); nodeField._nodeEditorGUI.MarkAsDirty(true); }
private void RenderStaticValueBox(NodeEditorField nodeField, Vector2 position, Color color, float scale) { //Get _value field from the input field and then object inputValueInstance = nodeField.GetValue(); INodeInputField inputField = inputValueInstance as INodeInputField; if (inputField.IsStaticValue()) { object nodeValue = SerializedObjectMemberInfo.GetSerializedFieldInstance(inputValueInstance, "value"); if (nodeValue != null) { string labelText = nodeValue + " "; GUIContent labelContent = new GUIContent(labelText); Vector2 size = _nodeBoldTextStyle.CalcSize(labelContent); size.y = kLinkIconWidth * scale; size.x += kLinkIconWidth; Rect staticFieldPos = new Rect(position.x - size.x, position.y - size.y * 0.5f, size.x, size.y); Handles.BeginGUI(); Handles.color = color; Handles.DrawSolidDisc(new Vector3(staticFieldPos.x + kLinkIconWidth * 0.25f, staticFieldPos.y + kLinkIconWidth * 0.5f * scale, 0.0f), -Vector3.forward, kLinkIconWidth * 0.5f * scale); Handles.EndGUI(); Color origBackgroundColor = GUI.backgroundColor; GUI.backgroundColor = color; GUI.BeginGroup(staticFieldPos, EditorUtils.ColoredRoundedBoxStyle); { GUI.Label(new Rect(0, 0, staticFieldPos.width, staticFieldPos.height), labelContent, _nodeBoldTextStyle); } GUI.EndGroup(); } } }