void OnPreprocessAudio() { ImportProperties importProperties = (ImportProperties)AssetDatabase.LoadAssetAtPath("Assets/Prefabs/ImportProperties.prefab", typeof(ImportProperties)); if (importProperties && importProperties.enableCustomImportSetting) { AudioImporter audioImporter = assetImporter as AudioImporter; var a = audioImporter.defaultSampleSettings; a.compressionFormat = importProperties.audioCompressionFormat; a.sampleRateSetting = importProperties.audioSampleRateSetting; a.loadType = importProperties.audioClipLoadType; audioImporter.defaultSampleSettings = a; // Override Android Import Settings if (importProperties.overrideAudioForAndroid) { AudioImporterSampleSettings settings = new AudioImporterSampleSettings(); settings.compressionFormat = importProperties.audioCompressionFormatForAndroid; settings.sampleRateSetting = importProperties.audioSampleRateSettingForAndroid; settings.loadType = importProperties.audioClipLoadTypeForAndroid; audioImporter.SetOverrideSampleSettings("Android", settings); } } }
public FigureRecipe LoadFigureRecipe(string figureName, FigureRecipe parentRecipe) { var importProperties = ImportProperties.Load(pathManager, figureName); var figureRecipesDirectory = CommonPaths.WorkDir.Subdirectory("recipes/figures"); figureRecipesDirectory.Create(); var figureRecipeFile = figureRecipesDirectory.File($"{figureName}.dat"); if (!figureRecipeFile.Exists) { Console.WriteLine($"Reimporting {figureName}..."); FigureRecipe recipeToPersist = FigureImporter.ImportFor( figureName, fileLocator, objectLocator, importProperties.Uris, parentRecipe, importProperties.HdCorrectionInitialValue, importProperties.VisibleProducts); Persistance.Save(figureRecipeFile, recipeToPersist); } Console.WriteLine($"Loading {figureName}..."); FigureRecipe recipe = Persistance.Load <FigureRecipe>(figureRecipeFile); return(recipe); }
public SmartSqlBuilder UseProperties(IDictionary dictionary) { foreach (DictionaryEntry envVar in dictionary) { ImportProperties.Add(new KeyValuePair <string, string>(envVar.Key.ToString(), envVar.Value.ToString())); } return(this); }
public SmartSqlBuilder UseProperties(IEnumerable <KeyValuePair <string, string> > importProperties) { foreach (var property in importProperties) { ImportProperties.Add(property); } return(this); }
public static void ImportAll() { var outfitsDir = CommonPaths.WorkDir.Subdirectory("outfits"); outfitsDir.CreateWithParents(); foreach (var outfitFile in CommonPaths.OutfitsDir.GetFiles()) { string name = outfitFile.GetNameWithoutExtension(); var destinationFile = outfitsDir.File(name + ".dat"); if (destinationFile.Exists) { continue; } string json = outfitFile.ReadAllText(); var proxy = JsonConvert.DeserializeObject <OutfitJsonProxy>(json); var items = proxy.items .Select(itemProxy => { ImportProperties.Load(itemProxy.figure); //verify that that a figure with this name exists return(new Outfit.Item(itemProxy.figure, itemProxy.label, itemProxy.isInitiallyVisible)); }) .ToList(); List <Outfit.Fabric> fabrics = proxy.fabrics?.Select(entry => { var label = entry.Key; var materialSetsByFigureName = entry.Value; //verify that the material set for each figure exists foreach (var entry2 in materialSetsByFigureName) { var figureName = entry2.Key; var materialSetName = entry2.Value; var materialSetsConfs = MaterialSetImportConfiguration.Load(figureName); materialSetsConfs.Where(conf => conf.name == materialSetName).Single(); } return(new Outfit.Fabric(label, materialSetsByFigureName)); }) .ToList(); var outfit = new Outfit(proxy.label, items, fabrics); Persistance.Save(destinationFile, outfit); } }
void OnPostprocessTexture(Texture2D texture) { ImportProperties importProperties = (ImportProperties)AssetDatabase.LoadAssetAtPath("Assets/Prefabs/ImportProperties.prefab", typeof(ImportProperties)); if (importProperties && importProperties.enableCustomImportSetting) { TextureImporter textureImporter = assetImporter as TextureImporter; // TODO: Figure out setting mip map levels for android platform if (importProperties.mipMapLevel >= 0) { texture.requestedMipmapLevel = importProperties.mipMapLevel; } if (importProperties.overrideTexturesForAndroid && importProperties.mipMapLevelForAndroid >= 0) { TextureImporterPlatformSettings androidSettings = textureImporter.GetPlatformTextureSettings("Android"); androidSettings.overridden = true; textureImporter.SetPlatformTextureSettings(androidSettings); } } }
void OnPreprocessTexture() { ImportProperties importProperties = (ImportProperties)AssetDatabase.LoadAssetAtPath("Assets/Prefabs/ImportProperties.prefab", typeof(ImportProperties)); if (importProperties && importProperties.enableCustomImportSetting) { TextureImporter textureImporter = assetImporter as TextureImporter; if (importProperties.maxTextureSizeSelected > 0) { textureImporter.maxTextureSize = importProperties.maxTextureSizeSelected; } if (importProperties.overrideTexturesForAndroid) { TextureImporterPlatformSettings androidSettings = textureImporter.GetPlatformTextureSettings("Android"); androidSettings.overridden = true; androidSettings.maxTextureSize = importProperties.maxTextureSizeSelectedForAndroid; textureImporter.SetPlatformTextureSettings(androidSettings); Debug.Log("Override Android"); } } }
private void OnGUI() { // Grabbing game object which holds configuration ImportProperties importProperties = (ImportProperties)AssetDatabase.LoadAssetAtPath("Assets/Prefabs/ImportProperties.prefab", typeof(ImportProperties)); // Basic Editor Setup EditorGUILayout.BeginVertical(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(300)); // Boolean For Applying Editor Props GUILayout.Label("Enable Custom Import Settings", EditorStyles.boldLabel); enableCustomImportSettings = EditorGUILayout.Toggle("Enable Custom Import Settings", enableCustomImportSettings); // Add toggle for if user wants to apply their own import settings if (enableCustomImportSettings) { importProperties.enableCustomImportSetting = enableCustomImportSettings; } else { importProperties.enableCustomImportSetting = enableCustomImportSettings; } // Texture Settings GUILayout.Label("Texture Import Settings", EditorStyles.boldLabel); maxTextureSizeSelected = EditorGUILayout.Popup("Max Texture Size", maxTextureSizeSelected, maxTextureSizes); mipMapLevel = EditorGUILayout.IntField("Mip Map Level", mipMapLevel); // Android Texture Overrides overrideTexturesForAndroid = EditorGUILayout.BeginToggleGroup("Override Texture Settings For Android", overrideTexturesForAndroid); maxTextureSizeSelectedForAndroid = EditorGUILayout.Popup("Max Texture Size", maxTextureSizeSelectedForAndroid, maxTextureSizes); mipMapLevelForAndroid = EditorGUILayout.IntField("Mip Map Level", mipMapLevelForAndroid); EditorGUILayout.EndToggleGroup(); // Audio Settings GUILayout.Label("Audio Import Settings", EditorStyles.boldLabel); audioCompressionFormat = (AudioCompressionFormat)EditorGUILayout.EnumPopup("Audio Compression Format", audioCompressionFormat); audioSampleRateSetting = (AudioSampleRateSetting)EditorGUILayout.EnumPopup("Audio Sample Rate Setting", audioSampleRateSetting); audioClipLoadType = (AudioClipLoadType)EditorGUILayout.EnumPopup("Audio Clip Load Type", audioClipLoadType); // Android Audio Overrides overrideAudioForAndroid = EditorGUILayout.BeginToggleGroup("Override Audio Settings For Android", overrideAudioForAndroid); audioCompressionFormatForAndroid = (AudioCompressionFormat)EditorGUILayout.EnumPopup("Audio Compression Format", audioCompressionFormatForAndroid); audioSampleRateSettingForAndroid = (AudioSampleRateSetting)EditorGUILayout.EnumPopup("Audio Sample Rate Setting", audioSampleRateSettingForAndroid); audioClipLoadTypeForAndroid = (AudioClipLoadType)EditorGUILayout.EnumPopup("Audio Clip Load Type", audioClipLoadTypeForAndroid); EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); bool assignImportSettingsButton = GUILayout.Button("Assign Import Settings"); if (assignImportSettingsButton) { if (importProperties) { // Texture Settings if (maxTextureSizeSelected >= 0) { importProperties.maxTextureSizeSelected = int.Parse(maxTextureSizes[maxTextureSizeSelected]); } if (overrideTexturesForAndroid) { importProperties.overrideTexturesForAndroid = overrideTexturesForAndroid; importProperties.maxTextureSizeSelectedForAndroid = int.Parse(maxTextureSizes[maxTextureSizeSelectedForAndroid]); } // Audio Settings importProperties.audioCompressionFormat = audioCompressionFormat; importProperties.audioSampleRateSetting = audioSampleRateSetting; importProperties.audioClipLoadType = audioClipLoadType; if (overrideAudioForAndroid) { importProperties.overrideAudioForAndroid = overrideAudioForAndroid; importProperties.audioCompressionFormatForAndroid = audioCompressionFormatForAndroid; importProperties.audioSampleRateSettingForAndroid = audioSampleRateSettingForAndroid; importProperties.audioClipLoadTypeForAndroid = audioClipLoadTypeForAndroid; } } Debug.Log("Assigned Import Settings"); } }