static bool DoSanityCheckContentReturnable() { Debug.Log("Running content mod sanity check"); ClearLog(); GameObject contentModObject = Selection.activeGameObject; if (contentModObject == null) { Log("No content mod prefab selected"); return(false); } if (contentModObject.name == "Example Weapon Content Mod" || contentModObject.name == "Example Vehicle Content Mod") { Log("Please make a duplicate of the Example Content Mod prefab and name it something original to your mod!"); return(false); } Object prefab = PrefabUtility.GetPrefabObject(contentModObject); if (prefab == null || contentModObject.scene.IsValid()) { Log("Selected object is not a prefab"); return(false); } if (!ContentExporter.IsContentModObject(contentModObject)) { Log("Selected prefab does not contain any Content Mod component"); return(false); } WeaponContentMod weaponMod = contentModObject.GetComponent <WeaponContentMod>(); VehicleContentMod vehicleMod = contentModObject.GetComponent <VehicleContentMod>(); bool ok = true; if (weaponMod != null) { ok &= DoSanityCheckWeaponMod(weaponMod); } if (vehicleMod != null) { ok &= DoSanityCheckVehicleMod(vehicleMod); } return(ok); }
private void btnSave_Click(object sender, EventArgs e) { ContentExporter cx = null; sfdSave.Filter = "TDX (*.tdx)|*.tdx|JPG (*.jpg)|*.jpg|PNG (*.png)|*.png|TIF (*.tif)|*.tif|BMP (*.bmp)|*.bmp"; if (sfdSave.ShowDialog() == DialogResult.OK) { switch (Path.GetExtension(sfdSave.FileName)) { case ".bmp": cx = new BMPExporter(); break; case ".jpg": cx = new JPGExporter(); break; case ".png": cx = new PNGExporter(); break; case ".tif": cx = new TIFExporter(); break; case ".tdx": //cx = new TDXExporter(); //cx.ExportSettings.AddSetting("Format", ToxicRagers.Helpers.D3DFormat.DXT5); break; } if (cx != null) { cx.Export(t, sfdSave.FileName); SceneManager.Current.UpdateProgress(string.Format("Saved {0}", sfdSave.FileName)); } } }