public void TextureSelected(TextureEntry te) { if (currentTextureEntry != null) { currentTextureEntry.GetComponentInChildren <Text> ().text = ""; } currentTextureEntry = te; currentTextureEntry.GetComponentInChildren <Text> ().text = "selected"; }
private IEnumerator Routine(TextureEntry te, string filepath) { print("Set Texture Routine"); string uri = new Uri(filepath).AbsoluteUri; var loader = new WWW(uri); yield return(loader); print("Set Texture"); te.Texture = loader.texture; }
public void Set(TextureEntry entry) { Init(); TextureEditorManager master = FindObjectOfType <TextureEditorManager> (); MeshRenderer mr = GetComponent <MeshRenderer> (); entry.SetTextureTo(master.targetSharedMaterial ? mr.sharedMaterial : mr.material, orgTexture); textureFilePath = entry.TexturePath; editedTexture = entry.rawImage.texture; }
public void UpdateTextures() { string folder = dataSaveLoad.GetFolderPath(textureFolder); DirectoryInfo di = new DirectoryInfo(folder); List <string> files = new List <string>(); foreach (string exp in new string[] { "*.jpg", "*.png" }) { files.AddRange(System.IO.Directory.GetFiles(folder, exp)); } // foreach (string f in files) { // print (f); // } TextureEntry[] entries = scrollContent.GetComponentsInChildren <TextureEntry> (); foreach (TextureEntry te in entries) { Destroy(te.gameObject); } //creating blank texture entry for reseting { GameObject pip = GameObject.Instantiate(texturePrefab); pip.transform.SetParent(scrollContent.transform, false); TextureEntry te = pip.GetComponentInChildren <TextureEntry> (true); te.TexturePath = null; te.GetComponentInChildren <Button> ().onClick.AddListener(() => { TextureSelected(te); }); } //creating each texture entries foreach (string f in files) { GameObject pip = GameObject.Instantiate(texturePrefab); pip.transform.SetParent(scrollContent.transform, false); TextureEntry te = pip.GetComponentInChildren <TextureEntry> (true); te.TexturePath = f; te.GetComponentInChildren <Button>().onClick.AddListener(() => { TextureSelected(te); }); } }