public override void AfterLoad() { base.AfterLoad(); if (GetChildTexture() != null) { texChildOrigin = GetChildTexture(); texChildResized = SWTextureProcess.TextureResize(texChildOrigin, data.resolution, data.resolution); } if (textureEx != null) { if (data.resolution != textureEx.width) { data.reso = (SWTexResolution)SWDataNode.resoList.IndexOf(textureEx.width); } } if (data.rd != null && data.rd.l != null && data.rd.l.pts != null) { for (int i = 0; i < data.rd.l.pts.Count; i++) { var pData = data.rd.l.pts [i]; RemapWayPoint pt = new RemapWayPoint(); pt.uv = pData.uv; pt.matArrow = new Material(SWEditorUI.GetShader("RectTRS")); lineInfo.pts.Add(pt); } } }
public override void AfterLoad() { base.AfterLoad(); if (GetChildTexture() != null) { texChildOrigin = GetChildTexture(); texChildResized = SWTextureProcess.TextureResize(texChildOrigin, 512, 512); } DrawNodeWindowEnd(); }
public void GrayApply() { if (data.useGray) { data.dirty = true; if (textureGray != null) { texMask = SWTextureProcess.TextureResize(textureGray, 512, 512); } else { texMask = SWCommon.TextureCreate(512, 512, TextureFormat.ARGB32); } } }
IEnumerator ResizeTex(SWTexResolution temp) { yield return(new WaitForSeconds(0.1f)); bool b = EditorUtility.DisplayDialog("Warning", "Change resolution may loss quality,continue?", "Yes", "No"); pause = false; if (b) { //SWUndo.Record (node); node.data.reso = temp; EditorUtility.DisplayProgressBar("Texture resizing", "Please wait", 0.5f); node.UpdateTex(); SWTextureProcess.TextureResize(node.textureEx, node.data.resolution); EditorUtility.ClearProgressBar(); } }
/// <summary> /// Apply just before Update /// </summary> public void GrayApply() { if (data.useGray) { data.dirty = true; if (textureGray != null) { if (textureGray.width == textureGray.height && SWDataNode.resoList.Contains(textureGray.width)) { texMask = new SWTexture2DEx(textureGray); } else { texMask = SWTextureProcess.TextureResize(textureGray, SWGlobalSettings.TexDefaultSize, SWGlobalSettings.TexDefaultSize); } } else { texMask = SWCommon.TextureCreate(SWGlobalSettings.TexDefaultSize, SWGlobalSettings.TexDefaultSize, TextureFormat.ARGB32); } } }
void Op() { // Debug.Log (Event.current.type); brush.mode = (SWBrushMode)slotBox_left.selection; if (!al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY))) { return; } if (Event.current.control || Event.current.alt) { return; } if (!drawRect.Contains(mousePos)) { return; } if (brush.mode == SWBrushMode.dropper) { if (SWWindowMain.Instance.nRoot.texture != null && SWCommon.GetMouseDown(0, false) && al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY))) { CalUV(); SWTexture2DEx _tex = SWTextureProcess.TextureResize(SWWindowMain.Instance.nRoot.texture, texWidth, texHeight); SWTextureProcess.ProcessMask_Dropper(node.texMask, _tex, uv, brush, tolerance); lastUV = uv; node.data.dirty = true; hasFirstPoint = false; } } else if (brush.mode == SWBrushMode.wand) { if (SWWindowMain.Instance.nRoot.texture != null && SWCommon.GetMouseDown(0, false) && al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY))) { CalUV(); SWTexture2DEx _tex = SWTextureProcess.TextureResize(SWWindowMain.Instance.nRoot.texture, texWidth, texHeight); SWTextureProcess.ProcessMask_Wand(node.texMask, _tex, uv, brush, tolerance); lastUV = uv; node.data.dirty = true; hasFirstPoint = false; } } else if (brush.mode == SWBrushMode.brush || brush.mode == SWBrushMode.erase) { if (SWCommon.GetMouseDown(0, false) && al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY))) { if (Event.current.shift && hasFirstPoint) { GoLine(); } else { GoPoint(); } } else if (SWCommon.GetMouse(0)) { GoLine(); } } }
public void UpdateTex() { texChildOrigin = GetChildTexture(); texChildResized = SWTextureProcess.TextureResize(texChildOrigin, data.resolution, data.resolution); texChildResized.filterMode = FilterMode.Point; }
void UpdateTex() { texChildOrigin = GetChildTexture(); texChildResized = SWTextureProcess.TextureResize(texChildOrigin, 512, 512); texChildResized.filterMode = FilterMode.Point; }