Inheritance: UnityEditor.AssetPostprocessor
Esempio n. 1
0
    public override void OnInspectorGUI()
    {
        EditorGUI.BeginChangeCheck();
        DrawDefaultInspector();

        TextureModifier textureModifier = (TextureModifier)target;

        /*
         * //Params
         * GUILayout.Label("Params");
         * serializedObject.Update();
         * textureModifier.treeObject = (GameObject)EditorGUILayout.ObjectField(new GUIContent("Source", "Add object to fracture"), textureModifier.treeObject, typeof(GameObject), true);
         * serializedObject.ApplyModifiedProperties();
         * textureModifier.age = EditorGUILayout.IntField("Age", textureModifier.age);
         * textureModifier.agingValue = EditorGUILayout.FloatField("Aging value", textureModifier.agingValue);
         * textureModifier.nbOrigin = EditorGUILayout.IntField("Origin number", textureModifier.nbOrigin);
         * textureModifier.maxRadiusOrigin = EditorGUILayout.IntField("Max radius origin", textureModifier.maxRadiusOrigin);
         * textureModifier.variationValue = EditorGUILayout.FloatField("Variation value", textureModifier.variationValue);
         * textureModifier.colorRef = EditorGUILayout.ColorField("Color reference", textureModifier.colorRef);
         */
        Texture2D savedTex = AssetPreview.GetAssetPreview(textureModifier.savedTex);
        Texture2D tex      = AssetPreview.GetAssetPreview(textureModifier.tex);

        GUILayout.Label("Saved texture");
        GUILayout.Label(savedTex);
        GUILayout.Label("Actual texture");
        GUILayout.Label(tex);

        if (GUILayout.Button("Save Material"))
        {
            textureModifier.SaveMaterial();
        }

        if (GUILayout.Button("Restore Material"))
        {
            textureModifier.RestoreMaterial();
        }

        if (GUILayout.Button("Apply Aging"))
        {
            textureModifier.LaunchAgingTexture();
        }

        /*if (GUILayout.Button("Clear Tree"))
         * {
         *  textureModifier.ClearTree();
         * }*/
    }
        public void CopyTex(string infile, string outfilepath, string txtpath, TextureModifier.FilterParam filter) 
        {
            // テクスチャをロードし、フィルタを適用
            var srcTex = new Texture2D(1, 1, TextureFormat.RGBA32, false);
            srcTex.LoadImage( ImportCM.LoadTexture(infile) );
            Texture2D dstTex;
            dstTex = (filter != null) ? ACCTexturesView.Filter(srcTex, filter) : srcTex;

            WriteTexFile(outfilepath, txtpath, dstTex.EncodeToPNG());
            if (srcTex != dstTex) UnityEngine.Object.DestroyImmediate(dstTex);
            UnityEngine.Object.DestroyImmediate(srcTex);
        }
 public static Texture2D Filter(Texture2D srcTex, TextureModifier.FilterParam filterParam) {
     return textureModifier.ApplyFilter(srcTex, filterParam);
 }
Esempio n. 4
0
 private void OnEnable()
 {
     creator = target as TextureModifier;
 }
 public TexFilter(TextureModifier.FilterParam fp) {
     Hue = fp.Hue;
     Saturation = fp.Saturation;
     Lightness = fp.Lightness;
     InputMin = fp.InputMin;
     InputMax = fp.InputMax;
     InputMid = fp.InputMid;
     OutputMin = fp.OutputMin;
     OutputMax = fp.OutputMax;
 }