Beispiel #1
0
 public ImageData Init(int renderTextureSize)
 {
     width  = renderTextureSize;
     height = renderTextureSize;
     AddRenderTexture();
     TexMGMTdata.imgDatas.Insert(0, this);
     destination = TexTarget.RenderTexture;
     return(this);
 }
Beispiel #2
0
 public TextureMeta Init(int renderTextureSize)
 {
     width  = renderTextureSize;
     height = renderTextureSize;
     AddRenderTexture();
     Cfg.imgMetas.Insert(0, this);
     destination = TexTarget.RenderTexture;
     return(this);
 }
Beispiel #3
0
        private void UseTex2D(Texture2D tex)
        {
            From(tex);
            destination = TexTarget.Texture2D;
#if UNITY_EDITOR
            string path = AssetDatabase.GetAssetPath(tex);
            if (!path.IsNullOrEmpty())
            {
                saveName = tex.name;
            }
            else
#endif
            if (saveName.IsNullOrEmpty())
            {
                saveName = "New img";
            }
        }
Beispiel #4
0
        void UseTex2D(Texture2D tex)
        {
            From(tex);
            destination = TexTarget.Texture2D;
#if UNITY_EDITOR
            string path = AssetDatabase.GetAssetPath(tex);
            if (!string.IsNullOrEmpty(path))
            {
                SaveName = tex.name;
                // saved = true;
            }
            else
#endif
            if (SaveName == null)
            {
                SaveName = "New img";
            }
        }
Beispiel #5
0
        private void UseRenderTexture(RenderTexture rt)
        {
            renderTexture = rt;
            width         = rt.width;
            height        = rt.height;
            destination   = TexTarget.RenderTexture;

#if UNITY_EDITOR
            string path = AssetDatabase.GetAssetPath(rt);
            if (!string.IsNullOrEmpty(path))
            {
                saveName = rt.name;
                // saved = true;
            }
            else
#endif
            if (saveName.IsNullOrEmpty())
            {
                saveName = "New img";
            }
        }
Beispiel #6
0
        public void ChangeDestination(TexTarget changeTo, MaterialMeta mat, ShaderProperty.TextureValue parameter, PlaytimePainter painter)
        {
            if (changeTo != destination)
            {
                if (changeTo == TexTarget.RenderTexture)
                {
                    if (!renderTexture)
                    {
                        PainterCamera.Inst.ChangeBufferTarget(this, mat, parameter, painter);
                    }
                    TextureToRenderTexture(texture2D);
                }
                else
                {
                    if (!texture2D)
                    {
                        return;
                    }

                    if (!renderTexture)
                    {
                        PainterCamera.Inst.EmptyBufferTarget();
                        PainterCamera.Inst.DiscardAlphaBuffer();
                    }
                    else if (painter.initialized && !painter.isBeingDisabled)
                    {
                        // To avoid Clear to black when exiting playmode
                        RenderTexture_To_Texture2D();
                        Debug.Log("Is being switched to Tex2D");
                    }
                }
                destination = changeTo;
                painter.SetTextureOnMaterial(this);
            }
            else
            {
                Debug.Log("Destination already Set");
            }
        }
Beispiel #7
0
        public void ChangeDestination(TexTarget changeTo, MaterialData mat, string parameter, PlaytimePainter painter)
        {
            if (changeTo != destination)
            {
                //   Debug.Log("Changing destination");

                if (changeTo == TexTarget.RenderTexture)
                {
                    if (renderTexture == null)
                    {
                        PainterCamera.Inst.ChangeBufferTarget(this, mat, parameter, painter);
                    }
                    TextureToRenderTexture(texture2D);
                }
                else
                {
                    if (texture2D == null)
                    {
                        return;
                    }

                    if (renderTexture == null)
                    {
                        PainterCamera.Inst.EmptyBufferTarget();
                    }
                    else
                    if (painter.inited)     // To avoid Clear to black when exiting playmode
                    {
                        RenderTexture_To_Texture2D();
                    }
                }
                destination = changeTo;
                painter.SetTextureOnMaterial(this);
            }
            else
            {
                Debug.Log("Destination already Set");
            }
        }
Beispiel #8
0
        public override bool Decode(string tag, string data)
        {
            switch (tag)
            {
            case "dst": destination = (TexTarget)data.ToInt(); break;

            case "tex2D": data.Decode_Referance(ref texture2D); break;

            case "other": data.Decode_Referance(ref other); break;

            case "w": width = data.ToInt(); break;

            case "h": height = data.ToInt(); break;

            case "useUV2": useTexcoord2 = data.ToBool(); break;

            case "Lock": lockEditing = data.ToBool(); break;

            case "2dUndo": numberOfTexture2Dbackups = data.ToInt(); break;

            case "rtBackups": numberOfRenderTextureBackups = data.ToInt(); break;

            case "b": backupManually = data.ToBool(); break;

            case "tl": tiling = data.ToVector2(); break;

            case "off": offset = data.ToVector2(); break;

            case "sn": SaveName = data; break;

            case "svs": data.DecodeInto(out playtimeSavedTextures); break;

            default: return(false);
            }
            return(true);
        }
Beispiel #9
0
        public override bool Decode(string tg, string data)
        {
            switch (tg)
            {
            case "mods": Modules.Decode(data); break;

            case "dst": destination = (TexTarget)data.ToInt(); break;

            case "tex2D": data.Decode_Reference(ref texture2D); break;

            case "other": data.Decode_Reference(ref other); break;

            case "w": width = data.ToInt(); break;

            case "h": height = data.ToInt(); break;

            case "useUV2": useTexCoord2 = data.ToBool(); break;

            case "Lock": lockEditing = data.ToBool(); break;

            case "2dUndo": _numberOfTexture2DBackups = data.ToInt(); break;

            case "rtBackups": _numberOfRenderTextureBackups = data.ToInt(); break;

            case "b": backupManually = data.ToBool(); break;

            case "tl": tiling = data.ToVector2(); break;

            case "off": offset = data.ToVector2(); break;

            case "sn": saveName = data; break;

            case "trnsp": isATransparentLayer = data.ToBool(); break;

            case "vol": isAVolumeTexture = data.ToBool(); break;

            case "updT2D": updateTex2DafterStroke = data.ToBool(); break;

            case "bu": enableUndoRedo = data.ToBool(); break;

            case "dumm": dontRedoMipMaps = data.ToBool(); break;

            case "dCnt": disableContiniousLine = data.ToBool(); break;

            case "tc2Auto": _useTexCoord2AutoAssigned = data.ToBool(); break;

            case "clear": clearColor = data.ToColor(); break;

            case "URL": url = data; break;

            case "alpha": preserveTransparency = data.ToBool(); break;

            case "is": inspectedItems = data.ToInt(); break;

            case "ip": _inspectedProcess = data.ToInt(); break;

            case "sdfMI": sdfMaxInside = data.ToFloat(); break;

            case "sdfMO": sdfMaxOutside = data.ToFloat(); break;

            case "sdfMD": sdfPostProcessDistance = data.ToFloat(); break;

            default: return(false);
            }
            return(true);
        }