protected void ApplyWand_Dropper() { if (SWCommon.GetMouseDown(0, false) && al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY))) { CalUV(); var firstNode = LayerMask_WandDropperNode(node); if (firstNode.texture == null) { return; } // SWTexture2DEx _tex = SWTextureProcess.TextureResize (firstNode.texture, texWidth, texHeight); SWTexture2DEx _tex = SWTextureProcess.TextureResizeTRS(firstNode.texture, texWidth, texHeight, firstNode.data.effectData); if (brush.mode == SWBrushMode.wand) { SWTextureProcess.ProcessMask_Wand(node.texMask, _tex, uv, brush, tolerance); } else if (brush.mode == SWBrushMode.dropper) { SWTextureProcess.ProcessMask_Dropper(node.texMask, _tex, uv, brush, tolerance); } lastUV = uv; node.data.dirty = true; hasFirstPoint = false; } }
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(); } } }