public void SetPaint(PaintHandle paint, PaintMode paintModes) { vgSetPaint(paint, paintModes); }
public void DestroyPaint(PaintHandle paint) { vgDestroyPaint(paint); }
void PixelPainterMenu() { if (CurrentSelect.GetComponent <T4MObjSC>()) { if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial && CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat0") && CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat1")&& CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Control")){ IniBrush(); InitPincil(); if (!T4MPreview) InitPreview(); if (intialized){ GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(Resources.LoadAssetAtPath(T4MEditorFolder+"Img/brushes.jpg", typeof(Texture)) as Texture,"label"); GUILayout.BeginHorizontal("box", GUILayout.Width(318)); GUILayout.FlexibleSpace(); selBrush= GUILayout.SelectionGrid (selBrush, TexBrush, 9,"gridlist", GUILayout.Width(290), GUILayout.Height(70)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal("box", GUILayout.Width(340)); GUILayout.FlexibleSpace(); if (TexTexture.Length >4) T4MselTexture= GUILayout.SelectionGrid (T4MselTexture, TexTexture, 6 ,"gridlist",GUILayout.Width(340), GUILayout.Height(58)); else T4MselTexture= GUILayout.SelectionGrid (T4MselTexture, TexTexture, 4 ,"gridlist",GUILayout.Width(340), GUILayout.Height(86)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical("box", GUILayout.Width(347)); GUILayout.BeginHorizontal(); GUILayout.Label("Preview Type", GUILayout.Width(145)); PaintPrev = (PaintHandle) EditorGUILayout.EnumPopup (PaintPrev, GUILayout.Width(160)); GUILayout.EndHorizontal(); brushSize = (int)EditorGUILayout.Slider("Brush Size",brushSize,1,36); T4MStronger = EditorGUILayout.Slider("Brush Stronger",T4MStronger,0.05f,1f); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_SpecColor")){ EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical("box", GUILayout.Width(347), GUILayout.Height(96)); ShinessColor = EditorGUILayout.ColorField("Shininess Color", ShinessColor); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetColor("_SpecColor",ShinessColor); EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_ShininessL0")){ shiness0 = EditorGUILayout.Slider("Shininess Layer 1",shiness0,0.00f,1.0f); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetFloat ("_ShininessL0",shiness0); } if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_ShininessL1")){ shiness1 = EditorGUILayout.Slider("Shininess Layer 2",shiness1,0.00f,1.0f); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetFloat ("_ShininessL1",shiness1); } if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_ShininessL2")){ shiness2 = EditorGUILayout.Slider("Shininess Layer 3",shiness2,0.00f,1.0f); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetFloat ("_ShininessL2",shiness2); } if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_ShininessL3")){ shiness3 = EditorGUILayout.Slider("Shininess Layer 4",shiness3,0.00f,1.0f); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetFloat ("_ShininessL3",shiness3); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_SpecColor")){ scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width (350), GUILayout.Height (140)); GUILayout.BeginVertical("box", GUILayout.Width(320)); }else { GUILayout.BeginVertical("box", GUILayout.Width(320)); if (TexTexture.Length >4) scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width (340), GUILayout.Height (275)); else scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width (340), GUILayout.Height (240)); } joinTiles = EditorGUILayout.Toggle ("Tiling : Join X/Y", joinTiles); EditorGUILayout.Space(); if (joinTiles){ Layer1Tile.x =Layer1Tile.y= EditorGUILayout.Slider("Layer1 Tiling :",Layer1Tile.x,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat0",new Vector2(Layer1Tile.x,Layer1Tile.x)); EditorGUILayout.Space(); Layer2Tile.x = Layer2Tile.y =EditorGUILayout.Slider("Layer2 Tiling :",Layer2Tile.x,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat1",new Vector2(Layer2Tile.x,Layer2Tile.x)); EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat2")){ Layer3Tile.x = Layer3Tile.y =EditorGUILayout.Slider("Layer3 Tiling :",Layer3Tile.x,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat2",new Vector2(Layer3Tile.x,Layer3Tile.x)); } EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat3")){ Layer4Tile.x = Layer4Tile.y =EditorGUILayout.Slider("Layer4 Tiling :",Layer4Tile.x,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat3",new Vector2(Layer4Tile.x,Layer4Tile.x)); } EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat4")){ Layer5Tile.x = Layer5Tile.y =EditorGUILayout.Slider("Layer5 Tiling :",Layer5Tile.x,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat4",new Vector2(Layer5Tile.x,Layer5Tile.x)); } EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat5")){ Layer6Tile.x = Layer6Tile.y =EditorGUILayout.Slider("Layer6 Tiling :",Layer6Tile.x,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat5",new Vector2(Layer6Tile.x,Layer6Tile.x)); } }else{ Layer1Tile.x = EditorGUILayout.Slider("Layer1 TilingX :",Layer1Tile.x,1,500*T4MMaskTexUVCoord); Layer1Tile.y = EditorGUILayout.Slider("Layer1 TilingZ :",Layer1Tile.y,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat0",new Vector2(Layer1Tile.x,Layer1Tile.y)); EditorGUILayout.Space(); Layer2Tile.x = EditorGUILayout.Slider("Layer2 TilingX :",Layer2Tile.x,1,500*T4MMaskTexUVCoord); Layer2Tile.y = EditorGUILayout.Slider("Layer2 TilingZ :",Layer2Tile.y,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat1",new Vector2(Layer2Tile.x,Layer2Tile.y)); EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat2")){ Layer3Tile.x = EditorGUILayout.Slider("Layer3 TilingX :",Layer3Tile.x,1,500*T4MMaskTexUVCoord); Layer3Tile.y = EditorGUILayout.Slider("Layer3 TilingZ :",Layer3Tile.y,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat2",new Vector2(Layer3Tile.x,Layer3Tile.y)); } EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat3")){ Layer4Tile.x = EditorGUILayout.Slider("Layer4 TilingX :",Layer4Tile.x,1,500*T4MMaskTexUVCoord); Layer4Tile.y = EditorGUILayout.Slider("Layer4 TilingZ :",Layer4Tile.y,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat3",new Vector2(Layer4Tile.x,Layer4Tile.y)); } EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat4")){ Layer5Tile.x = EditorGUILayout.Slider("Layer5 TilingX :",Layer5Tile.x,1,500*T4MMaskTexUVCoord); Layer5Tile.y = EditorGUILayout.Slider("Layer5 TilingZ :",Layer5Tile.y,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat4",new Vector2(Layer5Tile.x,Layer5Tile.y)); } EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat5")){ Layer6Tile.x = EditorGUILayout.Slider("Layer6 TilingX :",Layer6Tile.x,1,500*T4MMaskTexUVCoord); Layer6Tile.y = EditorGUILayout.Slider("Layer6 TilingZ :",Layer6Tile.y,1,500*T4MMaskTexUVCoord); CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.SetTextureScale ("_Splat5",new Vector2(Layer6Tile.x,Layer6Tile.y)); } } EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (TexBrush.Length>0){ T4MPreview.material.SetTexture("_MaskTex", TexBrush[selBrush]); MeshFilter temp = CurrentSelect.GetComponent<MeshFilter>(); if (temp == null) temp = CurrentSelect.GetComponent<T4MObjSC>().T4MMesh; T4MPreview.orthographicSize = (brushSize* CurrentSelect.localScale.x)*(temp.sharedMesh.bounds.size.x/200); } float test = T4MStronger*200/100; T4MPreview.material.SetFloat ("_Transp", Mathf.Clamp(test,0.4f,1)); T4MBrushSizeInPourcent = (int)Mathf.Round ((brushSize*T4MMaskTex.width)/100); if (T4MselTexture == 0) T4MPreview.material.SetTextureScale ("_MainTex", Layer1Tile); else if (T4MselTexture == 1) T4MPreview.material.SetTextureScale ("_MainTex", Layer2Tile); else if (T4MselTexture == 2) T4MPreview.material.SetTextureScale ("_MainTex", Layer3Tile); else if (T4MselTexture == 3 ) T4MPreview.material.SetTextureScale ("_MainTex", Layer4Tile); else if (T4MselTexture == 4 ) T4MPreview.material.SetTextureScale ("_MainTex", Layer5Tile); else if (T4MselTexture == 5 ) T4MPreview.material.SetTextureScale ("_MainTex", Layer6Tile); if (selBrush != oldSelBrush || T4MBrushSizeInPourcent != oldBrushSizeInPourcent || T4MBrushAlpha == null || T4MselTexture != oldselTexture){ if (T4MselTexture == 0){ T4MPreview.material.SetTexture("_MainTex", CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat0") as Texture); T4MtargetColor = new Color(1f, 0f, 0f, 0f); if (T4MMaskTex2) T4MtargetColor2 = new Color(0, 0, 0, 0); } else if (T4MselTexture == 1){ T4MPreview.material.SetTexture("_MainTex", CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat1") as Texture); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.shader == Shader.Find ("T4MShaders/ShaderModel1/T4M 2 Textures Auto BeastLM 2DrawCall") || CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.shader == Shader.Find ("T4MShaders/ShaderModel1/T4M 2 Textures ManualAdd BeastLM_1DC")|| CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.shader == Shader.Find ("T4MShaders/ShaderModel1/T4M 2 Textures ManualAdd CustoLM 1DC")) T4MtargetColor = new Color(0, 0, 0, 1); else { T4MtargetColor = new Color(0, 1, 0, 0); if (T4MMaskTex2) T4MtargetColor2 = new Color(0, 0, 0, 0); } } else if (T4MselTexture == 2){ T4MPreview.material.SetTexture("_MainTex", CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat2") as Texture); T4MtargetColor = new Color(0, 0, 1, 0); if (T4MMaskTex2) T4MtargetColor2 = new Color(0, 0, 0, 0); } else if (T4MselTexture == 3 ){ T4MPreview.material.SetTexture("_MainTex", CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat3") as Texture); T4MtargetColor = new Color(0, 0, 0, 1); if (T4MMaskTex2) T4MtargetColor2 = new Color(1, 0, 0, 0); } else if (T4MselTexture == 4 ){ T4MPreview.material.SetTexture("_MainTex", CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat4") as Texture); T4MtargetColor = new Color(0, 0, 0, 1); if (T4MMaskTex2) T4MtargetColor2 = new Color(0, 1, 0, 0); } else if (T4MselTexture == 5 ){ T4MPreview.material.SetTexture("_MainTex", CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat5") as Texture); T4MtargetColor = new Color(0, 0, 0, 1); if (T4MMaskTex2) T4MtargetColor2 = new Color(0, 0, 1, 0); } Texture2D TBrush = TexBrush[selBrush] as Texture2D; T4MBrushAlpha = new float[T4MBrushSizeInPourcent * T4MBrushSizeInPourcent]; for( int i = 0; i < T4MBrushSizeInPourcent; i++ ) { for( int j = 0;j < T4MBrushSizeInPourcent; j++ ) { T4MBrushAlpha[j * T4MBrushSizeInPourcent + i] = TBrush.GetPixelBilinear(((float)i) / T4MBrushSizeInPourcent, ((float)j) /T4MBrushSizeInPourcent).a; } } oldselTexture =T4MselTexture; oldSelBrush =selBrush; oldBrushSizeInPourcent =T4MBrushSizeInPourcent; } }} }else { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Please, select the T4M Object", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } }
protected Paint(IOpenVG vg) { this.vg = vg; this.paint = vg.CreatePaint(); }
void PixelPainterMenu() { if (CurrentSelect.GetComponent <MeshRenderer>()) { if (CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial&& CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial.HasProperty("_IndexTex") && CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial.HasProperty("_BlendTex") && CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial.HasProperty("_MainTex")) { IniBrush(); InitPincil(); if (!T4MPreview) { InitPreview(); } if (intialized) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label( AssetDatabase.LoadAssetAtPath(T4MEditorFolder + "Img/brushes.jpg", typeof(Texture)) as Texture, "label"); GUILayout.BeginHorizontal("box", GUILayout.Width(318)); GUILayout.FlexibleSpace(); oldBrush = selBrush; selBrush = GUILayout.SelectionGrid(selBrush, TexBrush, 9, "gridlist", GUILayout.Width(290), GUILayout.Height(70)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal("box", GUILayout.Width(340)); GUILayout.FlexibleSpace(); T4MselTexture = GUILayout.SelectionGrid(T4MselTexture, TexTexture, 6, "gridlist", GUILayout.Width(340), GUILayout.Height(64)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical("box", GUILayout.Width(347)); GUILayout.BeginHorizontal(); GUILayout.Label("Preview Type", GUILayout.Width(145)); PaintPrev = (PaintHandle)EditorGUILayout.EnumPopup(PaintPrev, GUILayout.Width(160)); GUILayout.EndHorizontal(); brushSize = (int)EditorGUILayout.Slider("Brush Size", brushSize, 1, 36); T4MStronger = EditorGUILayout.Slider("Brush Stronger", T4MStronger, 0.01f, 2f); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial.HasProperty("_SpecColor")) { EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical("box", GUILayout.Width(347), GUILayout.Height(96)); ShinessColor = EditorGUILayout.ColorField("Shininess Color", ShinessColor); CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial .SetColor("_SpecColor", ShinessColor); EditorGUILayout.Space(); if (CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial.HasProperty("_ShininessL0")) { shiness0 = EditorGUILayout.Slider("Shininess Layer 1", shiness0, 0.00f, 1.0f); CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial .SetFloat("_ShininessL0", shiness0); } if (CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial.HasProperty("_ShininessL1")) { shiness1 = EditorGUILayout.Slider("Shininess Layer 2", shiness1, 0.00f, 1.0f); CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial .SetFloat("_ShininessL1", shiness1); } if (CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial.HasProperty("_ShininessL2")) { shiness2 = EditorGUILayout.Slider("Shininess Layer 3", shiness2, 0.00f, 1.0f); CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial .SetFloat("_ShininessL2", shiness2); } if (CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial.HasProperty("_ShininessL3")) { shiness3 = EditorGUILayout.Slider("Shininess Layer 4", shiness3, 0.00f, 1.0f); CurrentSelect.gameObject.GetComponent <MeshRenderer>().sharedMaterial .SetFloat("_ShininessL3", shiness3); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } EditorGUILayout.Space(); if (TexBrush.Length > 0) { T4MPreview.material.SetTexture("_MaskTex", TexBrush[selBrush]); MeshFilter temp = CurrentSelect.GetComponent <MeshFilter>(); if (temp == null) { temp = CurrentSelect.GetComponent <MeshFilter>(); } T4MPreview.orthographicSize = (brushSize * CurrentSelect.localScale.x) * (temp.sharedMesh.bounds.size.x / 200); } float test = T4MStronger * 200 / 100; T4MPreview.material.SetFloat("_Transp", Mathf.Clamp(test, 0.4f, 1)); T4MBrushSizeInPourcent = Mathf.RoundToInt((brushSize * T4MMaskBlendTex.width) / 100); if (T4MBrushAlpha == null || OldT4MBrushSizeInPourcent != T4MBrushSizeInPourcent || OldT4MBrushSizeAtBound != T4MBrushSizeAtBound || oldBrush != selBrush) { T4MBrushAlpha = new float[T4MBrushSizeInPourcent * T4MBrushSizeInPourcent]; Texture2D TBrush = TexBrush[selBrush] as Texture2D; for (int i = 0; i < T4MBrushSizeInPourcent; i++) { for (int j = 0; j < T4MBrushSizeInPourcent; j++) { T4MBrushAlpha[j * T4MBrushSizeInPourcent + i] = (TBrush.GetPixelBilinear(((float)i) / T4MBrushSizeInPourcent, ((float)j) / T4MBrushSizeInPourcent).a) ; //神特么坑的加权 // * 0.8f + 0.2f; } } oldBrush = selBrush; OldT4MBrushSizeInPourcent = T4MBrushSizeInPourcent; OldT4MBrushSizeAtBound = T4MBrushSizeAtBound; } if (T4MselTexture == 0) { T4MPreview.material.SetTextureScale("_MainTex", Layer1Tile); } else if (T4MselTexture == 1) { T4MPreview.material.SetTextureScale("_MainTex", Layer2Tile); } else if (T4MselTexture == 2) { T4MPreview.material.SetTextureScale("_MainTex", Layer3Tile); } else if (T4MselTexture == 3) { T4MPreview.material.SetTextureScale("_MainTex", Layer4Tile); } else if (T4MselTexture == 4) { T4MPreview.material.SetTextureScale("_MainTex", Layer5Tile); } else if (T4MselTexture == 5) { T4MPreview.material.SetTextureScale("_MainTex", Layer6Tile); } else if (T4MselTexture == 6) { T4MPreview.material.SetTextureScale("_MainTex", Layer7Tile); } else if (T4MselTexture == 7) { T4MPreview.material.SetTextureScale("_MainTex", Layer8Tile); } else if (T4MselTexture == 8) { T4MPreview.material.SetTextureScale("_MainTex", Layer9Tile); } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Refresh Textures")) { RefreshCurSelectedMaterialTextures(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } } } else { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Please, select the MeshRender", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } }