public override bool MouseEventPointedLine() { if (!EditorInputManager.GetMouseButton(0)) { return(false); } var vrtA = PointedLine.points[0].meshPoint; var vrtB = PointedLine.points[1].meshPoint; if (EditorInputManager.Control) { _edgeValue = (vrtA.edgeStrength + vrtB.edgeStrength) * 0.5f; } else { if (PointedLine.SameAsLastFrame) { return(true); } PutEdgeOnLine(PointedLine); return(true); } return(false); }
public override bool MouseEventPointedTriangle() { if (!EditorInputManager.GetMouseButton(0)) { return(false); } if (PointedTriangle.SameAsLastFrame) { return(true); } var bcf = Cfg.brushConfig; var c = bcf.Color; foreach (var u in PointedTriangle.vertexes) { foreach (var vuv in u.meshPoint.vertices) { bcf.mask.SetValuesOn(ref vuv.color, c); } } EditedMesh.dirtyColor = true; return(true); }
public override bool MouseEventPointedLine() { if (EditorInputManager.GetMouseButton(0)) { if (MergeUnmerge) { if (!EditorInputManager.getShiftKey()) { Dirty |= PointedLine.AllVerticesShared(); } else { Dirty |= PointedLine.GiveUniqueVerticesToTriangles(); } } else { for (int i = 0; i < 2; i++) { Dirty |= PointedLine[i].SetSmoothNormal(!EditorInputManager.getShiftKey()); } } } return(false); }
public override void ManageDragging() { if (PointedTris != null && SelectedUV != null) { Vector2 uv = SelectedUV.SharedEditedUV; Vector2 posUV = PointedTris.LocalPosToEditedUV(MeshMGMT.collisionPosLocal); Vector2 newUV = uv * 2 - posUV; bool isChanged = newUV != lastCalculatedUV; lastCalculatedUV = newUV; if (isChanged && !EditorInputManager.GetMouseButtonUp(0)) { var prMesh = FreshPreviewMesh; if (prMesh.selectedUV != null) { prMesh.selectedUV.SharedEditedUV = lastCalculatedUV; MeshMGMT.target.meshFilter.sharedMesh = new MeshConstructor(prMesh, MeshMGMT.target.MeshProfile, MeshMGMT.target.meshFilter.sharedMesh).Construct(); } } } if (EditorInputManager.GetMouseButtonUp(0)) { MeshMGMT.SelectedUV.SharedEditedUV = lastCalculatedUV; EditedMesh.Dirty = true; MeshMGMT.Dragging = false; } if (!EditorInputManager.GetMouseButton(0)) { MeshMGMT.Dragging = false; } }
public override bool MouseEventPointedTriangle() { if (EditorInputManager.GetMouseButton(0)) { if (ProjectionUV) { if (PointedTris.SameAsLastFrame) { return(true); } if (MeshMGMT.SelectedUV == null) { MeshMGMT.SelectedUV = EditedMesh.meshPoints[0].uvpoints[0]; } Vector3 trgPos = MeshMGMT.target.transform.position; // float portion = 1f / Mathf.Max(0.01f, MeshUVprojectionSize); for (int i = 0; i < 3; i++) { PointedTris.vertexes[i].EditedUV = PosToUV(PointedTris.vertexes[i].meshPoint.WorldPos - trgPos); } EditedMesh.Dirty = true; return(true); } } return(false); }
public override bool MouseEventPointedTriangle() { if (EditorInputManager.GetMouseButton(0)) { if (PointedTris.SameAsLastFrame) { return(true); } BrushConfig bcf = Cfg.brushConfig; Color c = bcf.colorLinear.ToGamma(); foreach (var u in PointedTris.vertexes) { foreach (var vuv in u.meshPoint.uvpoints) { bcf.mask.Transfer(ref vuv._color, c); } } // a.vert.SetColorOnLine(c, bcf.mask, b.vert);//setColor(glob.colorSampler.color, glob.colorSampler.mask); // b.vert.SetColorOnLine(c, bcf.mask, a.vert); MeshMGMT.edMesh.dirty_Color = true; return(true); } return(false); }
public override bool MouseEventPointedTriangle() { if (EditorInputManager.GetMouseButtonDown(0) && EditorInputManager.Control) { _curSubMesh = MeshMGMT.PointedTriangle.subMeshIndex; #if PEGI ("SubMesh " + _curSubMesh).showNotificationIn3D_Views(); #endif } if (!EditorInputManager.GetMouseButton(0) || EditorInputManager.Control || (MeshMGMT.PointedTriangle.subMeshIndex == _curSubMesh)) { return(false); } if (PointedTriangle.SameAsLastFrame) { return(true); } MeshMGMT.PointedTriangle.subMeshIndex = _curSubMesh; EditedMesh.subMeshCount = Mathf.Max(MeshMGMT.PointedTriangle.subMeshIndex + 1, EditedMesh.subMeshCount); EditedMesh.Dirty = true; return(true); }
public override bool MouseEventPointedTriangle() { if (EditorInputManager.GetMouseButton(0)) { EditedMesh.Dirty |= PointedTris.SetSharpCorners(SetTo); } return(false); }
public override bool MouseEventPointedLine() { if (EditorInputManager.GetMouseButton(0)) { foreach (var t in MeshMGMT.PointedLine.GetAllTriangles()) { EditedMesh.Dirty |= t.SetSharpCorners(_setTo); } } return(false); }
public override void ManageDragging() { var m = MeshMGMT; bool beforeCouldDrag = m.dragDelay <= 0; if (EditorInputManager.GetMouseButtonUp(0) || !EditorInputManager.GetMouseButton(0)) { m.Dragging = false; if (beforeCouldDrag) { EditedMesh.dirty_Position = true; } else if ((m.TrisVerts < 3) && (m.SelectedUV != null) && (!m.IsInTrisSet(m.SelectedUV.meshPoint))) { m.AddToTrisSet(m.SelectedUV); } } else { m.dragDelay -= Time.deltaTime; bool canDrag = m.dragDelay <= 0; if (beforeCouldDrag != canDrag && EditorInputManager.getAltKey() && (m.SelectedUV.meshPoint.uvpoints.Count > 1)) { m.DisconnectDragged(); } if (canDrag || !Application.isPlaying) { if ((GridNavigator.Inst().AngGridToCamera(GridNavigator.onGridPos) < 82)) { Vector3 delta = GridNavigator.onGridPos - originalPosition; if (delta.magnitude > 0) { m.TrisVerts = 0; foreach (var v in draggedVertices) { v.WorldPos += delta; } originalPosition = GridNavigator.onGridPos; } } } } }
public override void ManageDragging() { var m = MeshMGMT; var beforeCouldDrag = m.DragDelay <= 0; if (EditorInputManager.GetMouseButtonUp(0) || !EditorInputManager.GetMouseButton(0)) { m.Dragging = false; if (beforeCouldDrag) { EditedMesh.dirtyPosition = true; } else { OnClickDetected(); } } else { var canDrag = m.DragDelay <= 0; if (beforeCouldDrag != canDrag && EditorInputManager.Alt && m.SelectedUv.meshPoint.vertices.Count > 1) { m.DisconnectDragged(); } if (!canDrag || !(GridNavigator.Inst().AngGridToCamera(GridNavigator.onGridPos) < 82)) { return; } var delta = GridNavigator.onGridPos - _originalPosition; if (delta.magnitude == 0) { return; } m.TriVertices = 0; foreach (var v in _draggedVertices) { v.WorldPos += delta; } _originalPosition = GridNavigator.onGridPos; } }
public override bool MouseEventPointedVertex() { if ((EditorInputManager.GetMouseButton(0))) { if (PointedUV.SameAsLastFrame) { return(true); } BrushConfig bcf = Cfg.brushConfig; bcf.colorLinear.ToV4(ref PointedVertex.shadowBake, bcf.mask); MeshMGMT.edMesh.Dirty = true; return(true); } return(false); }
public override bool MouseEventPointedVertex() { if ((EditorInputManager.GetMouseButton(0))) { if (PointedUv.SameAsLastFrame) { return(true); } var bcf = Cfg.brushConfig; //bcf.colorLinear.ToV4(ref PointedVertex.shadowBake, bcf.mask); bcf.mask.SetValuesOn(ref PointedVertex.shadowBake, bcf.Color); EditedMesh.Dirty = true; return(true); } return(false); }
public override bool MouseEventPointedTriangle() { if (EditorInputManager.GetMouseButton(0)) { if (EditorInputManager.Control) _curAtlasTexture = (int)MeshMGMT.PointedTriangle.textureNo[curAtlasChanel]; else if (PointedTriangle.textureNo[curAtlasChanel] != _curAtlasTexture) { if (PointedTriangle.SameAsLastFrame) return true; PointedTriangle.textureNo[curAtlasChanel] = _curAtlasTexture; EditedMesh.Dirty = true; return true; } } return false; }
public override bool MouseEventPointedLine() { if (EditorInputManager.GetMouseButton(0)) { var vrtA = PointedLine.pnts[0].meshPoint; var vrtB = PointedLine.pnts[1].meshPoint; if (EditorInputManager.getControlKey()) { edgeValue = (vrtA.edgeStrength + vrtB.edgeStrength) * 0.5f; } else { if (PointedLine.SameAsLastFrame) { return(true); } PutEdgeOnLine(PointedLine); return(true); /* vrtA.edgeStrength = edgeValue; * vrtB.edgeStrength = edgeValue; * * var tris = pointedLine.getAllTriangles_USES_Tris_Listing(); * * foreach (var t in tris) * t.edgeWeight[t.NotOnLineIndex(pointedLine)] = edgeValue;// true; * * * if (AlsoDoColor) { * var col = globalBrush.colorLinear.ToGamma(); * foreach (UVpoint uvi in vrtA.uvpoints) * globalBrush.mask.Transfer(ref uvi._color, col); * foreach (UVpoint uvi in vrtB.uvpoints) * globalBrush.mask.Transfer(ref uvi._color, col); * } * * meshMGMT.edMesh.dirty = true;*/ } } return(false); }
public override bool MouseEventPointedLine() { if (EditorInputManager.GetMouseButton(0) && !EditorInputManager.Control) { if (PointedLine.SameAsLastFrame) return true; foreach (var t in MeshMGMT.PointedLine.GetAllTriangles()) if (t.textureNo[curAtlasChanel] != _curAtlasTexture) { t.textureNo[curAtlasChanel] = _curAtlasTexture; EditedMesh.Dirty = true; } return true; } return false; }
public override bool MouseEventPointedVertex() { if (EditorInputManager.GetMouseButton(0)) { if (PointedUv.SameAsLastFrame) return true; foreach (var uv in MeshMGMT.PointedUv.meshPoint.vertices ) foreach (var t in uv.triangles) if (t.textureNo[curAtlasChanel] != _curAtlasTexture) { t.textureNo[curAtlasChanel] = _curAtlasTexture; EditedMesh.Dirty = true; } return true; } return false; }
public override bool MouseEventPointedTriangle() { if ((EditorInputManager.GetMouseButton(0))) { if (PointedTris.SameAsLastFrame) { return(true); } BrushConfig bcf = Cfg.brushConfig; foreach (var uv in PointedTris.vertexes) { bcf.colorLinear.ToV4(ref uv.meshPoint.shadowBake, bcf.mask); } MeshMGMT.edMesh.Dirty = true; return(true); } return(false); }
public override bool MouseEventPointedVertex() { if ((EditorInputManager.GetMouseButton(0))) { #if !NO_PEGI if (!PointedUV.meshPoint.AllPointsUnique()) { "Shared points found, Edge requires All Unique".showNotification(); } #endif if (EditorInputManager.getControlKey()) { edgeValue = MeshMGMT.PointedUV.meshPoint.edgeStrength; if (AlsoDoColor) { GlobalBrush.colorLinear.From(PointedUV._color); } // foreach (UVpoint uvi in m.pointedUV.vert.uvpoints) // bcf.mask.Transfer(ref uvi._color, cfg.brushConfig.colorLinear.ToGamma()); } else { if (PointedUV.SameAsLastFrame) { return(true); } MeshMGMT.PointedUV.meshPoint.edgeStrength = ShiftInvertedVelue; if (AlsoDoColor) { var col = GlobalBrush.colorLinear.ToGamma(); foreach (Vertex uvi in PointedUV.meshPoint.uvpoints) { GlobalBrush.mask.Transfer(ref uvi._color, col); } } MeshMGMT.edMesh.Dirty = true; return(true); } } return(false); }
public override bool MouseEventPointedVertex() { if ((!EditorInputManager.GetMouseButton(0))) { return(false); } #if PEGI if (!PointedUv.meshPoint.AllPointsUnique()) { "Shared points found, Edge requires All Unique".showNotificationIn3D_Views(); } #endif if (EditorInputManager.Control) { _edgeValue = MeshMGMT.PointedUv.meshPoint.edgeStrength; if (_alsoDoColor) { GlobalBrush.Color = PointedUv.color; } } else { if (PointedUv.SameAsLastFrame) { return(true); } MeshMGMT.PointedUv.meshPoint.edgeStrength = ShiftInvertedValue; if (_alsoDoColor) { var col = GlobalBrush.Color; foreach (var uvi in PointedUv.meshPoint.vertices) { GlobalBrush.mask.SetValuesOn(ref uvi.color, col); } } EditedMesh.Dirty = true; return(true); } return(false); }
public override bool MouseEventPointedTriangle() { if ((EditorInputManager.GetMouseButton(0))) { if (PointedTriangle.SameAsLastFrame) { return(true); } Brush bcf = Cfg.Brush; foreach (var uv in PointedTriangle.vertexes) { //bcf.colorLinear.ToV4(ref uv.meshPoint.shadowBake, bcf.mask); bcf.mask.SetValuesOn(ref uv.meshPoint.shadowBake, bcf.Color); } EditedMesh.Dirty = true; return(true); } return(false); }
public override bool MouseEventPointedLine() { if (EditorInputManager.GetMouseButton(0) && !EditorInputManager.getControlKey()) { if (PointedLine.SameAsLastFrame) { return(true); } foreach (var t in MeshMGMT.PointedLine.GetAllTriangles_USES_Tris_Listing()) { if (t.textureNo[curAtlasChanel] != curAtlasTexture) { t.textureNo[curAtlasChanel] = curAtlasTexture; MeshMGMT.edMesh.Dirty = true; } } return(true); } return(false); }
public override bool MouseEventPointedTriangle() { if (EditorInputManager.GetMouseButton(0)) { if (EditorInputManager.getControlKey()) { curAtlasTexture = (int)MeshMGMT.PointedTris.textureNo[curAtlasChanel]; } else if (PointedTris.textureNo[curAtlasChanel] != curAtlasTexture) { if (PointedTris.SameAsLastFrame) { return(true); } PointedTris.textureNo[curAtlasChanel] = curAtlasTexture; MeshMGMT.edMesh.Dirty = true; return(true); } } return(false); }
public override bool MouseEventPointedVertex() { if (EditorInputManager.GetMouseButton(0)) { var m = MeshMGMT; var mp = m.PointedUv.meshPoint; if (mp.smoothNormal != EditorInputManager.Alt) { mp.smoothNormal = !mp.smoothNormal; EditedMesh.Dirty = true; "N - on Vertex - smooth Normal".TeachingNotification(); } // m.PointedUV.meshPoint.smoothNormal = !m.PointedUV.meshPoint.smoothNormal; //EditedMesh.Dirty = true; } return(false); }
public override bool MouseEventPointedTriangle() { if (EditorInputManager.GetMouseButtonDown(0) && EditorInputManager.getControlKey()) { curSubmesh = (int)MeshMGMT.PointedTris.submeshIndex; #if !NO_PEGI ("Submesh " + curSubmesh).showNotification(); #endif } if (EditorInputManager.GetMouseButton(0) && !EditorInputManager.getControlKey() && (MeshMGMT.PointedTris.submeshIndex != curSubmesh)) { if (PointedTris.SameAsLastFrame) { return(true); } MeshMGMT.PointedTris.submeshIndex = curSubmesh; EditedMesh.submeshCount = Mathf.Max(MeshMGMT.PointedTris.submeshIndex + 1, EditedMesh.submeshCount); EditedMesh.Dirty = true; return(true); } return(false); }
public override bool MouseEventPointedTriangle() { if (EditorInputManager.GetMouseButton(0)) { if (_mergeUnMerge) { if (EditorInputManager.Shift) { EditedMesh.SetAllVerticesShared(PointedTriangle); } else { EditedMesh.GiveTriangleUniqueVertices(PointedTriangle); } } else { EditedMesh.Dirty |= PointedTriangle.SetSmoothVertices(!EditorInputManager.Shift); } } return(false); }
public override bool MouseEventPointedVertex() { if (EditorInputManager.GetMouseButton(0)) { if (MergeUnmerge) { if (EditorInputManager.getShiftKey()) { EditedMesh.Dirty |= PointedVertex.SetAllUVsShared(); // .SetAllVerticesShared(); } else { EditedMesh.Dirty |= PointedVertex.AllPointsUnique(); //editedMesh.GiveTriangleUniqueVerticles(pointedTris); } } else { EditedMesh.Dirty |= PointedVertex.SetSmoothNormal(!EditorInputManager.getShiftKey()); } } return(false); }
public override bool MouseEventPointedLine() { if (EditorInputManager.GetMouseButton(0)) { if (PointedLine.SameAsLastFrame) { return(true); } BrushConfig bcf = Cfg.brushConfig; Vertex a = PointedLine.pnts[0]; Vertex b = PointedLine.pnts[1]; Color c = bcf.colorLinear.ToGamma(); a.meshPoint.SetColorOnLine(c, bcf.mask, b.meshPoint);//setColor(glob.colorSampler.color, glob.colorSampler.mask); b.meshPoint.SetColorOnLine(c, bcf.mask, a.meshPoint); MeshMGMT.edMesh.dirty_Color = true; return(true); } return(false); }
public override void ManageDragging() { if (PointedTriangle != null && SelectedUv != null) { var uv = SelectedUv.SharedEditedUv; var posUv = PointedTriangle.LocalPosToEditedUv(MeshMGMT.collisionPosLocal); var newUv = uv * 2 - posUv; var isChanged = newUv != _lastCalculatedUv; _lastCalculatedUv = newUv; var trg = MeshEditorManager.target; if (isChanged && !EditorInputManager.GetMouseButtonUp(0)) { var prMesh = GetPreviewMesh; if (prMesh.selectedUv != null) { prMesh.selectedUv.SharedEditedUv = _lastCalculatedUv; trg.SharedMesh = new MeshConstructor(prMesh, trg.MeshProfile, trg.SharedMesh).Construct(); } } } if (EditorInputManager.GetMouseButtonUp(0)) { MeshMGMT.SelectedUv.SharedEditedUv = _lastCalculatedUv; EditedMesh.dirtyUvs = true; Debug.Log("Setting Dirty UV Test"); MeshMGMT.Dragging = false; } if (!EditorInputManager.GetMouseButton(0)) { MeshMGMT.Dragging = false; } }
public override bool MouseEventPointedTriangle() { if (!EditorInputManager.GetMouseButton(0)) { return(false); } if (!projectionUv) { return(false); } if (PointedTriangle.SameAsLastFrame) { return(true); } if (MeshMGMT.SelectedUv == null) { MeshMGMT.SelectedUv = EditedMesh.meshPoints[0].vertices[0]; } if (!EditorInputManager.Control) { var trgPos = MeshEditorManager.targetTransform.position; for (var i = 0; i < 3; i++) { var v = PointedTriangle.vertexes[i]; EditedMesh.dirtyUvs |= v.SetUvIndexBy(PosToUv(v.meshPoint.WorldPos - trgPos)); } } return(true); }