public bool DropTextureEditor(Texture tex) { #if UNITY_EDITOR if (tex != null) { pathTexStamp = UnityEditor.AssetDatabase.GetAssetPath(tex); string path = pathTexStamp; int index = path.LastIndexOf("/"); path = path.Insert(index, "/RawFiles"); index = path.IndexOf("/Resources/"); isStampInResourcesFolder = (index != -1); if (isStampInResourcesFolder) { path = path.Substring(index + 11); path = path.Remove(path.Length - 4); resourcesFolder = path; // Debug.Log(path); } else { path = path.Remove(path.Length - 3) + "raw"; if (!TC.FileExistsPath(path)) { path = path.Remove(path.Length - 3) + "r16"; } if (!TC.FileExistsPath(path)) { // TC.AddMessage("Cannot find the file " + path.Remove(path.Length - 3, 3) + "\n\nThe file extension needs to be .raw or .r16"); if (rawImage != null) { rawImage.UnregisterReference(); } inputFile = InputFile.Image; stampTex = tex; TC.AutoGenerate(); return(false); } } TC_RawImage oldRawImage = rawImage; if (oldRawImage) { oldRawImage.UnregisterReference(); } // Debug.Log(path); rawImage = TC_Settings.instance.AddRawFile(path, isStampInResourcesFolder); } #else if (isStampInResourcesFolder) { rawImage = TC_Settings.instance.AddRawFile(resourcesFolder, isStampInResourcesFolder); } #endif if (rawImage != null) { stampTex = tex; TC.RefreshOutputReferences(outputId, true); // TC_Reporter.Log(path); TC_Reporter.Log("Node index " + rawImage.name); return(true); } else { TC.AddMessage("This is not a stamp preview image.\n\nThe raw heightmap file needs to be placed in a 'RawFiles' folder, then TC2 will automatically make a preview image one folder before it.\nThis image needs to be used for dropping on the node.", 0, 4); } return(false); }