public void SetOutputValueType(ValueType vt) { //Debug.Log("Trying to set to " + vt); if (vt == ValueType.VTv1v2) { vt = ValueType.VTv2; } if (vt == ValueType.VTv1v3) { vt = ValueType.VTv3; } if (vt == ValueType.VTv1v4) { vt = ValueType.VTv4; } output.SetValueType(vt); int ccCalc; if (SF_Tools.CompCountOf(vt, out ccCalc)) { if (ccCalc != output.node.texture.CompCount) { //Debug.Log("Trying to set to " + ccCalc + " from " + vt); output.node.texture.CompCount = ccCalc; } } //Debug.Log("Setting output type of " + output.node.nodeName + " to " + output.valueType); // THIS IS SET TO PENDING VOR VEC1 INPUTS }
public override void OnInspectorGUI() { GUI.enabled = true; Shader shader = base.target as Shader; if (!SF_Tools.CanRunShaderForge()) { SF_Tools.UnityOutOfDateGUI(); return; } //EditorGUILayout.InspectorTitlebar( false, base.target ); if (hasShaderForgeData) { if (GUILayout.Button("Open in Shader Forge")) { if (Event.current.rawType != EventType.MouseDown) { SF_Editor.Init(shader); } } } else { GUILayout.BeginHorizontal(); { //GUILayout.Label(SF_Styles.IconWarningSmall,GUILayout.Width(18),GUILayout.Height(18)); GUI.color = Color.gray; GUILayout.Label("No Shader Forge data found!", EditorStyles.miniLabel); GUI.color = Color.white; } GUILayout.EndHorizontal(); //GUILayout.Label( "Opening this will clear the shader", EditorStyles.miniLabel ); //GUI.color = new Color( 1f, 0.8f, 0.8f ); if (GUILayout.Button(new GUIContent("Replace with Shader Forge shader", SF_Styles.IconWarningSmall, "This will erase any existing shader code"), hasShaderForgeData ? "Button" : "MiniButton")) { if (SF_GUI.AcceptedNewShaderReplaceDialog()) { SF_Editor.Init(shader); SF_Editor.instance.ps.fChecker.UpdateAvailability(); SF_Editor.instance.OnShaderModified(NodeUpdateType.Hard); } } //GUI.color = Color.white; } if (SF_Tools.advancedInspector) { GUILayout.BeginHorizontal(); { GUIStyle btnStyle = hasShaderForgeData ? "MiniButton" : "Button"; if (GUILayout.Button("Open shader code", btnStyle)) { UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(AssetDatabase.GetAssetPath(shader), 1); } //if( GUILayout.Button( "Open compiled", btnStyle ) ) { // OpenCompiledShader( shader ); //} } GUILayout.EndHorizontal(); } DrawUnitysInspector(); }
public override float EvalCPU(int c) { return(SF_Tools.Frac(GetInputData("IN", c))); }