public override void Draw(DrawInfo drawInfo) { base.Draw(drawInfo); if (m_forceNodeUpdate) { m_forceNodeUpdate = false; if (UIUtils.CurrentShaderVersion() > 15) { m_currentSelected = UIUtils.GetNode(m_nodeId) as RegisterLocalVarNode; m_referenceId = UIUtils.GetLocalVarNodeRegisterId(m_nodeId); if (m_currentSelected != null) { m_currentSelected.OnPropagatePreviewChange -= OnRegisterUpdate; m_currentSelected.OnPropagatePreviewChange += OnRegisterUpdate; } } else { m_currentSelected = UIUtils.GetLocalVarNode(m_referenceId); if (m_currentSelected != null) { m_currentSelected.OnPropagatePreviewChange -= OnRegisterUpdate; m_currentSelected.OnPropagatePreviewChange += OnRegisterUpdate; m_nodeId = m_currentSelected.UniqueId; } } if (m_currentSelected != null) { m_outputPorts[0].ChangeType(m_currentSelected.OutputPorts[0].DataType, false); } } UpdateLocalVar(); }
public override void DrawProperties() { base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_referenceId = EditorGUILayout.Popup(Constants.AvailableReferenceStr, m_referenceId, UIUtils.LocalVarNodeArr()); if (EditorGUI.EndChangeCheck()) { if (m_currentSelected != null) { m_currentSelected.OnPropagatePreviewChange -= OnRegisterUpdate; } m_currentSelected = UIUtils.GetLocalVarNode(m_referenceId); if (m_currentSelected != null) { m_nodeId = m_currentSelected.UniqueId; m_outputPorts[0].ChangeType(m_currentSelected.OutputPorts[0].DataType, false); m_currentSelected.OnPropagatePreviewChange -= OnRegisterUpdate; m_currentSelected.OnPropagatePreviewChange += OnRegisterUpdate; } m_sizeIsDirty = true; m_isDirty = true; } }
public void AddLocalVarInstructions() { List <ParentNode> localVarNodes = UIUtils.CurrentWindow.CurrentGraph.LocalVarNodes.NodesList; int count = localVarNodes.Count; List <RegisterLocalVarNode> sortedList = new List <RegisterLocalVarNode>(count); for (int i = 0; i < count; i++) { RegisterLocalVarNode node = localVarNodes[i] as RegisterLocalVarNode; sortedList.Add(node); } sortedList.Sort((x, y) => { return(x.OrderIndex.CompareTo(y.OrderIndex)); }); for (int i = 0; i < count; i++) { string newInstruction = sortedList[i].CreateLocalVariable(0, WirePortDataType.FLOAT, ref UIUtils.CurrentDataCollector, false); if (UIUtils.CurrentDataCollector.DirtySpecialLocalVariables) { UIUtils.CurrentDataCollector.AddInstructions(UIUtils.CurrentDataCollector.SpecialLocalVariables); UIUtils.CurrentDataCollector.ClearSpecialLocalVariables(); } UIUtils.CurrentDataCollector.AddInstructions(newInstruction); } }
void UpdateLocalVar() { if (m_referenceId > -1) { m_currentSelected = UIUtils.GetLocalVarNode(m_referenceId); if (m_currentSelected != null) { if (m_currentSelected.OutputPorts[0].DataType != m_outputPorts[0].DataType) { m_outputPorts[0].ChangeType(m_currentSelected.OutputPorts[0].DataType, false); } m_additionalContent.text = string.Format(Constants.PropertyValueLabel, m_currentSelected.DataToArray); if (m_referenceWidth != m_currentSelected.Position.width) { m_referenceWidth = m_currentSelected.Position.width; m_sizeIsDirty = true; } m_currentSelected.OnPropagatePreviewChange -= OnRegisterUpdate; m_currentSelected.OnPropagatePreviewChange += OnRegisterUpdate; } else { if (m_currentSelected != null) { m_currentSelected.OnPropagatePreviewChange -= OnRegisterUpdate; } m_referenceId = -1; m_referenceWidth = -1; m_additionalContent.text = string.Empty; } } }
public void ResetReference() { m_currentSelected = null; m_nodeId = -1; m_referenceId = -1; m_referenceWidth = -1; SetAdditonalTitleText(string.Empty); }
public override void Destroy() { base.Destroy(); if (m_currentSelected != null) { m_currentSelected.OnPropagatePreviewChange -= OnRegisterUpdate; } m_currentSelected = null; }
void UpdateLocalVar() { m_refSelect = false; if (m_referenceId > -1) { ParentNode newNode = UIUtils.GetLocalVarNode(m_referenceId); if (newNode != null) { if (newNode.UniqueId != m_nodeId) { m_currentSelected = null; int count = UIUtils.LocalVarNodeAmount(); for (int i = 0; i < count; i++) { ParentNode node = UIUtils.GetLocalVarNode(i); if (node.UniqueId == m_nodeId) { m_currentSelected = node as RegisterLocalVarNode; m_referenceId = i; break; } } } } if (m_currentSelected != null) { if (m_currentSelected.OutputPorts[0].DataType != m_outputPorts[0].DataType) { m_outputPorts[0].ChangeType(m_currentSelected.OutputPorts[0].DataType, false); } if (m_previousLabel != m_currentSelected.DataToArray) { m_previousLabel = m_currentSelected.DataToArray; SetAdditonalTitleText(string.Format(Constants.SubTitleVarNameFormatStr, m_currentSelected.DataToArray)); } if (m_referenceWidth != m_currentSelected.Position.width) { m_referenceWidth = m_currentSelected.Position.width; m_sizeIsDirty = true; } if (m_currentSelected.Selected) { m_refSelect = true; } } else { m_nodeId = -1; m_referenceId = -1; m_referenceWidth = -1; SetAdditonalTitleText(string.Empty); } } }
public void ResetReference() { m_outputPorts[0].Locked = true; m_currentSelected = null; m_inputPorts[0].DummyClear(); m_nodeId = -1; m_referenceId = -1; m_referenceWidth = -1; SetAdditonalTitleText(string.Empty); }
void UpdateFromSelected() { m_currentSelected = UIUtils.GetLocalVarNode(m_referenceId); if (m_currentSelected != null) { m_nodeId = m_currentSelected.UniqueId; m_outputPorts[0].ChangeType(m_currentSelected.OutputPorts[0].DataType, false); m_drawPreviewAsSphere = m_currentSelected.SpherePreview; CheckSpherePreview(); } m_sizeIsDirty = true; m_isDirty = true; }
void UpdateLocalVar() { if (m_referenceId > -1) { ParentNode newNode = UIUtils.GetLocalVarNode(m_referenceId); if (newNode != null) { if (newNode.UniqueId != m_nodeId) { m_currentSelected = null; int count = UIUtils.LocalVarNodeAmount(); for (int i = 0; i < count; i++) { ParentNode node = UIUtils.GetLocalVarNode(i); if (node.UniqueId == m_nodeId) { m_currentSelected = node as RegisterLocalVarNode; m_referenceId = i; break; } } } } if (m_currentSelected != null) { if (m_currentSelected.OutputPorts[0].DataType != m_outputPorts[0].DataType) { m_outputPorts[0].ChangeType(m_currentSelected.OutputPorts[0].DataType, false); } m_additionalContent.text = string.Format(Constants.PropertyValueLabel, m_currentSelected.DataToArray); if (m_referenceWidth != m_currentSelected.Position.width) { m_referenceWidth = m_currentSelected.Position.width; m_sizeIsDirty = true; } } else { m_nodeId = -1; m_referenceId = -1; m_referenceWidth = -1; m_additionalContent.text = string.Empty; } } }
public override void RefreshExternalReferences() { if (UIUtils.CurrentShaderVersion() > 15) { m_currentSelected = UIUtils.GetNode(m_nodeId) as RegisterLocalVarNode; m_referenceId = UIUtils.GetLocalVarNodeRegisterId(m_nodeId); } else { m_currentSelected = UIUtils.GetLocalVarNode(m_referenceId); if (m_currentSelected != null) { m_nodeId = m_currentSelected.UniqueId; } } if (m_currentSelected != null) { m_outputPorts[0].ChangeType(m_currentSelected.OutputPorts[0].DataType, false); } }
public override void Destroy() { base.Destroy(); m_currentSelected = null; }