static public void CheckDiskIcon(string _name, TextureParam _out) { return; if (ms_LookupTextures == null) { ms_LookupTextures = new Dictionary <string, Texture>(); } Texture ret; //if (!ms_LookupTextures.TryGetValue(_name, out ret)) { string assetName = "Assets/TextureWang/Icons/" + _name + ".png"; TextureImporter importer = (TextureImporter)TextureImporter.GetAtPath(assetName); if (importer == null) { _out.SavePNG(assetName, 256, 256); //just for icons AssetDatabase.Refresh(); importer = (TextureImporter)TextureImporter.GetAtPath(assetName); if (importer) { importer.compressionQuality = importer.compressionQuality + 1; //try and force the import importer.SaveAndReimport(); ms_LookupTextures[_name] = _out.m_Destination; } } } }
public override void DrawNodePropertyEditor() { //GUI.changed = false; if (GUILayout.Button("save png")) { ms_PathName = EditorUtility.SaveFilePanel("SavePNG", "Assets/", ms_PathName, "png"); m_Param.SavePNG(ms_PathName, m_Param.m_Width, m_Param.m_Height); } m_TexMode = (TexMode)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Colors", "3 components per texture or one"), m_TexMode, GUILayout.MaxWidth(300)); m_PixelDepth = (ChannelType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Pixel Depth", "Bytes Per pixel/accuracy"), m_PixelDepth, GUILayout.MaxWidth(300)); m_ShowNames = EditorGUILayout.Foldout(m_ShowNames, "Input Rename:"); if (m_ShowNames) { foreach (var x in Inputs) { if (x == null) { continue; } GUILayout.BeginHorizontal(); x.name = (string)GUILayout.TextField(x.name); GUILayout.EndHorizontal(); } } EditorGUILayout.LabelField("TexWidth"); m_TexWidth = (int)EditorGUILayout.Slider(m_TexWidth, 1.0f, 2048.0f); EditorGUILayout.LabelField("TexHeight"); m_TexHeight = (int)EditorGUILayout.Slider(m_TexHeight, 1.0f, 2048.0f); GUI.skin.button.wordWrap = true; //EditorGUI.TextArea(new Rect(10, 10, 200, 100),"Info: " +GetHelp()); // Rect r=EditorGUILayout.BeginVertical(GUILayout.Height(100), GUILayout.Width(100)); GUILayout.TextArea("Info: " + GetHelp(), GUILayout.Height(100), GUILayout.Width(300)); // EditorGUILayout.EndVertical(); /* * if (m_Param!=null) * GUILayout.Label("outParam: Width: " + m_Param.m_Width + "outParam: Height: " + m_Param.m_Height); * * if (m_Param != null && m_Param.m_Destination!=null) * GUILayout.Label("HWDest: Width: " + m_Param.m_Destination.width + "HWDest: Height: " + m_Param.m_Destination.height+" fmt:"+ m_Param.m_Destination.format, EditorStyles.wordWrappedLabel); */ m_Saturate = GUILayout.Toggle(m_Saturate, "Clip result to 0..1"); m_Abs = GUILayout.Toggle(m_Abs, "Flip negative to positive (Abs)"); m_Filter = GUILayout.Toggle(m_Filter, "Apply Filtering when reading this nodes texture"); m_ClampInputUV = GUILayout.Toggle(m_ClampInputUV, "Clamp Input UV"); m_InvertInput = GUILayout.Toggle(m_InvertInput, "Invert Input"); m_InvertOutput = GUILayout.Toggle(m_InvertOutput, "Invert Output"); m_ShowLevels = EditorGUILayout.Foldout(m_ShowLevels, "Levels:"); if (m_ShowLevels) { m_InputMin.SliderLabel(this, "Scale Output In Min"); m_InputMax.SliderLabel(this, "Scale Output In Max"); m_OutputMin.SliderLabel(this, "Scale Output Out Min"); m_OutputGamma.SliderLabel(this, "Scale Output Gamma"); m_OutputMax.SliderLabel(this, "Scale Output Out Max"); } EditorGUILayout.Space(); RTEditorGUI.Seperator(); }