public static MaterialExistence CheckIfMaterialExists(MouldingColour.Id id) { if (File.Exists(MaterialPathUtility.GetPath(id))) { return(MaterialExistence.Current); } if (File.Exists(MaterialPathUtility.GetPath(id, true))) { return(MaterialExistence.Legacy); } // FIXME Remove when colour palette experiments are over. #if UNITY_EDITOR if (MouldingColour.GetBI()) { if (File.Exists(MaterialPathUtility.GetPath(id, false, true))) { return(MaterialExistence.Current); } if (File.Exists(MaterialPathUtility.GetPath(id, true, true))) { return(MaterialExistence.Legacy); } } #endif return(MaterialExistence.None); }
public static MaterialExistence CheckIfMaterialExists(MouldingColour.Id id) { if (File.Exists(MaterialPathUtility.GetPath(id))) { return(MaterialExistence.Current); } if (File.Exists(MaterialPathUtility.GetPath(id, true))) { return(MaterialExistence.Legacy); } // FIXME Remove when colour palette experiments are over. #if UNITY_EDITOR var useBI = EditorPrefs.GetBool("com.unity.lego.modelimporter.useBI"); if (useBI) { if (File.Exists(MaterialPathUtility.GetPath(id, false, true))) { return(MaterialExistence.Current); } if (File.Exists(MaterialPathUtility.GetPath(id, true, true))) { return(MaterialExistence.Legacy); } } #endif return(MaterialExistence.None); }
public static Material LoadMaterial(MouldingColour.Id id, bool legacy) { // FIXME Remove when colour palette experiments are over. #if UNITY_EDITOR if (MouldingColour.GetBI()) { var biMaterial = AssetDatabase.LoadAssetAtPath <Material>(MaterialPathUtility.GetPath(id, legacy, true)); if (biMaterial) { return(biMaterial); } } #endif #if UNITY_EDITOR return(AssetDatabase.LoadAssetAtPath <Material>(MaterialPathUtility.GetPath(id, legacy))); #else return(null); #endif }
public static Material LoadMaterial(MouldingColour.Id id, bool legacy) { // FIXME Remove when colour palette experiments are over. #if UNITY_EDITOR var useBI = EditorPrefs.GetBool("com.unity.lego.modelimporter.useBI"); if (useBI) { var biMaterial = AssetDatabase.LoadAssetAtPath <Material>(MaterialPathUtility.GetPath(id, legacy, true)); if (biMaterial) { return(biMaterial); } } #endif #if UNITY_EDITOR return(AssetDatabase.LoadAssetAtPath <Material>(MaterialPathUtility.GetPath(id, legacy))); #else return(null); #endif }
public static string GetPath(MouldingColour.Id id, bool legacy = false, bool useBI = false) { return(Path.Combine(MaterialPathUtility.materialsPath, useBI ? biDir : "", legacy ? legacyDir : "", (int)id + ".mat")); }