Any help on this im trying to add a splatmap from WorldMachine
to my unity terrain
import System.IO;
class ReplaceSplatmap extends ScriptableWizard
{
var Splatmap: Texture2D;
var New : Texture2D;
var BackupSplatmap: boolean;
function OnWizardUpdate(){
helpString = "'New' Splatmap will OverWrite the 'Splatmap' \nDrag the Texture to here:";
isValid = (Splatmap != null) (New != null);
}
function OnWizardCreate () {
if (BackupSplatmap){
Backup ();
}
if (New.format != TextureFormat.ARGB32 New.format != TextureFormat.RGB24) {
EditorUtility.DisplayDialog("Wrong format", "Splatmap must be in ARGB 32 bit (RGB 24 bit for Lightmap) format", "Cancel");
return;
}
var w = New.width;
if (Mathf.ClosestPowerOfTwo(w) != w) {
EditorUtility.DisplayDialog("Wrong size", "Splatmap width and height must be a power of two", "Cancel");
return;
}
Splatmap.Resize (New.width, New.height, New.format, true);
pixels = New.GetPixels ();
Splatmap.SetPixels (pixels);
Splatmap.Apply();
}
@MenuItem("CUSTOM/Replace Splatmap...")//, false, 4)
static function Replace (){
ScriptableWizard.DisplayWizard(
"ReplaceSplatmap", ReplaceSplatmap, "Replace");
}
}
function Backup () {
filename = Splatmap.name;
var bytes = Splatmap.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/../"+filename +"_Backup.png", bytes);
EditorUtility.DisplayDialog("Texture Backup Saved!", "Backup of "+"'"+filename+"'"+" saved in Current Project Folder: " + filename+ "_Backup.png", "OK");
}