Exemplo n.º 1
0
        private static void reimportCompositeTexture(string p_id)
        {
            Texture2D texA = CompositeTextureData.getTexture(p_id).getTextureA();

            string assetPath = AssetDatabase.GetAssetPath(texA);

            updateAssetUserData(assetPath);
            AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate);
        }
Exemplo n.º 2
0
        void OnPostprocessTexture(Texture2D texture)
        {
            bool isCompositeTexture = false;

            try
            {
                //id = CompositeTexture.assetToGUID(texture);
                int instanceID = AssetDatabase.LoadMainAssetAtPath(assetPath).GetInstanceID();
                EDebug.Log("OnPostProcessTexture " + instanceID);
                if (CompositeTextureData.ExistsByInstanceID(instanceID) && CompositeTextureData.getTexture(instanceID).enabled)
                {
                    EDebug.Log("is an enabled composite texture");
                    isCompositeTexture = true;
                    ct = CompositeTextureData.getTexture(instanceID);
                }
            }
            catch (System.Exception)
            {
                EDebug.Log("exception in texture processor");
            }

            if (!isCompositeTexture)
            {
                return;
            }

            EDebug.Log("do work");
            NormalToRoughness nr = new NormalToRoughness();

            ProcessTexture(ct, texture);
            ct.getTextureA().setReadable(false);

            // Instead of setting pixels for each mip map levels, you can also
            // modify only the pixels in the highest mip level. And then simply use
            // texture.Apply(true); to generate lower mip levels.
        }