public void EmptyBufferTarget() { if (imgMetaUsingRendTex == null) { return; } if (imgMetaUsingRendTex.texture2D) { imgMetaUsingRendTex.RenderTexture_To_Texture2D(); } imgMetaUsingRendTex.target = TexTarget.Texture2D; foreach (var m in materialsUsingRenderTexture) { m.SetTextureOnLastTarget(imgMetaUsingRendTex); } materialsUsingRenderTexture.Clear(); imgMetaUsingRendTex = null; RenderTextureBuffersManager.DiscardPaintingBuffersContents(); }
private bool OnBeforeSaveTexture(TextureMeta id) { if (id.TargetIsRenderTexture()) { id.RenderTexture_To_Texture2D(); } var tex = id.texture2D; if (id.preserveTransparency && !tex.TextureHasAlpha()) { if (_loopLock.Unlocked) { using (_loopLock.Lock()) { //ChangeTexture(id.NewTexture2D()); //id.texture2D.name = id.texture2D.name + "_A"; Debug.Log("Old Texture had no Alpha channel, creating new"); string tname = id.texture2D.name + "_A"; id.texture2D = id.texture2D.CreatePngSameDirectory(tname); id.saveName = tname; id.texture2D.CopyImportSettingFrom(tex).Reimport_IfNotReadale(); SetTextureOnMaterial(id); } } return(false); } id.SetAlphaSavePixel(); return(true); }