From 0a2e727439364962483fd5af81e4c234caa2eae4 Mon Sep 17 00:00:00 2001 From: Maikeu Locatelli Date: Tue, 5 Mar 2019 17:28:56 -0300 Subject: [PATCH] Fix Smoothness and paths with special chars Like spaces --- .../.idea.Materialize/.idea/contentModel.xml | 3 + .idea/.idea.Materialize/.idea/workspace.xml | 1103 ++++++++++------- Assets/Materials/Height_Preview.mat | Bin 4604 -> 4604 bytes Assets/Materials/Metallic_Preview.mat | Bin 4620 -> 4620 bytes Assets/Materials/Normal_Preview.mat | Bin 4600 -> 4600 bytes Assets/Materials/Smoothness_Preview.mat | Bin 4624 -> 4624 bytes ...ins.Rider.Unity.Editor.Plugin.Repacked.dll | Bin 817664 -> 817664 bytes Assets/Scripts/SaveLoadProject.cs | 5 +- Assets/Scripts/SmoothnessGui.cs | 82 +- 9 files changed, 714 insertions(+), 479 deletions(-) diff --git a/.idea/.idea.Materialize/.idea/contentModel.xml b/.idea/.idea.Materialize/.idea/contentModel.xml index e0b28d61..8ce1d54d 100644 --- a/.idea/.idea.Materialize/.idea/contentModel.xml +++ b/.idea/.idea.Materialize/.idea/contentModel.xml @@ -57,6 +57,7 @@ + @@ -92,6 +93,7 @@ + @@ -106,6 +108,7 @@ + diff --git a/.idea/.idea.Materialize/.idea/workspace.xml b/.idea/.idea.Materialize/.idea/workspace.xml index 70f1ce43..f78fc236 100644 --- a/.idea/.idea.Materialize/.idea/workspace.xml +++ b/.idea/.idea.Materialize/.idea/workspace.xml @@ -5,13 +5,10 @@ + - - - - - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -78,159 +121,235 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + @@ -240,7 +359,6 @@ - quicksave format original temp @@ -270,6 +388,7 @@ _mainGui smoothness start + prev MainGui.Instance @@ -397,8 +516,8 @@ @@ -425,36 +544,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -561,11 +680,12 @@ + - @@ -758,7 +878,6 @@ - @@ -1249,7 +1368,6 @@ - @@ -1267,7 +1385,6 @@ - @@ -1276,212 +1393,328 @@ - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Assets/Materials/Height_Preview.mat b/Assets/Materials/Height_Preview.mat index fbc1df24be725d6d65abc570642edc977e7b9d96..989eddedc54512b684cf6498a1c9941d472832bf 100644 GIT binary patch delta 12 TcmeyP{6~3$G^6=OnFoRZBd-MD delta 12 TcmeyP{6~3$G^5!@nFoRZBdP@7 diff --git a/Assets/Materials/Metallic_Preview.mat b/Assets/Materials/Metallic_Preview.mat index 1f918cfb3b572df0c9c0552f35e96a3bf89b7dcf..02ff754abda02cd22f08a69899dd75dce3cc1532 100644 GIT binary patch delta 12 TcmeBC=~0;=&1k++=7S&r8bbsU delta 12 TcmeBC=~0;=&1kk!=7S&r8a@OO diff --git a/Assets/Materials/Normal_Preview.mat b/Assets/Materials/Normal_Preview.mat index f1320a1ada0a4712881bcb2b14cd78bde863dde0..56457e9d2bda127fb9230070e2d814ea6d5835d5 100644 GIT binary patch delta 12 TcmeyN{6l$yG^6=OnLC02BTod> delta 12 TcmeyN{6l$yG^5!@nLC02BT59* diff --git a/Assets/Materials/Smoothness_Preview.mat b/Assets/Materials/Smoothness_Preview.mat index 7d0d004d9e51d04a6e0375f9c79357a93779f9da..2601887cb1b78a61b0c963f5e3a96732c28103cc 100644 GIT binary patch delta 12 TcmbQBGC^g6G^6=OnJ8lwar delta 12 TcmbQBGC^g6G^6oGnJ8jl1T diff --git a/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll b/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll index 92b8a4c5fe6e2ae0ea3549020735d7a8f08acda8..7ac0900effe9f58c0d6b3448c930c6203585ebc9 100644 GIT binary patch delta 153 zcmZqpV%YG-a6$)j;)|Nb?$&O`)^4WOZsyi*mey|8)^4`eZuYI+9IKj`j7_H>Y~oOA zk8I}H9@)%Ux`na5{k%EX_Vec4o$CeSqn>gcQNQdzapG#X-4ph-Y|nVk{h$-5X}eb; zj}s$jI|Bm)Gs7eH_U%)Pcn&i%8#9=0k1pZ431&?Ay3ZDOr0L {pathToTextFile}"); var bashOut = File.ReadAllText(pathToTextFile); -// Debug.Log($"Out : {bashOut}"); + Debug.Log($"Out : {bashOut}"); File.Delete(pathToTextFile); if (bashOut.Contains("image/png")) @@ -211,6 +211,7 @@ public void PasteFile(MapType mapTypeToLoad) var length = lastIndex - firstIndex; pathToFile = bashOut.Substring(firstIndex, length); pathToFile = pathToFile.Replace("file:///", "/"); + Debug.Log("Path " + pathToFile); } File.Delete(pathToTextFile); @@ -262,6 +263,7 @@ private IEnumerator SaveTexture(Texture2D textureToSave, string pathToFile) //TextureScale.BilinearScale(_textureToSave); textureToSave = TextureScale.Bilinear(textureToSave, int.Parse(MainGUI.XSize), int.Parse(MainGUI.YSize)); } + Debug.Log($"Salvando {textureToSave} como {pathToFile}"); if (!pathToFile.Contains(".")) pathToFile = $"{pathToFile}.{MainGui.Instance.SelectedFormat}"; @@ -360,6 +362,7 @@ public IEnumerator LoadTexture(MapType textureToLoad, string pathToFile) Busy = true; Texture2D newTexture = null; + pathToFile = Uri.UnescapeDataString(pathToFile); if (File.Exists(pathToFile)) { diff --git a/Assets/Scripts/SmoothnessGui.cs b/Assets/Scripts/SmoothnessGui.cs index 368768b3..148f0b08 100644 --- a/Assets/Scripts/SmoothnessGui.cs +++ b/Assets/Scripts/SmoothnessGui.cs @@ -49,7 +49,6 @@ public class SmoothnessGui : MonoBehaviour private static readonly int MainTex = Shader.PropertyToID("_MainTex"); private static readonly int MetallicTex = Shader.PropertyToID("_MetallicTex"); private Material _blitMaterial; - private Material _blitSmoothnessMaterial; private RenderTexture _blurMap; private Camera _camera; @@ -94,8 +93,6 @@ public class SmoothnessGui : MonoBehaviour public GameObject TestObject; public Material ThisMaterial; - public Material PreviewMaterial; - private void Awake() { _camera = Camera.main; @@ -158,7 +155,6 @@ private void Start() TestObject.GetComponent().sharedMaterial = ThisMaterial; _blitMaterial = new Material(Shader.Find("Hidden/Blit_Shader")); - _blitSmoothnessMaterial = new Material(PreviewMaterial); InitializeSettings(); } @@ -557,62 +553,62 @@ public IEnumerator ProcessSmoothness() Debug.Log("Processing Height"); - _blitSmoothnessMaterial.SetVector("_ImageSize", new Vector4(_imageSizeX, _imageSizeY, 0, 0)); + _blitMaterial.SetVector("_ImageSize", new Vector4(_imageSizeX, _imageSizeY, 0, 0)); - _blitSmoothnessMaterial.SetTexture("_MetallicTex", _metallicMap != null ? _metallicMap : DefaultMetallicMap); + _blitMaterial.SetTexture("_MetallicTex", _metallicMap != null ? _metallicMap : DefaultMetallicMap); - _blitSmoothnessMaterial.SetTexture("_BlurTex", _blurMap); + _blitMaterial.SetTexture("_BlurTex", _blurMap); - _blitSmoothnessMaterial.SetTexture("_OverlayBlurTex", _overlayBlurMap); + _blitMaterial.SetTexture("_OverlayBlurTex", _overlayBlurMap); - _blitSmoothnessMaterial.SetFloat("_MetalSmoothness", _settings.MetalSmoothness); + _blitMaterial.SetFloat("_MetalSmoothness", _settings.MetalSmoothness); - _blitSmoothnessMaterial.SetInt("_UseSample1", _settings.UseSample1 ? 1 : 0); - _blitSmoothnessMaterial.SetColor("_SampleColor1", _settings.SampleColor1); - _blitSmoothnessMaterial.SetVector("_SampleUV1", + _blitMaterial.SetInt("_UseSample1", _settings.UseSample1 ? 1 : 0); + _blitMaterial.SetColor("_SampleColor1", _settings.SampleColor1); + _blitMaterial.SetVector("_SampleUV1", new Vector4(_settings.SampleUv1.x, _settings.SampleUv1.y, 0, 0)); - _blitSmoothnessMaterial.SetFloat("_HueWeight1", _settings.HueWeight1); - _blitSmoothnessMaterial.SetFloat("_SatWeight1", _settings.SatWeight1); - _blitSmoothnessMaterial.SetFloat("_LumWeight1", _settings.LumWeight1); - _blitSmoothnessMaterial.SetFloat("_MaskLow1", _settings.MaskLow1); - _blitSmoothnessMaterial.SetFloat("_MaskHigh1", _settings.MaskHigh1); - _blitSmoothnessMaterial.SetFloat("_Sample1Smoothness", _settings.Sample1Smoothness); - - _blitSmoothnessMaterial.SetInt("_UseSample2", _settings.UseSample2 ? 1 : 0); - _blitSmoothnessMaterial.SetColor("_SampleColor2", _settings.SampleColor2); - _blitSmoothnessMaterial.SetVector("_SampleUV2", + _blitMaterial.SetFloat("_HueWeight1", _settings.HueWeight1); + _blitMaterial.SetFloat("_SatWeight1", _settings.SatWeight1); + _blitMaterial.SetFloat("_LumWeight1", _settings.LumWeight1); + _blitMaterial.SetFloat("_MaskLow1", _settings.MaskLow1); + _blitMaterial.SetFloat("_MaskHigh1", _settings.MaskHigh1); + _blitMaterial.SetFloat("_Sample1Smoothness", _settings.Sample1Smoothness); + + _blitMaterial.SetInt("_UseSample2", _settings.UseSample2 ? 1 : 0); + _blitMaterial.SetColor("_SampleColor2", _settings.SampleColor2); + _blitMaterial.SetVector("_SampleUV2", new Vector4(_settings.SampleUv2.x, _settings.SampleUv2.y, 0, 0)); - _blitSmoothnessMaterial.SetFloat("_HueWeight2", _settings.HueWeight2); - _blitSmoothnessMaterial.SetFloat("_SatWeight2", _settings.SatWeight2); - _blitSmoothnessMaterial.SetFloat("_LumWeight2", _settings.LumWeight2); - _blitSmoothnessMaterial.SetFloat("_MaskLow2", _settings.MaskLow2); - _blitSmoothnessMaterial.SetFloat("_MaskHigh2", _settings.MaskHigh2); - _blitSmoothnessMaterial.SetFloat("_Sample2Smoothness", _settings.Sample2Smoothness); - - _blitSmoothnessMaterial.SetInt("_UseSample3", _settings.UseSample3 ? 1 : 0); - _blitSmoothnessMaterial.SetColor("_SampleColor3", _settings.SampleColor3); - _blitSmoothnessMaterial.SetVector("_SampleUV3", + _blitMaterial.SetFloat("_HueWeight2", _settings.HueWeight2); + _blitMaterial.SetFloat("_SatWeight2", _settings.SatWeight2); + _blitMaterial.SetFloat("_LumWeight2", _settings.LumWeight2); + _blitMaterial.SetFloat("_MaskLow2", _settings.MaskLow2); + _blitMaterial.SetFloat("_MaskHigh2", _settings.MaskHigh2); + _blitMaterial.SetFloat("_Sample2Smoothness", _settings.Sample2Smoothness); + + _blitMaterial.SetInt("_UseSample3", _settings.UseSample3 ? 1 : 0); + _blitMaterial.SetColor("_SampleColor3", _settings.SampleColor3); + _blitMaterial.SetVector("_SampleUV3", new Vector4(_settings.SampleUv3.x, _settings.SampleUv3.y, 0, 0)); - _blitSmoothnessMaterial.SetFloat("_HueWeight3", _settings.HueWeight3); - _blitSmoothnessMaterial.SetFloat("_SatWeight3", _settings.SatWeight3); - _blitSmoothnessMaterial.SetFloat("_LumWeight3", _settings.LumWeight3); - _blitSmoothnessMaterial.SetFloat("_MaskLow3", _settings.MaskLow3); - _blitSmoothnessMaterial.SetFloat("_MaskHigh3", _settings.MaskHigh3); - _blitSmoothnessMaterial.SetFloat("_Sample3Smoothness", _settings.Sample3Smoothness); + _blitMaterial.SetFloat("_HueWeight3", _settings.HueWeight3); + _blitMaterial.SetFloat("_SatWeight3", _settings.SatWeight3); + _blitMaterial.SetFloat("_LumWeight3", _settings.LumWeight3); + _blitMaterial.SetFloat("_MaskLow3", _settings.MaskLow3); + _blitMaterial.SetFloat("_MaskHigh3", _settings.MaskHigh3); + _blitMaterial.SetFloat("_Sample3Smoothness", _settings.Sample3Smoothness); - _blitSmoothnessMaterial.SetFloat("_BaseSmoothness", _settings.BaseSmoothness); + _blitMaterial.SetFloat("_BaseSmoothness", _settings.BaseSmoothness); - _blitSmoothnessMaterial.SetFloat("_BlurOverlay", _settings.BlurOverlay); - _blitSmoothnessMaterial.SetFloat("_FinalContrast", _settings.FinalContrast); - _blitSmoothnessMaterial.SetFloat("_FinalBias", _settings.FinalBias); + _blitMaterial.SetFloat("_BlurOverlay", _settings.BlurOverlay); + _blitMaterial.SetFloat("_FinalContrast", _settings.FinalContrast); + _blitMaterial.SetFloat("_FinalBias", _settings.FinalBias); CleanupTexture(_tempMap); _tempMap = new RenderTexture(_imageSizeX, _imageSizeY, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear) {wrapMode = TextureWrapMode.Repeat}; Graphics.Blit(_settings.UseAdjustedDiffuse ? _diffuseMap : _diffuseMapOriginal, _tempMap, - _blitSmoothnessMaterial, 0); + _blitMaterial, 0); RenderTexture.active = _tempMap;