public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); m_selectedChannelInt = Convert.ToInt32(GetCurrentParam(ref nodeParams)); //m_minSamples = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); //m_maxSamples = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); if (UIUtils.CurrentShaderVersion() < 15406) { m_inlineMinSamples.IntValue = Convert.ToInt32(GetCurrentParam(ref nodeParams)); m_inlineMaxSamples.IntValue = Convert.ToInt32(GetCurrentParam(ref nodeParams)); } else { m_inlineMinSamples.ReadFromString(ref m_currentReadParamIdx, ref nodeParams); m_inlineMaxSamples.ReadFromString(ref m_currentReadParamIdx, ref nodeParams); } m_sidewallSteps = Convert.ToInt32(GetCurrentParam(ref nodeParams)); m_defaultScale = Convert.ToSingle(GetCurrentParam(ref nodeParams)); m_defaultRefPlane = Convert.ToSingle(GetCurrentParam(ref nodeParams)); if (UIUtils.CurrentShaderVersion() > 3001) { m_clipEnds = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); string[] vector2Component = GetCurrentParam(ref nodeParams).Split(IOUtils.VECTOR_SEPARATOR); if (vector2Component.Length == 2) { m_tilling.x = Convert.ToSingle(vector2Component[0]); m_tilling.y = Convert.ToSingle(vector2Component[1]); } } if (UIUtils.CurrentShaderVersion() > 5005) { m_useCurvature = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); m_CurvatureVector = IOUtils.StringToVector2(GetCurrentParam(ref nodeParams)); } if (UIUtils.CurrentShaderVersion() > 13103) { if (UIUtils.CurrentShaderVersion() < 15307) { bool arrayIndexVisible = false; arrayIndexVisible = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); m_pomTexType = arrayIndexVisible ? POMTexTypes.TextureArray : POMTexTypes.Texture2D; } else { m_pomTexType = (POMTexTypes)Enum.Parse(typeof(POMTexTypes), GetCurrentParam(ref nodeParams)); } UpdateIndexPort(); } UpdateSampler(); GeneratePOMfunction(); UpdateCurvaturePort(); }
public override void DrawProperties() { base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_selectedChannelInt = EditorGUILayoutPopup("Channel", m_selectedChannelInt, m_channelTypeStr); if (EditorGUI.EndChangeCheck()) { UpdateSampler(); GeneratePOMfunction(); } EditorGUIUtility.labelWidth = 105; //m_minSamples = EditorGUILayoutIntSlider( "Min Samples", m_minSamples, 1, 128 ); UndoParentNode inst = this; m_inlineMinSamples.CustomDrawer(ref inst, (x) => { m_inlineMinSamples.IntValue = EditorGUILayoutIntSlider("Min Samples", m_inlineMinSamples.IntValue, 1, 128); }, "Min Samples"); //m_maxSamples = EditorGUILayoutIntSlider( "Max Samples", m_maxSamples, 1, 128 ); m_inlineMaxSamples.CustomDrawer(ref inst, (x) => { m_inlineMaxSamples.IntValue = EditorGUILayoutIntSlider("Max Samples", m_inlineMaxSamples.IntValue, 1, 128); }, "Max Samples"); EditorGUI.BeginChangeCheck(); m_sidewallSteps = EditorGUILayoutIntSlider("Sidewall Steps", m_sidewallSteps, 0, 10); if (EditorGUI.EndChangeCheck()) { GeneratePOMfunction(); } EditorGUI.BeginDisabledGroup(m_scalePort.IsConnected); m_defaultScale = EditorGUILayoutSlider("Default Scale", m_defaultScale, 0, 1); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(m_refPlanePort.IsConnected); m_defaultRefPlane = EditorGUILayoutSlider("Default Ref Plane", m_defaultRefPlane, 0, 1); EditorGUI.EndDisabledGroup(); EditorGUIUtility.labelWidth = m_textLabelWidth; EditorGUI.BeginChangeCheck(); //m_useTextureArray = EditorGUILayoutToggle( "Use Texture Array", m_useTextureArray ); m_pomTexType = (POMTexTypes)EditorGUILayoutEnumPopup("Texture Type", m_pomTexType); if (EditorGUI.EndChangeCheck()) { UpdateIndexPort(); m_sizeIsDirty = true; GeneratePOMfunction(); //UpdateCurvaturePort(); } if (m_arrayIndexPort.Visible && !m_arrayIndexPort.IsConnected) { m_arrayIndexPort.FloatInternalData = EditorGUILayoutFloatField("Array Index", m_arrayIndexPort.FloatInternalData); } //float cached = EditorGUIUtility.labelWidth; //EditorGUIUtility.labelWidth = 70; m_clipEnds = EditorGUILayoutToggle("Clip Edges", m_clipEnds); //EditorGUIUtility.labelWidth = -1; //EditorGUIUtility.labelWidth = 100; //EditorGUILayout.BeginHorizontal(); //EditorGUI.BeginDisabledGroup( !m_clipEnds ); //m_tilling = EditorGUILayout.Vector2Field( string.Empty, m_tilling ); //EditorGUI.EndDisabledGroup(); //EditorGUILayout.EndHorizontal(); //EditorGUIUtility.labelWidth = cached; EditorGUI.BeginChangeCheck(); m_useCurvature = EditorGUILayoutToggle("Clip Silhouette", m_useCurvature); if (EditorGUI.EndChangeCheck()) { GeneratePOMfunction(); UpdateCurvaturePort(); } EditorGUI.BeginDisabledGroup(!(m_useCurvature && !m_curvaturePort.IsConnected)); m_CurvatureVector = EditorGUILayoutVector2Field(string.Empty, m_CurvatureVector); EditorGUI.EndDisabledGroup(); EditorGUILayout.HelpBox("WARNING:\nTex must be connected to a Texture Object for this node to work\n\nMin and Max samples:\nControl the minimum and maximum number of layers extruded\n\nSidewall Steps:\nThe number of interpolations done to smooth the extrusion result on the side of the layer extrusions, min is used at steep angles while max is used at orthogonal angles\n\n" + "Ref Plane:\nReference plane lets you adjust the starting reference height, 0 = deepen ground, 1 = raise ground, any value above 0 might cause distortions at higher angles\n\n" + "Clip Edges:\nThis will clip the ends of your uvs to give a more 3D look at the edges. It'll use the tilling given by your Heightmap input.\n\n" + "Clip Silhouette:\nTurning this on allows you to use the UV coordinates to clip the effect curvature in U or V axis, useful for cylinders, works best with 'Clip Edges' turned OFF", MessageType.None); }