void Repair() { EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("This T4M Object is Broken", EditorStyles.boldLabel); EditorGUILayout.Space(); GUILayout.Label("Clean It and Reconvert it ?"); GUILayout.FlexibleSpace(); if (GUILayout.Button("CLEANING", GUILayout.Width(100), GUILayout.Height(30))) { T4MMainObj ToSuppress = CurrentSelect.GetComponent <T4MMainObj>(); DestroyImmediate(ToSuppress); T4MCache.T4MMenuToolbar = 0; } GUILayout.FlexibleSpace(); }
public void OnGUI() { CurrentSelect = T4MMainEditor.CurrentSelect; T4MMainObj mainObjT4MMain = CurrentSelect.GetComponent <T4MMainObj>(); if (mainObjT4MMain) { if (mainObjT4MMain.T4MMaterial && mainObjT4MMain.T4MMaterial.HasProperty("_Splat0") && mainObjT4MMain.T4MMaterial.HasProperty("_Splat1") && mainObjT4MMain.T4MMaterial.HasProperty("_Control")) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); BillM = GUILayout.Toolbar(BillM, BillMenu, GUILayout.Width(290), GUILayout.Height(20)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); switch (BillM) { case 0: if (T4MCache.T4MMaster) { Billboard(); } else { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Need to be an Master T4M", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } break; case 1: BillboardCreator(); break; } } } else { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Please, select the T4M Object", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } }
public void DeactivateBillBByScript() { T4MBillboard[] T4MBillObjGet = GameObject.FindObjectsOfType(typeof(T4MBillboard)) as T4MBillboard[]; for (var i = 0; i < T4MBillObjGet.Length; i++) { T4MBillObjGet[i].Render.enabled = true; T4MBillObjGet[i].Transf.LookAt(Vector3.zero, Vector3.up); } T4MMainObj mainObjT4MMain = CurrentSelect.GetComponent <T4MMainObj>(); mainObjT4MMain.BillboardPosition = new Vector3[0]; mainObjT4MMain.BillStatus = new int[0]; mainObjT4MMain.BillScript = new T4MBillboard[0]; PrefabUtility.RecordPrefabInstancePropertyModifications(mainObjT4MMain); Debug.LogWarning("The Number of Activated Billboard Objects has changed, reactivate the billboards in the 'Billboard' Tab."); }
void CreateControl2Text() { Texture2D Control2 = new Texture2D(512, 512, TextureFormat.ARGB32, true); Color[] ColorBase = new Color[512 * 512]; for (var t = 0; t < ColorBase.Length; t++) { ColorBase[t] = new Color(1, 0, 0, 0); } Control2.SetPixels(ColorBase); string path; T4MMainObj mainObjT4MMain = CurrentSelect.gameObject.GetComponent <T4MMainObj>(); if (mainObjT4MMain.T4MMaterial.GetTexture("_Control") != null) { path = T4MConfig.T4MPrefabFolder + "Terrains/Texture/" + mainObjT4MMain.T4MMaterial.GetTexture("_Control").name + "C2.png"; } else { path = T4MConfig.T4MPrefabFolder + "Terrains/Texture/" + CurrentSelect.gameObject.name + "C2.png"; } byte[] data = Control2.EncodeToPNG(); File.WriteAllBytes(path, data); AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate); TextureImporter TextureI = AssetImporter.GetAtPath(path) as TextureImporter; TextureI.textureFormat = TextureImporterFormat.ARGB32; TextureI.isReadable = true; TextureI.anisoLevel = 9; TextureI.mipmapEnabled = false; TextureI.wrapMode = TextureWrapMode.Clamp; AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate); Texture Contr2 = (Texture)AssetDatabase.LoadAssetAtPath(path, typeof(Texture)); mainObjT4MMain.T4MMaterial.SetTexture("_Control2", Contr2); T4MMainEditor.Instance.IniNewSelect(); }
void ActivateDeactivateBillBoard() { T4MMainObj mainObjT4MMain = CurrentSelect.GetComponent <T4MMainObj>(); if (T4MCache.billActivate) { //si le billboard est actif T4MBillboard[] T4MBillObjGet = GameObject.FindObjectsOfType(typeof(T4MBillboard)) as T4MBillboard[]; for (var i = 0; i < T4MBillObjGet.Length; i++) { T4MBillObjGet[i].Render.enabled = true; T4MBillObjGet[i].Transf.LookAt(Vector3.zero, Vector3.up); } mainObjT4MMain.BillboardPosition = new Vector3[0]; mainObjT4MMain.BillStatus = new int[0]; mainObjT4MMain.BillScript = new T4MBillboard[0]; PrefabUtility.RecordPrefabInstancePropertyModifications(mainObjT4MMain); T4MCache.billActivate = false; Debug.LogWarning("Billboard deactivated !"); } else { if (!T4MCache.PlayerCam) { T4MCache.PlayerCam = Camera.main.transform; } T4MBillboard[] T4MBillObjGet = GameObject.FindObjectsOfType(typeof(T4MBillboard)) as T4MBillboard[]; Vector3[] T4MBillVectGetR = new Vector3[T4MBillObjGet.Length]; int[] T4MBillValueGetR = new int[T4MBillObjGet.Length]; for (var j = 0; j < T4MBillObjGet.Length; j++) { T4MBillVectGetR[j] = T4MBillObjGet[j].transform.position; if (Vector3.Distance(T4MBillObjGet[j].transform.position, T4MCache.PlayerCam.transform.position) <= T4MConfig.BillboardDist) { T4MBillObjGet[j].Render.enabled = true; T4MBillValueGetR[j] = 1; } else { if (T4MCache.BilBocclusion == OccludeBy.Max_View_Distance) { T4MBillObjGet[j].Render.enabled = false; T4MBillValueGetR[j] = 0; } else { T4MBillObjGet[j].Render.enabled = true; T4MBillValueGetR[j] = 1; } } if (T4MCache.BillBoardAxis == BillbAxe.Y_Axis) { T4MBillObjGet[j].Transf.LookAt(new Vector3(T4MCache.PlayerCam.transform.position.x, T4MBillObjGet[j].Transf.position.y, T4MCache.PlayerCam.transform.position.z), Vector3.up); } else { T4MBillObjGet[j].Transf.LookAt(T4MCache.PlayerCam.transform.position, Vector3.up); } } if (T4MCache.BilBocclusion == OccludeBy.Max_View_Distance) { mainObjT4MMain.BilBbasedOnScript = true; } else { mainObjT4MMain.BilBbasedOnScript = false; } mainObjT4MMain.BillboardPosition = T4MBillVectGetR; mainObjT4MMain.BillStatus = T4MBillValueGetR; mainObjT4MMain.BillScript = T4MBillObjGet; mainObjT4MMain.BillMaxViewDistance = T4MConfig.BillboardDist; mainObjT4MMain.BillInterval = T4MConfig.BillInterval; if (T4MCache.BillBoardAxis == BillbAxe.Y_Axis) { mainObjT4MMain.Axis = 0; } else { mainObjT4MMain.Axis = 1; } PrefabUtility.RecordPrefabInstancePropertyModifications(mainObjT4MMain); T4MCache.billActivate = true; Debug.LogWarning("Billboard (re)activated !"); } }
public void OnGUI() { CurrentSelect = T4MMainEditor.CurrentSelect; T4MMainObj mainObjT4MMain = CurrentSelect.GetComponent <T4MMainObj>(); if (mainObjT4MMain) { EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("Optimization of Load Time", EditorStyles.boldLabel); OptimizeLevel = (int)EditorGUILayout.Slider("Level", OptimizeLevel, 0, 3); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("Load Time", EditorStyles.boldLabel); if (OptimizeLevel == 0) { GUILayout.Label("Good"); } else if (OptimizeLevel == 1) { GUILayout.Label("Very Good"); } else if (OptimizeLevel == 2) { GUILayout.Label("Impressive"); } else if (OptimizeLevel == 3) { GUILayout.Label("Amazing"); } EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("Type", EditorStyles.boldLabel); if (OptimizeLevel == 0) { GUILayout.Label("Optimize Mesh"); } else if (OptimizeLevel == 1) { GUILayout.Label("Optimize Mesh + Low Compression"); } else if (OptimizeLevel == 2) { GUILayout.Label("Optimize Mesh + Medium Compression"); } else if (OptimizeLevel == 3) { GUILayout.Label("Optimize Mesh + High Compression"); } EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("Mesh Impact", EditorStyles.boldLabel); if (OptimizeLevel == 0) { GUILayout.Label("Nothing"); } else if (OptimizeLevel == 1) { GUILayout.Label("Low Degradation"); } else if (OptimizeLevel == 2) { GUILayout.Label("Medium Degradation"); } else if (OptimizeLevel == 3) { GUILayout.Label("High Degradation"); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Can Take Some Time", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Process", GUILayout.Width(100), GUILayout.Height(30))) { string AssetName = ""; int countchild = CurrentSelect.transform.childCount; if (countchild > 0) { MeshFilter[] T4MOBJPART = CurrentSelect.GetComponentsInChildren <MeshFilter>(); AssetName = AssetDatabase.GetAssetPath(T4MOBJPART[0].sharedMesh); Debug.Log(AssetName); } else { MeshFilter T4MOBJM = CurrentSelect.GetComponent <MeshFilter>(); AssetName = AssetDatabase.GetAssetPath(T4MOBJM.sharedMesh); } ModelImporter OBJI = ModelImporter.GetAtPath(AssetName) as ModelImporter; if (OptimizeLevel == 0) { OBJI.optimizeMesh = true; } else if (OptimizeLevel == 1) { OBJI.optimizeMesh = true; OBJI.meshCompression = ModelImporterMeshCompression.Low; } else if (OptimizeLevel == 2) { OBJI.optimizeMesh = true; OBJI.meshCompression = ModelImporterMeshCompression.Medium; } else if (OptimizeLevel == 3) { OBJI.optimizeMesh = true; OBJI.meshCompression = ModelImporterMeshCompression.High; } AssetDatabase.ImportAsset(AssetName, ImportAssetOptions.ForceUpdate); PrefabUtility.RevertPrefabInstance(CurrentSelect.gameObject); AssetName = ""; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } else { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Please, select the T4M Object", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } }
/// <summary> /// 应该Shader修改 /// </summary> void MyT4MApplyChange() { T4MMainObj curMainObjT4MMain = CurrentSelect.gameObject.GetComponent <T4MMainObj>(); if (T4MCache.ShaderModel == SM.ShaderModel1) { //Diffuse SM1 if (T4MCache.MenuTextureSM1 == EnumShaderGLES1.T4M_2_Textures_Auto_BeastLM_2DrawCall) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel1/T4M 2 Textures Auto BeastLM 2DrawCall"); } else if (T4MCache.MenuTextureSM1 == EnumShaderGLES1.T4M_2_Textures_ManualAdd_BeastLM_1DC) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel1/T4M 2 Textures ManualAdd BeastLM_1DC"); } else if (T4MCache.MenuTextureSM1 == EnumShaderGLES1.T4M_2_Textures_ManualAdd_CustoLM_1DC) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel1/T4M 2 Textures ManualAdd CustoLM 1DC"); } } else if (T4MCache.ShaderModel == SM.ShaderModel2) { //Unlit SM2 if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Unlit_Lightmap_Compatible) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 2 Textures Unlit LM"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_Unlit_Lightmap_Compatible) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 3 Textures Unlit LM"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_4_Textures_Unlit_Lightmap_Compatible) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 4 Textures Unlit LM"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_5_Textures_Unlit_Lightmap_Compatible) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 5 Textures Unlit LM"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_6_Textures_Unlit_Lightmap_Compatible) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 6 Textures Unlit LM"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_6_Textures_Unlit_No_Lightmap) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 6 Textures Unlit NoLM"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_World_Projection_Unlit_Lightmap_Compatible) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M World Projection Shader + LM"); } //Diffuse SM2 else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_HighSpec) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 2 Textures"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_HighSpec) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 3 Textures"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_4_Textures_HighSpec) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 4 Textures"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_5_Textures_HighSpec) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 5 Textures"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_6_Textures_HighSpec) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 6 Textures"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_World_Projection_HighSpec) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M World Projection Shader"); } //Specular SM2 else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Specular) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Specular/T4M 2 Textures Spec"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_Specular) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Specular/T4M 3 Textures Spec"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_4_Textures_Specular) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Specular/T4M 4 Textures Spec"); } //4 mobile lightmap SM2 else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_4_Mobile) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/MobileLM/T4M 2 Textures for Mobile"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_4_Mobile) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/MobileLM/T4M 3 Textures for Mobile"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_4_Textures_4_Mobile) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/MobileLM/T4M 4 Textures for Mobile"); }//else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_World_Projection_Mobile){ // CurrentSelect.gameObject.GetComponent <T4MMainObj>().T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/MobileLM/T4M World Projection Shader_Mobile"); //} //Toon SM2 else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Toon) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Toon/T4M 2 Textures Toon"); Cubemap ToonShade = (Cubemap)AssetDatabase.LoadAssetAtPath(T4MConfig.T4MFolder + "Shaders/Sources/toony lighting.psd", typeof(Cubemap)); curMainObjT4MMain.T4MMaterial.SetTexture("_ToonShade", ToonShade); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_Toon) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Toon/T4M 3 Textures Toon"); Cubemap ToonShade = (Cubemap)AssetDatabase.LoadAssetAtPath(T4MConfig.T4MFolder + "Shaders/Sources/toony lighting.psd", typeof(Cubemap)); curMainObjT4MMain.T4MMaterial.SetTexture("_ToonShade", ToonShade); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_4_Textures_Toon) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Toon/T4M 4 Textures Toon"); Cubemap ToonShade = (Cubemap)AssetDatabase.LoadAssetAtPath(T4MConfig.T4MFolder + "Shaders/Sources/toony lighting.psd", typeof(Cubemap)); curMainObjT4MMain.T4MMaterial.SetTexture("_ToonShade", ToonShade); } //Bumped SM2 else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Bumped) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 2 Textures Bumped"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_Bumped) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 3 Textures Bumped"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_4_Textures_Bumped) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 4 Textures Bumped"); } //Mobile Bumped else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Bumped_Mobile) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 2 Textures Bumped Mobile"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_Bumped_Mobile) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 3 Textures Bumped Mobile"); } //Mobile Bumped Spec else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Bumped_SPEC_Mobile) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 2 Textures Bump Specular Mobile"); } //Mobile Bump LM else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Bumped_DirectionalLM_Mobile) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/BumpDLM/T4M 2 Textures Bumped DLM Mobile"); } //Bump Spec SM2 else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Bumped_SPEC) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 2 Textures Bump Specular"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_Bumped_SPEC) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 3 Textures Bump Specular"); } //Bump LM SM2 else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_2_Textures_Bumped_DirectionalLM) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/BumpDLM/T4M 2 Textures Bumped DLM"); } else if (T4MCache.MenuTextureSM2 == EnumShaderGLES2.T4M_3_Textures_Bumped_DirectionalLM) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel2/BumpDLM/T4M 3 Textures Bumped DLM"); } } else if (T4MCache.ShaderModel == SM.ShaderModel3) { //Diffuse SM3 if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_2_Textures_Diffuse) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 2 Textures"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_3_Textures_Diffuse) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 3 Textures"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_4_Textures_Diffuse) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 4 Textures"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_5_Textures_Diffuse) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 5 Textures"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_6_Textures_Diffuse) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 6 Textures"); } //Specular else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_2_Textures_Specular) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Specular/T4M 2 Textures Spec"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_3_Textures_Specular) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Specular/T4M 3 Textures Spec"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_4_Textures_Specular) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Specular/T4M 4 Textures Spec"); } //Bumped SM3 else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_2_Textures_Bumped) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Bump/T4M 2 Textures Bump"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_3_Textures_Bumped) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Bump/T4M 3 Textures Bump"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_4_Textures_Bumped) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/Bump/T4M 4 Textures Bump"); } //Bump Spec SM3 else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_2_Textures_Bumped_SPEC) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/BumpSpec/T4M 2 Textures Bump Spec"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_3_Textures_Bumped_SPEC) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/BumpSpec/T4M 3 Textures Bump Spec"); } else if (T4MCache.MenuTextureSM3 == EnumShaderGLES3.T4M_4_Textures_Bumped_SPEC) { curMainObjT4MMain.T4MMaterial.shader = Shader.Find("iT4MShaders/ShaderModel3/BumpSpec/T4M 4 Textures Bump Spec"); } } else { Material temp = new Material(T4MCache.CustomShader); if (T4MCache.CustomShader != null && temp.HasProperty("_Control") && temp.HasProperty("_Splat0") && temp.HasProperty("_Splat1")) { curMainObjT4MMain.T4MMaterial.shader = T4MCache.CustomShader; } else { EditorUtility.DisplayDialog("T4M Message", "This Shader is not compatible", "OK"); } } if (curMainObjT4MMain.T4MMaterial.HasProperty("_Control2")) { Texture Control2; if (curMainObjT4MMain.T4MMaterial.GetTexture("_Control") != null) { Control2 = AssetDatabase.LoadAssetAtPath <Texture>(T4MConfig.T4MPrefabFolder + "Terrains/Texture/" + curMainObjT4MMain.T4MMaterial.GetTexture("_Control").name + "C2.png"); } else { Control2 = AssetDatabase.LoadAssetAtPath <Texture>(T4MConfig.T4MPrefabFolder + "Terrains/Texture/" + CurrentSelect.gameObject.name + "C2.png"); } if (Control2 == null) { CreateControl2Text(); } else { curMainObjT4MMain.T4MMaterial.SetTexture("_Control2", Control2); } } if (curMainObjT4MMain.T4MMaterial.HasProperty("_Splat0")) { curMainObjT4MMain.T4MMaterial.SetTexture("_Splat0", T4MConfig.Layer1); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_Splat1")) { curMainObjT4MMain.T4MMaterial.SetTexture("_Splat1", T4MConfig.Layer2); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_Splat2")) { curMainObjT4MMain.T4MMaterial.SetTexture("_Splat2", T4MConfig.Layer3); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_Splat3")) { curMainObjT4MMain.T4MMaterial.SetTexture("_Splat3", T4MConfig.Layer4); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_Splat4")) { curMainObjT4MMain.T4MMaterial.SetTexture("_Splat4", T4MConfig.Layer5); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_Splat5")) { curMainObjT4MMain.T4MMaterial.SetTexture("_Splat5", T4MConfig.Layer6); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_BumpSplat0")) { curMainObjT4MMain.T4MMaterial.SetTexture("_BumpSplat0", T4MConfig.Layer1Bump); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_BumpSplat1")) { curMainObjT4MMain.T4MMaterial.SetTexture("_BumpSplat1", T4MConfig.Layer2Bump); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_BumpSplat2")) { curMainObjT4MMain.T4MMaterial.SetTexture("_BumpSplat2", T4MConfig.Layer3Bump); } if (curMainObjT4MMain.T4MMaterial.HasProperty("_BumpSplat3")) { curMainObjT4MMain.T4MMaterial.SetTexture("_BumpSplat3", T4MConfig.Layer4Bump); } if (T4MCache.T4MMaster) { curMainObjT4MMain.EnabledLODSystem = T4MConfig.ActivatedLOD; curMainObjT4MMain.enabledBillboard = T4MConfig.ActivatedBillboard; curMainObjT4MMain.enabledLayerCul = T4MConfig.ActivatedLayerCul; curMainObjT4MMain.CloseView = T4MConfig.CloseDistMaxView; curMainObjT4MMain.NormalView = T4MConfig.NormalDistMaxView; curMainObjT4MMain.FarView = T4MConfig.FarDistMaxView; curMainObjT4MMain.BackGroundView = T4MConfig.BGDistMaxView; curMainObjT4MMain.Master = 1; curMainObjT4MMain.PlayerCamera = T4MCache.PlayerCam; PrefabUtility.RecordPrefabInstancePropertyModifications(curMainObjT4MMain); } else { curMainObjT4MMain.EnabledLODSystem = false; curMainObjT4MMain.enabledBillboard = false; curMainObjT4MMain.enabledLayerCul = false; curMainObjT4MMain.Master = 0; T4MLod[] T4MLodObjGet = GameObject.FindObjectsOfType(typeof(T4MLod)) as T4MLod[]; for (var i = 0; i < T4MLodObjGet.Length; i++) { T4MLodObjGet[i].LOD2.enabled = T4MLodObjGet[i].LOD3.enabled = false; T4MLodObjGet[i].LOD1.enabled = true; if (T4MCache.LODModeControler == LODMod.Mass_Control) { T4MLodObjGet[i].Mode = 0; } else if (T4MCache.LODModeControler == LODMod.Independent_Control) { T4MLodObjGet[i].Mode = 0; } PrefabUtility.RecordPrefabInstancePropertyModifications(T4MLodObjGet[i].GetComponent <T4MLod>()); } curMainObjT4MMain.ObjLodScript = new T4MLod[0]; curMainObjT4MMain.ObjPosition = new Vector3[0]; curMainObjT4MMain.ObjLodStatus = new int[0]; curMainObjT4MMain.Mode = 0; T4MBillboard[] T4MBillObjGet = GameObject.FindObjectsOfType(typeof(T4MBillboard)) as T4MBillboard[]; for (var i = 0; i < T4MBillObjGet.Length; i++) { T4MBillObjGet[i].Render.enabled = true; T4MBillObjGet[i].Transf.LookAt(Vector3.zero, Vector3.up); } curMainObjT4MMain.BillboardPosition = new Vector3[0]; curMainObjT4MMain.BillStatus = new int[0]; curMainObjT4MMain.BillScript = new T4MBillboard[0]; PrefabUtility.RecordPrefabInstancePropertyModifications(curMainObjT4MMain); } T4MCache.TexTexture = null; T4MMainEditor.Instance.IniNewSelect(); }
public void OnGUI() { CurrentSelect = T4MMainEditor.CurrentSelect; T4MMainObj mainObjT4MMain = CurrentSelect.GetComponent <T4MMainObj>(); if (!mainObjT4MMain) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Please, select the T4M Object", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); return; } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EnumMyT4MV = GUILayout.Toolbar(EnumMyT4MV, EnumMyT4M, GUILayout.Width(290), GUILayout.Height(20)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Label("Cleaning Scene", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Gen Terrain ", GUILayout.Height(20))) { T4MMainObj prev = CurrentSelect.GetComponent <T4MMainObj>(); if (prev != null) { GameObject cloneObj = GameObject.Instantiate(CurrentSelect.gameObject); GameObject.DestroyImmediate(cloneObj.GetComponent <T4MMainObj>()); CurrentSelect.gameObject.SetActive(false); EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene()); EditorUtility.DisplayDialog("Gen Terrain ", "Gen Terrain Success !", "OK"); } } if (GUILayout.Button("Clean MeshRenderers", GUILayout.Height(20))) { MeshRenderer[] prev = GameObject.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[]; foreach (MeshRenderer go in prev) { if (go.hideFlags == HideFlags.HideInHierarchy) { go.hideFlags = 0; GameObject.DestroyImmediate(go.gameObject); } } EditorUtility.DisplayDialog("Scene Cleaned", "All MeshRenderer is Clear !", "OK"); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.Space(); switch (EnumMyT4MV) { case 0: GUILayout.Label("Shader Model", EditorStyles.boldLabel); T4MCache.ShaderModel = (SM)EditorGUILayout.EnumPopup("Shader Model", T4MCache.ShaderModel, GUILayout.Width(340)); if (T4MCache.ShaderModel == SM.ShaderModel1) { T4MCache.MenuTextureSM1 = (EnumShaderGLES1)EditorGUILayout.EnumPopup("Shader", T4MCache.MenuTextureSM1, GUILayout.Width(340)); } else if (T4MCache.ShaderModel == SM.ShaderModel2) { T4MCache.MenuTextureSM2 = (EnumShaderGLES2)EditorGUILayout.EnumPopup("Shader", T4MCache.MenuTextureSM2, GUILayout.Width(340)); } else if (T4MCache.ShaderModel == SM.ShaderModel3) { T4MCache.MenuTextureSM3 = (EnumShaderGLES3)EditorGUILayout.EnumPopup("Shader", T4MCache.MenuTextureSM3, GUILayout.Width(340)); } else { T4MCache.CustomShader = EditorGUILayout.ObjectField("Select your Shader", T4MCache.CustomShader, typeof(Shader), true, GUILayout.Width(350)) as Shader; } EditorGUILayout.Space(); if (T4MCache.ShaderModel != SM.CustomShader) { GUILayout.BeginHorizontal(); GUILayout.Label("Shader Compatibility", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); isShaderCompatibility = GUILayout.Toggle(isShaderCompatibility, ""); GUILayout.EndHorizontal(); if (isShaderCompatibility) { GUILayout.BeginHorizontal(); GUILayout.Label("GLES 1.1", GUILayout.Width(300)); if (T4MCache.ShaderModel != SM.ShaderModel3 && T4MCache.ShaderModel != SM.ShaderModel2) { GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ok.png", typeof(Texture)) as Texture); } else { GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ko.png", typeof(Texture)) as Texture); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("GLES 2", GUILayout.Width(300)); if ((T4MCache.ShaderModel == SM.ShaderModel1) || (T4MCache.ShaderModel != SM.ShaderModel3) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_6_Textures_HighSpec) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_4_Textures_Bumped) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_5_Textures_HighSpec) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_3_Textures_Bumped_DirectionalLM) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_6_Textures_Unlit_Lightmap_Compatible) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_World_Projection_HighSpec) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_World_Projection_Unlit_Lightmap_Compatible)) { GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ok.png", typeof(Texture)) as Texture); } else { GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ko.png", typeof(Texture)) as Texture); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Desktop", GUILayout.Width(300)); GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ok.png", typeof(Texture)) as Texture); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Unity WebPlayer", GUILayout.Width(300)); GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ok.png", typeof(Texture)) as Texture); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Flash", GUILayout.Width(300)); if ((T4MCache.ShaderModel == SM.ShaderModel1) || (T4MCache.ShaderModel != SM.ShaderModel3) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_6_Textures_HighSpec) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_5_Textures_HighSpec) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_4_Textures_Bumped) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_3_Textures_Bumped) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_3_Textures_Bumped_SPEC) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_6_Textures_Unlit_Lightmap_Compatible) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_World_Projection_HighSpec) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_World_Projection_Unlit_Lightmap_Compatible) ) { GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ok.png", typeof(Texture)) as Texture); } else { GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ko.png", typeof(Texture)) as Texture); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("NaCI", GUILayout.Width(300)); if ((T4MCache.ShaderModel == SM.ShaderModel1) || (T4MCache.ShaderModel != SM.ShaderModel3) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_6_Textures_HighSpec) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_5_Textures_HighSpec) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_4_Textures_Bumped) && (T4MCache.ShaderModel == SM.ShaderModel2 && T4MCache.MenuTextureSM2 != EnumShaderGLES2.T4M_6_Textures_Unlit_Lightmap_Compatible)) { GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ok.png", typeof(Texture)) as Texture); } else { GUILayout.Label(AssetDatabase.LoadAssetAtPath(T4MConfig.T4MEditorFolder + "Img/ko.png", typeof(Texture)) as Texture); } GUILayout.EndHorizontal(); } } EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label("Master T4M Object", EditorStyles.boldLabel, GUILayout.Width(150)); T4MCache.T4MMaster = EditorGUILayout.Toggle(T4MCache.T4MMaster); GUILayout.EndHorizontal(); if (T4MCache.T4MMaster) { masterGUI(); } GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("UPDATE", GUILayout.Width(100), GUILayout.Height(25))) { MyT4MApplyChange(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); break; case 1: atsFoliageWindActivationGUI(); break; } }
void OnGUI() { this.initlizeEditor(); CurrentSelect = Selection.activeTransform; T4MCache.nbrT4MObj = 0; _t4MMainObjCounter = GameObject.FindObjectsOfType(typeof(T4MMainObj)) as T4MMainObj[]; for (int i = 0; i < _t4MMainObjCounter.Length; i++) { if (_t4MMainObjCounter[i].Master == 1) { T4MCache.nbrT4MObj = +1; } } if (CurrentSelect && Selection.activeInstanceID != T4MSelectID || T4MCache.UnityTerrain && T4MCache.T4MMenuToolbar != 0 || T4MCache.T4MMenuToolbar != 3 && T4MConfig.T4MPreview) { IniNewSelect(); } GUILayout.BeginHorizontal(); { GUILayout.BeginArea(new Rect(0, 0, 90, 585)); GUILayout.Label(AssetDatabase.LoadAssetAtPath <Texture2D>(T4MConfig.T4MEditorFolder + "Img/T4MBAN.jpg"), GUILayout.Width(24), GUILayout.Height(582)); GUILayout.EndArea(); } { GUILayout.BeginArea(new Rect(25, 0, 363, 585)); EditorGUILayout.Space(); { GUILayout.BeginHorizontal("box"); T4MCache.T4MMenuToolbar = GUILayout.Toolbar(T4MCache.T4MMenuToolbar, MenuIcon, "gridlist", GUILayout.Width(172), GUILayout.Height(18)); GUILayout.FlexibleSpace(); GUILayout.Label("Controls", GUILayout.Width(52)); if (GUILayout.Button(T4MActived, GUILayout.Width(80))) { if (T4MActived == "Activated") { T4MActived = "Deactivated"; } else { T4MActived = "Activated"; } } GUILayout.EndHorizontal(); } GUILayout.Label(AssetDatabase.LoadAssetAtPath <Texture>(T4MConfig.T4MEditorFolder + "Img/separator.png")); #region ------------¼¤»îT4M------------------ if (CurrentSelect != null && T4MActived == "Activated") { // if (CurrentSelect.gameObject.GetComponent<T4MMainObj>()) // { // Selection.activeTransform = CurrentSelect.parent; // } T4MMainObj mainObjTm = CurrentSelect.gameObject.GetComponent <T4MMainObj>(); Renderer[] rendererPart = CurrentSelect.GetComponentsInChildren <Renderer>(); if (mainObjTm && (!mainObjTm.T4MMaterial || !mainObjTm.T4MMesh)) { if (rendererPart.Length == 0) { mainObjTm.T4MMaterial = CurrentSelect.GetComponent <Renderer>().sharedMaterial; mainObjTm.T4MMesh = CurrentSelect.gameObject.GetComponent <MeshFilter>(); } else { for (int i = 0; i < rendererPart.Length; i++) { mainObjTm.T4MMaterial = rendererPart[0].sharedMaterial; mainObjTm.T4MMesh = rendererPart[0].gameObject.GetComponent <MeshFilter>(); } } } else if (mainObjTm && mainObjTm.T4MMaterial) { if (T4MCache.nbrT4MObj == 1 && mainObjTm.Master != 1) { T4MCache.T4MMaster = false; } else if (T4MCache.nbrT4MObj == 1 && mainObjTm.Master == 1 && T4MCache.T4MMaster == false && initMaster == false) { T4MCache.T4MMaster = true; initMaster = true; } if (rendererPart.Length == 0) { if (mainObjTm.T4MMaterial != CurrentSelect.GetComponent <Renderer>().sharedMaterial) { mainObjTm.T4MMaterial = CurrentSelect.GetComponent <Renderer>().sharedMaterial; } EditorUtility.SetSelectedWireframeHidden(CurrentSelect.GetComponent <Renderer>(), true); } else { if (mainObjTm.T4MMaterial != rendererPart[0].sharedMaterial) { mainObjTm.T4MMaterial = rendererPart[0].sharedMaterial; } for (int i = 0; i < rendererPart.Length; i++) { if (rendererPart[i].sharedMaterial != rendererPart[0].sharedMaterial) { rendererPart[i].sharedMaterial = rendererPart[0].sharedMaterial; } EditorUtility.SetSelectedWireframeHidden(rendererPart[i], true); } } } if (CurrentSelect && !mainObjTm) { int countchild = CurrentSelect.transform.childCount; if (countchild > 0) { T4MCache.NbrPartObj = CurrentSelect.transform.GetComponentsInChildren <Renderer>(); } } switch (T4MCache.T4MMenuToolbar) { case 0: converterMenuView.OnGUI(); break; case 1: optimizeView.OnGUI(); break; case 2: myT4MView.OnGUI(); break; case 3: painterView.OnGUI(); break; case 4: plantingView.OnGUI(); break; case 5: lodView.OnGUI(); break; case 6: bbView.OnGUI(); break; } if (oldActivBillb != T4MCache.billActivate) { oldActivBillb = T4MCache.billActivate; if (T4MCache.billActivate == false) { bbView.DeactivateBillBByScript(); } } if (oldActivLOD != T4MCache.LodActivate) { oldActivLOD = T4MCache.LodActivate; if (T4MCache.LodActivate == false) { lodView.DeactivateLODByScript(); } } } #endregion else { if (CurrentSelect) { T4MMainObj mainObjTm = CurrentSelect.gameObject.GetComponent <T4MMainObj>(); if (mainObjTm && mainObjTm.T4MMaterial) { Renderer[] rendererPart = CurrentSelect.GetComponentsInChildren <Renderer>(); if (rendererPart.Length == 0) { EditorUtility.SetSelectedWireframeHidden(CurrentSelect.GetComponent <Renderer>(), false); } else { for (int i = 0; i < rendererPart.Length; i++) { EditorUtility.SetSelectedWireframeHidden(rendererPart[i], false); } } } } GUILayout.FlexibleSpace(); { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(AssetDatabase.LoadAssetAtPath <Texture>(T4MConfig.T4MEditorFolder + "Img/waiting.png")); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.FlexibleSpace(); } GUILayout.EndArea(); } GUILayout.EndHorizontal(); }
void CheckShader() { T4MMainObj mainObjTm = CurrentSelect.gameObject.GetComponent <T4MMainObj>(); if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel1/T4M 2 Textures Auto BeastLM 2DrawCall")) { T4MCache.MenuTextureSM1 = EnumShaderGLES1.T4M_2_Textures_Auto_BeastLM_2DrawCall; T4MCache.ShaderModel = SM.ShaderModel1; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel1/T4M 2 Textures ManualAdd BeastLM_1DC")) { T4MCache.MenuTextureSM1 = EnumShaderGLES1.T4M_2_Textures_ManualAdd_BeastLM_1DC; T4MCache.ShaderModel = SM.ShaderModel1; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel1/T4M 2 Textures ManualAdd CustoLM 1DC")) { T4MCache.MenuTextureSM1 = EnumShaderGLES1.T4M_2_Textures_ManualAdd_CustoLM_1DC; T4MCache.ShaderModel = SM.ShaderModel1; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 2 Textures Unlit LM")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Unlit_Lightmap_Compatible; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 3 Textures Unlit LM")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_Unlit_Lightmap_Compatible; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 4 Textures Unlit LM")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_4_Textures_Unlit_Lightmap_Compatible; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 5 Textures Unlit LM")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_5_Textures_Unlit_Lightmap_Compatible; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 6 Textures Unlit LM")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_6_Textures_Unlit_Lightmap_Compatible; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M 6 Textures Unlit NoL")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_6_Textures_Unlit_No_Lightmap; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Unlit/T4M World Projection Shader + LM")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_World_Projection_Unlit_Lightmap_Compatible; T4MCache.ShaderModel = SM.ShaderModel2; T4MConfig.UpSideTile = mainObjTm.T4MMaterial.GetVector("_Tiling"); T4MConfig.UpSideF = mainObjTm.T4MMaterial.GetFloat("_UpSide"); T4MConfig.BlendFac = mainObjTm.T4MMaterial.GetFloat("_Blend"); } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 2 Textures")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_HighSpec; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 3 Textures")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_HighSpec; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 4 Textures")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_4_Textures_HighSpec; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 5 Textures")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_5_Textures_HighSpec; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M 6 Textures")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_6_Textures_HighSpec; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Diffuse/T4M World Projection Shader")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_World_Projection_HighSpec; T4MCache.ShaderModel = SM.ShaderModel2; T4MConfig.UpSideTile = mainObjTm.T4MMaterial.GetVector("_Tiling"); T4MConfig.UpSideF = mainObjTm.T4MMaterial.GetFloat("_UpSide"); T4MConfig.BlendFac = mainObjTm.T4MMaterial.GetFloat("_Blend"); } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Specular/T4M 2 Textures Spec")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Specular; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Specular/T4M 3 Textures Spec")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_Specular; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Specular/T4M 4 Textures Spec")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_4_Textures_Specular; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/MobileLM/T4M 2 Textures for Mobile")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_4_Mobile; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/MobileLM/T4M 3 Textures for Mobile")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_4_Mobile; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/MobileLM/T4M 4 Textures for Mobile")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_4_Textures_4_Mobile; T4MCache.ShaderModel = SM.ShaderModel2; } //else //if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/MobileLM/T4M World Projection Shader_Mobile")){ // T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_World_Projection_Mobile; // T4MCache.ShaderModel = SM.ShaderModel2; // UpSideTile = mainObjTm.T4MMaterial.GetVector ("_Tiling"); // UpSideF = mainObjTm.T4MMaterial.GetFloat ("_UpSide"); // BlendFac= mainObjTm.T4MMaterial.GetFloat ("_Blend"); //} else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Toon/T4M 2 Textures Toon")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Toon; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Toon/T4M 3 Textures Toon")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_Toon; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Toon/T4M 4 Textures Toon")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_4_Textures_Toon; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 2 Textures Bumped")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Bumped; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 3 Textures Bumped")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_Bumped; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 4 Textures Bumped")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_4_Textures_Bumped; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 2 Textures Bumped Mobile")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Bumped_Mobile; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 3 Textures Bumped Mobile")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_Bumped_Mobile; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 2 Textures Bump Specular Mobile")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Bumped_SPEC_Mobile; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/BumpDLM/T4M 2 Textures Bumped DLM Mobile")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Bumped_DirectionalLM_Mobile; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 2 Textures Bump Specular")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Bumped_SPEC; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/Bump/T4M 3 Textures Bump Specular")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_Bumped_SPEC; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/BumpDLM/T4M 2 Textures Bumped DLM")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_2_Textures_Bumped_DirectionalLM; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel2/BumpDLM/T4M 3 Textures Bumped DLM")) { T4MCache.MenuTextureSM2 = EnumShaderGLES2.T4M_3_Textures_Bumped_DirectionalLM; T4MCache.ShaderModel = SM.ShaderModel2; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 2 Textures")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_2_Textures_Diffuse; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 3 Textures")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_3_Textures_Diffuse; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 3 Textures")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_3_Textures_Diffuse; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 4 Textures")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_4_Textures_Diffuse; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 5 Textures")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_5_Textures_Diffuse; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Diffuse/T4M 6 Textures")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_6_Textures_Diffuse; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Specular/T4M 2 Textures Spec")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_2_Textures_Specular; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Specular/T4M 3 Textures Spec")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_3_Textures_Specular; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Specular/T4M 4 Textures Spec")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_4_Textures_Specular; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Bump/T4M 2 Textures Bump")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_2_Textures_Bumped; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Bump/T4M 3 Textures Bump")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_3_Textures_Bumped; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/Bump/T4M 4 Textures Bump")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_4_Textures_Bumped; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/BumpSpec/T4M 2 Textures Bump Spec")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_2_Textures_Bumped_SPEC; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/BumpSpec/T4M 3 Textures Bump Spec")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_3_Textures_Bumped_SPEC; T4MCache.ShaderModel = SM.ShaderModel3; } else if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel3/BumpSpec/T4M 4 Textures Bump Spec")) { T4MCache.MenuTextureSM3 = EnumShaderGLES3.T4M_4_Textures_Bumped_SPEC; T4MCache.ShaderModel = SM.ShaderModel3; } else { T4MCache.ShaderModel = SM.CustomShader; T4MCache.CustomShader = mainObjTm.T4MMaterial.shader; if (mainObjTm.T4MMaterial.HasProperty("_Tiling")) { T4MConfig.UpSideTile = mainObjTm.T4MMaterial.GetVector("_Tiling"); T4MConfig.UpSideF = mainObjTm.T4MMaterial.GetFloat("_UpSide"); T4MConfig.BlendFac = mainObjTm.T4MMaterial.GetFloat("_Blend"); } } }
public void IniNewSelect() { if (T4MCache.UnityTerrain) { DestroyImmediate(T4MCache.UnityTerrain); if (T4MCache.Child) { Selection.activeTransform = T4MCache.Child.transform; T4MCache.vertexInfo = 0; T4MCache.trisInfo = 0; T4MCache.partofT4MObj = 0; if (T4MCache.nbrT4MObj == 0) { T4MMainObj childMainObj = T4MCache.Child.gameObject.GetComponent <T4MMainObj>(); childMainObj.EnabledLODSystem = T4MConfig.ActivatedLOD; childMainObj.enabledBillboard = T4MConfig.ActivatedBillboard; childMainObj.enabledLayerCul = T4MConfig.ActivatedLayerCul; childMainObj.CloseView = T4MConfig.CloseDistMaxView; childMainObj.NormalView = T4MConfig.NormalDistMaxView; childMainObj.FarView = T4MConfig.FarDistMaxView; childMainObj.BackGroundView = T4MConfig.BGDistMaxView; childMainObj.Master = 1; } } } T4MMainObj mainObjTm = CurrentSelect.gameObject.GetComponent <T4MMainObj>(); if (CurrentSelect && mainObjTm && mainObjTm.T4MMaterial) { EditorUtility.SetSelectedWireframeHidden(CurrentSelect.GetComponent <Renderer>(), true); initMaster = false; if (mainObjTm.T4MMaterial.HasProperty("_Splat0")) { T4MConfig.Layer1 = mainObjTm.T4MMaterial.GetTexture("_Splat0"); T4MCache.Layer1Tile = mainObjTm.T4MMaterial.GetTextureScale("_Splat0"); } else { T4MConfig.Layer1 = null; } if (mainObjTm.T4MMaterial.HasProperty("_Splat1")) { T4MConfig.Layer2 = mainObjTm.T4MMaterial.GetTexture("_Splat1"); T4MCache.Layer2Tile = mainObjTm.T4MMaterial.GetTextureScale("_Splat1"); } else { T4MConfig.Layer2 = null; } if (mainObjTm.T4MMaterial.HasProperty("_Splat2")) { T4MConfig.Layer3 = mainObjTm.T4MMaterial.GetTexture("_Splat2"); T4MCache.Layer3Tile = mainObjTm.T4MMaterial.GetTextureScale("_Splat2"); } else { T4MConfig.Layer3 = null; } if (mainObjTm.T4MMaterial.HasProperty("_Splat3")) { T4MConfig.Layer4 = mainObjTm.T4MMaterial.GetTexture("_Splat3"); T4MCache.Layer4Tile = mainObjTm.T4MMaterial.GetTextureScale("_Splat3"); } else { T4MConfig.Layer4 = null; } if (mainObjTm.T4MMaterial.HasProperty("_Splat4")) { T4MConfig.Layer5 = mainObjTm.T4MMaterial.GetTexture("_Splat4"); T4MCache.Layer5Tile = mainObjTm.T4MMaterial.GetTextureScale("_Splat4"); } else { T4MConfig.Layer5 = null; } if (mainObjTm.T4MMaterial.HasProperty("_Splat5")) { T4MConfig.Layer6 = mainObjTm.T4MMaterial.GetTexture("_Splat5"); T4MCache.Layer6Tile = mainObjTm.T4MMaterial.GetTextureScale("_Splat5"); } else { T4MConfig.Layer6 = null; } if (mainObjTm.T4MMaterial.HasProperty("_BumpSplat0")) { T4MConfig.Layer1Bump = mainObjTm.T4MMaterial.GetTexture("_BumpSplat0"); T4MConfig.Layer2Bump = mainObjTm.T4MMaterial.GetTexture("_BumpSplat1"); if (mainObjTm.T4MMaterial.HasProperty("_BumpSplat2")) { T4MConfig.Layer3Bump = mainObjTm.T4MMaterial.GetTexture("_BumpSplat2"); } if (mainObjTm.T4MMaterial.HasProperty("_BumpSplat3")) { T4MConfig.Layer4Bump = mainObjTm.T4MMaterial.GetTexture("_BumpSplat3"); } } if (mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel1/T4M 2 Textures ManualAdd BeastLM_1DC") || mainObjTm.T4MMaterial.shader == Shader.Find("iT4MShaders/ShaderModel1/T4M 2 Textures ManualAdd CustoLM 1DC")) { T4MConfig.LMMan = mainObjTm.T4MMaterial.GetTexture("_Lightmap"); } CheckShader(); T4MConfig.ActivatedLOD = mainObjTm.EnabledLODSystem; T4MConfig.ActivatedBillboard = mainObjTm.enabledBillboard; T4MConfig.MaximunView = mainObjTm.MaxViewDistance; T4MConfig.StartLOD2 = mainObjTm.LOD2Start; T4MConfig.StartLOD3 = mainObjTm.LOD3Start; T4MConfig.UpdateInterval = mainObjTm.Interval; T4MCache.PlayerCam = mainObjTm.PlayerCamera; T4MConfig.BillInterval = mainObjTm.BillInterval; T4MConfig.BillboardDist = mainObjTm.BillMaxViewDistance; T4MConfig.ActivatedLayerCul = mainObjTm.enabledLayerCul; T4MConfig.BGDistMaxView = mainObjTm.BackGroundView; T4MConfig.FarDistMaxView = mainObjTm.FarView; T4MConfig.NormalDistMaxView = mainObjTm.NormalView; T4MConfig.CloseDistMaxView = mainObjTm.CloseView; if (mainObjTm.Mode == 1) { T4MCache.LODModeControler = LODMod.Mass_Control; } else { T4MCache.LODModeControler = LODMod.Independent_Control; } if (mainObjTm.Axis == 0) { T4MCache.BillBoardAxis = BillbAxe.Y_Axis; } else { T4MCache.BillBoardAxis = BillbAxe.All_Axis; } if (mainObjTm.LODbasedOnScript == true) { T4MCache.LODocclusion = OccludeBy.Max_View_Distance; } else { T4MCache.LODocclusion = OccludeBy.Layer_Cull_Distances; } if (mainObjTm.BilBbasedOnScript == true) { T4MCache.BilBocclusion = OccludeBy.Max_View_Distance; } else { T4MCache.BilBocclusion = OccludeBy.Layer_Cull_Distances; } if (mainObjTm.BillboardPosition != null && mainObjTm.BillboardPosition.Length > 0) { T4MCache.billActivate = true; } else { T4MCache.billActivate = false; } if (mainObjTm.ObjPosition != null && mainObjTm.ObjPosition.Length > 0) { T4MCache.LodActivate = true; } else { T4MCache.LodActivate = false; } if (T4MCache.PlayerCam == null && Camera.main) { T4MCache.PlayerCam = Camera.main.transform; } else if (T4MCache.PlayerCam == null && !Camera.main) { Camera[] Cam = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[]; for (var b = 0; b < Cam.Length; b++) { if (Cam[b].GetComponent <AudioListener>()) { T4MCache.PlayerCam = Cam[b].transform; } } } if (mainObjTm.T4MMaterial.HasProperty("_SpecColor")) { T4MCache.ShinessColor = mainObjTm.T4MMaterial.GetColor("_SpecColor"); if (mainObjTm.T4MMaterial.HasProperty("_ShininessL0")) { T4MCache.shiness0 = mainObjTm.T4MMaterial.GetFloat("_ShininessL0"); } if (mainObjTm.T4MMaterial.HasProperty("_ShininessL1")) { T4MCache.shiness1 = mainObjTm.T4MMaterial.GetFloat("_ShininessL1"); } if (mainObjTm.T4MMaterial.HasProperty("_ShininessL2")) { T4MCache.shiness2 = mainObjTm.T4MMaterial.GetFloat("_ShininessL2"); } if (mainObjTm.T4MMaterial.HasProperty("_ShininessL3")) { T4MCache.shiness3 = mainObjTm.T4MMaterial.GetFloat("_ShininessL3"); } } if (mainObjTm.T4MMaterial.HasProperty("_Control2") && mainObjTm.T4MMaterial.GetTexture("_Control2")) { T4MCache.T4MMaskTex2 = (Texture2D)mainObjTm.T4MMaterial.GetTexture("_Control2"); } else { T4MCache.T4MMaskTex2 = null; } if (mainObjTm.T4MMaterial.HasProperty("_Control")) { T4MConfig.T4MMaskTexUVCoord = mainObjTm.T4MMaterial.GetTextureScale("_Control").x; T4MCache.T4MMaskTex = (Texture2D)mainObjTm.T4MMaterial.GetTexture("_Control"); T4MCache.intialized = true; } } Projector[] projectorObj = FindObjectsOfType(typeof(Projector)) as Projector[]; if (projectorObj.Length > 0) { for (var i = 0; i < projectorObj.Length; i++) { if (projectorObj[i].gameObject.name == "PreviewT4M") { DestroyImmediate(projectorObj[i].gameObject); } } } T4MCache.terrainDat = null; T4MCache.vertexInfo = 0; T4MCache.trisInfo = 0; T4MCache.partofT4MObj = 0; T4MCache.TexTexture = null; T4MSelectID = Selection.activeInstanceID; }