private void CloseConfiguration(bool saveOnDisk)
        {
            if (saveOnDisk)
            {
                Material mat    = m_CacheMaterials[currentMeshACIndex];
                Shader   shader = mat.shader;

                ShaderMetaDataUtility.SaveShaderMetaData(shader, m_LoadedAttributes);
                foreach (GameObject go in Selection.gameObjects)
                {
                    m_LikelySupportsTextureBlending = CheckForTextureBlendSupport(go);

                    if (m_LikelySupportsTextureBlending)
                    {
                        break;
                    }
                }

                if (m_CacheTarget != null)
                {
                    RebuildCaches(m_CacheTarget.editMesh);
                }
            }

            m_LoadedAttributes = null;
            m_CurrentPanelView = PanelView.Paint;
        }
Example #2
0
        /// <summary>
        /// Store the shader's attributes in the new format.
        /// Erase the .pbs.json on success.
        /// </summary>
        internal static void ConvertMetaDataToNewFormat(Shader shader)
        {
            if (shader == null)
            {
                throw new NullReferenceException("shader");
            }

            string path = ShaderMetaDataUtility.FindPolybrushMetaDataForShader(shader);

            // If not null, it means we have data stored with the old format.
            // Proceed to conversion.
            if (path != null)
            {
                AttributeLayoutContainer attributesContainer = ScriptableObject.CreateInstance <AttributeLayoutContainer>();
                ShaderMetaDataUtility.TryReadAttributeLayoutsFromJsonFile(path, out attributesContainer);
                if (attributesContainer != null)
                {
                    ShaderMetaDataUtility.SaveShaderMetaData(shader, attributesContainer);
                    FileUtil.DeleteFileOrDirectory(path);
                    FileUtil.DeleteFileOrDirectory(path + ".meta");
                    AssetDatabase.Refresh();
                }
            }
        }