private void UpdateMaterial(string materialPath) { var materialAssetPath = UpdaterHelper.GetAssetRelativePath(materialPath); var material = AssetDatabase.LoadAssetAtPath <Material> (materialAssetPath); if (material == null) { return; } _logger.LogStart(materialAssetPath); _logger.LogOriginShader(material.shader.name); var shaderConfigData = _configData.GetShaderConfigData(material.shader.name); if (shaderConfigData == null) { _logger.LogEnd(UpdaterLogType.Skip); return; } UpdateMaterialContent(material, shaderConfigData); _logger.LogEnd(shaderConfigData.NeedCheck ? UpdaterLogType.NeedCheck : UpdaterLogType.Done); }
private List <string> OnGUISelectMaterialPaths() { // select root directory _materialFullRootDirectory = EditorUtility.OpenFolderPanel("Select Material Root Directory", _materialFullRootDirectory, ""); _materialAssetRootDirectory = UpdaterHelper.GetAssetRelativePath(_materialFullRootDirectory); if (string.IsNullOrEmpty(_materialFullRootDirectory)) { return(null); } // collect material paths var materialPaths = UpdaterHelper.CollectAllFiles(_materialFullRootDirectory, true, "*.mat", "*.MAT"); // show confirm dialog var message = string.Format("There are about [({0})] materials will be updated in directory [\"{1}\"]. this process can NOT be undo.", materialPaths.Count, _materialAssetRootDirectory); if (!EditorUtility.DisplayDialog("Warning !!", message, "Cancel", "Still Continue")) { return(materialPaths); } Debug.LogWarning("Updating Cancelled !!"); return(null); }
private void OnGUIConfig() { if (string.IsNullOrEmpty(_configDataAssetPath)) { UpdaterHelper.UpdateAssetPath(out _configDataAssetPath, out _configDataFullPath, CONFIG_DEFAULT_ASSET_PATH); _isConfigChanged = true; } var originalColor = GUI.contentColor; GUI.contentColor = Color.green; if (GUILayout.Button("Select Config Path...")) { _configDataFullPath = EditorUtility.OpenFilePanel("Config File Path", _configDataFullPath, "json"); _configDataAssetPath = UpdaterHelper.GetAssetRelativePath(_configDataFullPath); _isConfigChanged = true; } GUI.contentColor = originalColor; EditorGUILayout.LabelField("Config File Path: ", _configDataAssetPath); LoadConfig(); }