private void OpenConfiguration() { m_CurrentPanelView = PanelView.Configuration; if (m_MainCacheMaterials == null || m_CurrentMeshACIndex < 0 || m_CurrentMeshACIndex >= m_MainCacheMaterials.Count) { return; } Material mat = m_MainCacheMaterials[m_CurrentMeshACIndex]; Shader shader = mat.shader; if (ShaderMetaDataUtility.IsValidShader(shader)) { #pragma warning disable 0618 // Data conversion between Polybrush Beta and Polybrush 1.0. string path = ShaderMetaDataUtility.FindPolybrushMetaDataForShader(shader); if (!string.IsNullOrEmpty(path)) { ShaderMetaDataUtility.ConvertMetaDataToNewFormat(shader); } #pragma warning restore 0618 m_LoadedAttributes = ShaderMetaDataUtility.LoadShaderMetaData(shader); } }
/// <summary> /// Test a gameObject and it's mesh renderers for compatible shaders, and if one is found /// load it's attribute data into meshAttributes. /// </summary> /// <param name="go">The GameObject being checked for texture blend support</param> /// <returns></returns> internal bool CheckForTextureBlendSupport(GameObject go) { bool supports = false; var materials = Util.GetMaterials(go); m_MeshAttributesContainers.Clear(); Material mat; List <int> indexes = new List <int>(); for (int i = 0; i < materials.Count; i++) { mat = materials[i]; if (ShaderMetaDataUtility.IsValidShader(mat.shader)) { AttributeLayoutContainer detectedMeshAttributes = ShaderMetaDataUtility.LoadShaderMetaData(mat.shader); { if (detectedMeshAttributes != null) { m_MeshAttributesContainers.Add(detectedMeshAttributes); indexes.Add(i); m_MainCacheMaterials.Add(mat); supports = true; } } } } if (supports) { m_MeshAttributesContainer = m_MeshAttributesContainers.First(); foreach (int i in indexes) { ArrayUtility.Add <string>(ref m_AvailableMaterialsAsString, materials[i].name); } } if (meshAttributes == null) { supports = false; } return(supports); }