private void GetParams() { if (!input.HasInput) { return; } pintensity = intensity; pnoiseReduction = noiseReduction; pdirectx = directx; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Intensity")) { pintensity = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "Intensity")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "DirectX")) { pdirectx = Utils.ConvertToBool(ParentGraph.GetParameterValue(Id, "DirectX")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "NoiseReduction")) { pnoiseReduction = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "NoiseReduction")); } }
public override void RenderNodePreview() { if( m_outputPorts == null ) return: ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph: ContainerGraph.ParentWindow.CustomGraph = m_functionGraph: if( m_functionGraph != null ) { for( int i = 0: i < m_functionGraph.AllNodes.Count: i++ ) { ParentNode node = m_functionGraph.AllNodes[ i ]: if( node != null ) { node.RenderNodePreview(): } } } ContainerGraph.ParentWindow.CustomGraph = cachedGraph: SetPreviewInputs(): int count = m_outputPorts.Count: for( int i = 0: i < count: i++ ) { m_outputPorts[ i ].OutputPreviewTexture = m_allFunctionOutputs[ i ].PreviewTexture: } }
void Process() { GLTextuer2D i1 = (GLTextuer2D)input.Input.Data; if (i1 == null) { return; } if (i1.Id == 0) { return; } CreateBufferIfNeeded(); float pintensity = intensity; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Intensity")) { pintensity = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "Intensity")); } processor.TileX = tileX; processor.TileY = tileY; processor.DirectX = directx; processor.Intensity = pintensity; processor.Process(width, height, i1, buffer); processor.Complete(); Updated(); Output.Data = buffer; Output.Changed(); }
public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar) { ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; m_outsideGraph = cachedGraph; ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; if (m_reordenator != null && m_reordenator.RecursiveCount() > 0 && m_reordenator.HasTitle) { dataCollector.AddToProperties(UniqueId, "[Header(" + m_reordenator.HeaderTitle + ")]", m_reordenator.OrderIndex); } string result = string.Empty; for (int i = 0; i < m_allFunctionInputs.Count; i++) { if (m_inputPorts[i].IsConnected) { m_allFunctionInputs[i].OnPortGeneration += FunctionNodeOnPortGeneration; } } result += m_allFunctionOutputs[outputId].GenerateShaderForOutput(outputId, ref dataCollector, ignoreLocalvar); for (int i = 0; i < m_allFunctionInputs.Count; i++) { if (m_inputPorts[i].IsConnected) { m_allFunctionInputs[i].OnPortGeneration -= FunctionNodeOnPortGeneration; } } ContainerGraph.ParentWindow.CustomGraph = cachedGraph; return(result); }
public override void Draw(DrawInfo drawInfo) { //CheckForChangesRecursively(); if (!m_initialGraphDraw && drawInfo.CurrentEventType == EventType.Repaint) { m_initialGraphDraw = true; ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; if (m_functionGraph != null) { for (int i = 0; i < m_functionGraph.AllNodes.Count; i++) { ParentNode node = m_functionGraph.AllNodes[i]; if (node != null) { node.OnNodeLayout(drawInfo); } } } ContainerGraph.ParentWindow.CustomGraph = cachedGraph; } base.Draw(drawInfo); }
private void Input_OnInputRemoved(NodeInput n) { if (ParentGraph != null && !string.IsNullOrEmpty(varName)) { ParentGraph.SetVar(varName, null, output.Type); } }
private void GetParams() { prange = range; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Range")) { MVector v = ParentGraph.GetParameterValue <MVector>(Id, "Range"); if (v.W <= 0) { prange.min[0] = prange.min[1] = prange.min[2] = v.X; prange.mid[0] = prange.mid[1] = prange.mid[2] = v.Y; prange.max[0] = prange.max[1] = prange.max[2] = v.Z; } else if (v.W <= 1) { prange.min[0] = v.X; prange.mid[0] = v.Y; prange.max[0] = v.Z; } else if (v.W <= 2) { prange.min[1] = v.X; prange.mid[1] = v.Y; prange.max[1] = v.Z; } else if (v.W <= 3) { prange.min[2] = v.X; prange.mid[2] = v.Y; prange.max[2] = v.Z; } } }
private void GetParams() { if (!input.HasInput || !input2.HasInput) { return; } predChannel = redChannel; pgreenChannel = greenChannel; pblueChannel = blueChannel; palphaChannel = alphaChannel; if (ParentGraph != null) { if (ParentGraph.HasParameterValue(Id, "RedChannel")) { predChannel = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "RedChannel")); } if (ParentGraph.HasParameterValue(Id, "GreenChannel")) { pgreenChannel = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "GreenChannel")); } if (ParentGraph.HasParameterValue(Id, "BlueChannel")) { pblueChannel = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "BlueChannel")); } if (ParentGraph.HasParameterValue(Id, "AlphaChannel")) { palphaChannel = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "AlphaChannel")); } } }
protected virtual void Process() { object d = null; if (ParentGraph != null) { d = ParentGraph.GetVar(varName); } output.Data = d; if (output.Data != null) { result = output.Data.ToString(); } if (ParentGraph != null) { FunctionGraph g = (FunctionGraph)ParentGraph; if (g != null && g.OutputNode == this) { g.Result = output.Data; } } }
public override void OnNodeLogicUpdate(DrawInfo drawInfo) { base.OnNodeLogicUpdate(drawInfo); ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; int nodeCount = m_functionGraph.AllNodes.Count; for (int i = 0; i < nodeCount; i++) { m_functionGraph.AllNodes[i].OnNodeLogicUpdate(drawInfo); } ContainerGraph.ParentWindow.CustomGraph = cachedGraph; if (m_portsChanged) { m_portsChanged = false; for (int i = 0; i < m_allFunctionOutputs.Count; i++) { m_outputPorts[i].ChangeType(m_allFunctionOutputs[i].InputPorts[0].DataType, false); } CheckPortVisibility(); } }
public override void OnNodeLogicUpdate(DrawInfo drawInfo) { CheckForChangesRecursively(); base.OnNodeLogicUpdate(drawInfo); ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; if (m_functionGraph != null) { int nodeCount = m_functionGraph.AllNodes.Count; for (int i = 0; i < nodeCount; i++) { m_functionGraph.AllNodes[i].OnNodeLogicUpdate(drawInfo); } //if( !string.IsNullOrEmpty( FunctionGraph.CurrentFunctionOutput.SubTitle ) ) //{ // SetAdditonalTitleText( FunctionGraph.CurrentFunctionOutput.SubTitle ); //} } ContainerGraph.ParentWindow.CustomGraph = cachedGraph; if (m_portsChanged) { m_portsChanged = false; for (int i = 0; i < m_allFunctionOutputs.Count; i++) { m_outputPorts[i].ChangeType(m_allFunctionOutputs[i].InputPorts[0].DataType, false); } CheckPortVisibility(); } }
public override void RenderNodePreview() { if (m_outputPorts == null) { return; } ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; if (m_functionGraph != null) { for (int i = 0; i < m_functionGraph.AllNodes.Count; i++) { ParentNode node = m_functionGraph.AllNodes[i]; if (node != null) { node.RenderNodePreview(); } } } ContainerGraph.ParentWindow.CustomGraph = cachedGraph; SetPreviewInputs(); int count = m_outputPorts.Count; for (int i = 0; i < count; i++) { m_outputPorts[i].OutputPreviewTexture = m_allFunctionOutputs[i].PreviewTexture; } }
public string GetTexture2DArrayUniformValue() { ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; if (outsideGraph.SamplingThroughMacros) { if (outsideGraph.IsSRP) { if (m_useSamplerArrayIdx == 0) { return(string.Format(Constants.TexDeclarationSRPMacros[TextureType.Texture2DArray], PropertyName)); } else { return(string.Format(Constants.TexDeclarationNoSamplerSRPMacros[TextureType.Texture2DArray], PropertyName)); } } else { if (m_useSamplerArrayIdx == 0) { return(string.Format(Constants.TexDeclarationStandardMacros[TextureType.Texture2DArray], PropertyName)); } else { return(string.Format(Constants.TexDeclarationNoSamplerStandardMacros[TextureType.Texture2DArray], PropertyName)); } } } return("uniform TEXTURE2D_ARRAY( " + PropertyName + " );" + "\nuniform SAMPLER( sampler" + PropertyName + " );"); }
private void GetParams() { pfontSize = fontSize; palignment = alignment; pstyle = style; pspacing = spacing; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "FontSize")) { pfontSize = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "FontSize")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Spacing")) { pspacing = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "Spacing")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Style")) { pstyle = (FontStyle)Convert.ToInt32(ParentGraph.GetParameterValue(Id, "Style")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Alignment")) { palignment = (TextAlignment)Convert.ToInt32(ParentGraph.GetParameterValue(Id, "Alignment")); } if (string.IsNullOrEmpty(text)) { lines = new string[0]; } else { lines = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); } }
void Process() { GLTextuer2D i1 = (GLTextuer2D)input.Input.Data; if (i1 == null) { return; } if (i1.Id == 0) { return; } CreateBufferIfNeeded(); float pgamma = gamma; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Gamma")) { pgamma = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "Gamma")); } processor.TileX = tileX; processor.TileY = tileY; processor.Gamma = pgamma; processor.Process(width, height, i1, buffer); processor.Complete(); Updated(); output.Data = buffer; output.Changed(); }
void Process() { if (string.IsNullOrEmpty(varName)) { return; } if (ParentGraph != null) { ParentGraph.SetVar(varName, input.Input.Data, output.Type); } output.Data = input.Input.Data; if (output.Data != null) { result = output.Data.ToString(); } if (ParentGraph != null) { FunctionGraph g = (FunctionGraph)ParentGraph; if (g != null && g.OutputNode == this) { g.Result = output.Data; } } }
private void GetParams() { if (!input.HasInput || !input1.HasInput) { return; } pintensity = intensity; bintensity = blurIntensity; pangle = angle; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Intensity")) { pintensity = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "Intensity")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "BlurIntensity")) { bintensity = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "BlurIntensity")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Angle")) { pangle = Utils.ConvertToFloat(ParentGraph.GetParameterValue(Id, "Angle")); } }
void Process() { if (string.IsNullOrEmpty(varName)) { return; } if (ParentGraph != null) { ParentGraph.SetVar(varName, input.Input.Data); } output.Data = input.Input.Data; if (Outputs.Count > 0) { Outputs[0].Changed(); } if (ParentGraph != null) { FunctionGraph g = (FunctionGraph)ParentGraph; if (g != null && g.OutputNode == this) { g.Result = output.Data; } } }
public string GetCubeUniformValue() { ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; if (outsideGraph.SamplingThroughMacros) { if (outsideGraph.IsSRP) { if (m_useSamplerArrayIdx == 0) { return(string.Format(Constants.TexDeclarationSRPMacros[TextureType.Cube], PropertyName)); } else { return(string.Format(Constants.TexDeclarationNoSamplerSRPMacros[TextureType.Cube], PropertyName)); } } else { if (m_useSamplerArrayIdx == 0) { return(string.Format(Constants.TexDeclarationStandardMacros[TextureType.Cube], PropertyName)); } else { return(string.Format(Constants.TexDeclarationNoSamplerStandardMacros[TextureType.Cube], PropertyName)); } } } return("uniform samplerCUBE " + PropertyName + ";"); }
private void GetParams() { pred = red; pgreen = green; pblue = blue; palpha = alpha; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Red")) { pred = Convert.ToBoolean(ParentGraph.GetParameterValue(Id, "Red")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Green")) { pgreen = Convert.ToBoolean(ParentGraph.GetParameterValue(Id, "Green")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Blue")) { pblue = Convert.ToBoolean(ParentGraph.GetParameterValue(Id, "Blue")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Alpha")) { palpha = Convert.ToBoolean(ParentGraph.GetParameterValue(Id, "Alpha")); } }
void Process() { CreateBufferIfNeeded(); Vector4 pcolor = new Vector4(color.X, color.Y, color.Z, color.W); if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Color")) { object obj = ParentGraph.GetParameterValue(Id, "Color"); if (obj is MVector) { MVector m = (MVector)obj; pcolor.X = m.X; pcolor.Y = m.Y; pcolor.Z = m.Z; pcolor.W = m.W; } else if (obj is Vector4) { pcolor = (Vector4)obj; } } processor.Color = pcolor; processor.Process(width, height, null, buffer); processor.Complete(); Updated(); output.Data = buffer; output.Changed(); }
private void GetParams() { predChannel = redChannel; pgreenChannel = greenChannel; pblueChannel = blueChannel; palphaChannel = alphaChannel; if (ParentGraph != null) { if (ParentGraph.HasParameterValue(Id, "RedChannel")) { predChannel = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "RedChannel")); } if (ParentGraph.HasParameterValue(Id, "GreenChannel")) { pgreenChannel = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "GreenChannel")); } if (ParentGraph.HasParameterValue(Id, "BlueChannel")) { pblueChannel = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "BlueChannel")); } if (ParentGraph.HasParameterValue(Id, "AlphaChannel")) { palphaChannel = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "AlphaChannel")); } } }
private void GetParams() { if (!input.HasInput) { return; } pred = red; pgreen = green; pblue = blue; palpha = alpha; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Red")) { pred = Utils.ConvertToBool(ParentGraph.GetParameterValue(Id, "Red")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Green")) { pgreen = Utils.ConvertToBool(ParentGraph.GetParameterValue(Id, "Green")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Blue")) { pblue = Utils.ConvertToBool(ParentGraph.GetParameterValue(Id, "Blue")); } if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Alpha")) { palpha = Utils.ConvertToBool(ParentGraph.GetParameterValue(Id, "Alpha")); } }
private void CreateNewGraph(string graphName) { if (mainGraphInstance == null) { mainGraphInstance = CreateInstance <ParentGraph>(); mainGraphInstance.ParentWindow = this; } }
private string FunctionNodeOnPortGeneration( ref MasterNodeDataCollector dataCollector, int index, ParentGraph graph ) { ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; ContainerGraph.ParentWindow.CustomGraph = m_outsideGraph; string result = m_inputPorts[ index ].GeneratePortInstructions( ref dataCollector ); ContainerGraph.ParentWindow.CustomGraph = cachedGraph; return result; }
protected void DealWithLabelContentChanged() { MakeVisual(); if (ParentObject is DNode) { ParentGraph.ResizeNodeToLabel(ParentObject as DNode); } }
void Process() { GLTextuer2D i1 = (GLTextuer2D)input.Input.Data; GLTextuer2D i2 = (GLTextuer2D)input2.Input.Data; if (i1 == null || i1.Id == 0) { return; } if (i2 == null || i2.Id == 0) { return; } CreateBufferIfNeeded(); processor.TileX = tileX; processor.TileY = TileY; int predChannel = redChannel; int pgreenChannel = greenChannel; int pblueChannel = blueChannel; int palphaChannel = alphaChannel; if (ParentGraph != null) { if (ParentGraph.HasParameterValue(Id, "RedChannel")) { predChannel = Convert.ToInt32(ParentGraph.GetParameterValue(Id, "RedChannel")); } if (ParentGraph.HasParameterValue(Id, "GreenChannel")) { pgreenChannel = Convert.ToInt32(ParentGraph.GetParameterValue(Id, "GreenChannel")); } if (ParentGraph.HasParameterValue(Id, "BlueChannel")) { pblueChannel = Convert.ToInt32(ParentGraph.GetParameterValue(Id, "BlueChannel")); } if (ParentGraph.HasParameterValue(Id, "AlphaChannel")) { palphaChannel = Convert.ToInt32(ParentGraph.GetParameterValue(Id, "AlphaChannel")); } } processor.RedChannel = predChannel; processor.GreenChannel = pgreenChannel; processor.BlueChannel = pblueChannel; processor.AlphaChannel = palphaChannel; processor.Process(width, height, i1, i2, buffer); processor.Complete(); output.Data = buffer; output.Changed(); Updated(); }
public override bool GetUniformData(out string dataType, out string dataName, ref bool fullValue) { ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; if (outsideGraph.SamplingThroughMacros) { if (outsideGraph.IsSRP) { if (Constants.TexDeclarationSRPMacros.ContainsKey(m_currentType)) { if (m_useSamplerArrayIdx == 0) { dataName = string.Format(Constants.TexDeclarationSRPMacros[m_currentType], PropertyName); } else { dataName = string.Format(Constants.TexDeclarationNoSamplerSRPMacros[m_currentType], PropertyName); } dataType = string.Empty; fullValue = true; return(true); } } else if (Constants.TexDeclarationStandardMacros.ContainsKey(m_currentType)) { if (m_useSamplerArrayIdx == 0) { dataName = string.Format(Constants.TexDeclarationStandardMacros[m_currentType], PropertyName); } else { dataName = string.Format(Constants.TexDeclarationNoSamplerStandardMacros[m_currentType], PropertyName); } dataType = string.Empty; fullValue = true; return(true); } } if (m_currentType == TextureType.Texture2DArray) { MasterNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode; if (masterNode.CurrentDataCollector.IsTemplate && masterNode.CurrentDataCollector.IsSRP) { dataType = "TEXTURE2D_ARRAY( " + PropertyName + ""; dataName = ");\nuniform SAMPLER( sampler" + PropertyName + " )"; return(true); } dataType = "UNITY_DECLARE_TEX2DARRAY("; dataName = m_propertyName + " )"; return(true); } dataType = UIUtils.TextureTypeToCgType(m_currentType); dataName = m_propertyName; return(true); }
private void GetParams() { pinput = selected; if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Selected")) { pinput = (SwitchInput)Convert.ToInt32(ParentGraph.GetParameterValue(Id, "Selected")); } }
protected void DealWithLabelContentChanged(System.Windows.Size newSize) { Label.Width = newSize.Width; Label.Height = newSize.Height; if (ParentObject is DNode) { ParentGraph.ResizeNodeToLabel(ParentObject as DNode); } }