Strange curvature on what should be a Sharp Corner

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
drumlug13
Posts: 537
Joined: Sun May 22, 2011 9:16 pm
Location: Beautiful St. Louis, MO

Strange curvature on what should be a Sharp Corner

Post by drumlug13 »

Just wondering if this happens to anybody else and if there is a way to make it stop. It's an easy fix but it happens every single time.

So the problem is with the point the arrow is pointing at. I created the 2 points at the bottom first, using the Add Points tool set to Sharp Corners, then I turned off Sharp Corners and added the point in the middle and dragged it up to create the arc. The first point on the bottom is fine, but the line leading into the 2nd point at the bottom is distorted. Checking the points with the Curvature Tool shows that both points at the bottom have a curvature of 0, and the point at the top of the arc has the default curvature of 30. (I did pull the Bezier handle out a bit just to highlight my point)

Image

You can see here that the curvature of this point is still at 0, just like the first point. But you can see the distortion the path takes to the point on just this side

Image

The fix is easy. You just have to click and do a slight drag on the point to give it a minimal curve and it fixes. I've even manually added a curvature of 0.000001 and it straightens out when you hit enter.

Image

I can recreate this scenario 100% of the time. It doesn't matter how many points you add to the line it always happens to the last point created as a Sharp Corner. This is a technique I use quite often, (I'm sure I'm not the only one). Like if I needed a cartoony row of rounded mountains, I make a line of 5 or 6 points with the Sharp Corners turned on. Then I turn Sharp Corners off and go back to add the curved points in between, click and drag up to create each mountain, (that way you don't have to keep toggling back and forth or go back turning sharp corners into rounded) and they all work fine until you get to the last hill where you have to fix it. That technique works great for creating mountains, leaves, hair etc. But like I said that adds up to a whole lot of fixing.

I'm just wondering if it's doing that to you guys too. Also, I haven't posted in a while so I thought I would say Hi and ask you guys here instead of dropping another problem in Chucky's lap :P
Adam
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Strange curvature on what should be a Sharp Corner

Post by hayasidist »

yep -- happening here too. 13.5.5 Win 10.

looks as though the bezier handle info for the endpoint is not being (re)set properly when the middle point is added.
User avatar
drumlug13
Posts: 537
Joined: Sun May 22, 2011 9:16 pm
Location: Beautiful St. Louis, MO

Re: Strange curvature on what should be a Sharp Corner

Post by drumlug13 »

Same here. I'm still using Win 10
Adam
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Strange curvature on what should be a Sharp Corner

Post by Greenlaw »

Confirmed! I see the same thing happening here. Must be a bug.

Moho 13.5.5, Windows 11.

Funny I never noticed that, probably because I tend to draw everything with straight angle and then apply Smooth (ctrl-M) only where I need it. (For me it's faster to draw point-by-point this way.)

Update: I see this even with Eugene's new Curve tool script, so maybe a bug in Moho's core programming?
User avatar
drumlug13
Posts: 537
Joined: Sun May 22, 2011 9:16 pm
Location: Beautiful St. Louis, MO

Re: Strange curvature on what should be a Sharp Corner

Post by drumlug13 »

Greenlaw wrote: Sat Mar 04, 2023 5:52 pm Update: I see this even with Eugene's new Curve tool script, so maybe a bug in Moho's core programming?
Yeah that was going to be my next question. I'm running with zero added scripts now but I watched the video for Mr. Curve the other day. It looks pretty outstanding
Adam
User avatar
drumlug13
Posts: 537
Joined: Sun May 22, 2011 9:16 pm
Location: Beautiful St. Louis, MO

Re: Strange curvature on what should be a Sharp Corner

Post by drumlug13 »

Greenlaw wrote: Sat Mar 04, 2023 5:52 pmI tend to draw everything with straight angle and then apply Smooth (ctrl-M) only where I need it. (For me it's faster to draw point-by-point this way.)
And I never knew that one. But are you using "M" to refer to Control as a modifier or do you mean a combo of the 2 keys? Because I just tried it and that stretch from Control to M is too much (I know, first world problems are horrible). So I just drew with Sharp Corners on and hitting Control alone smooths the next point.
Adam
User avatar
synthsin75
Posts: 9979
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Strange curvature on what should be a Sharp Corner

Post by synthsin75 »

This seems to fix the problem.

Code: Select all

-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************

ScriptName = "LM_AddPoint"

-- **************************************************
-- General information about this script
-- **************************************************

LM_AddPoint = {}

LM_AddPoint.BASE_STR = 2020
LM_AddPoint.STR_LABEL = LM_AddPoint.BASE_STR
LM_AddPoint.STR_DESC = LM_AddPoint.BASE_STR + 1
LM_AddPoint.STR_SELECT = LM_AddPoint.BASE_STR + 2
LM_AddPoint.STR_SHARPCORNERS = LM_AddPoint.BASE_STR + 3

function LM_AddPoint:Name()
	return "Add Point"
end

function LM_AddPoint:Version()
	return "6.0"
end

function LM_AddPoint:IsBeginnerScript()
	return true
end

function LM_AddPoint:Description()
	return string.format(
		MOHO.Localize("/Scripts/Tool/AddPoint/Description=Add a point (press <%s> to weld, hold <alt> to disable auto-welding, <ctrl/cmd> to reverse sharp corners)"),
		MOHO.BindingKeyName()
	)
end

function LM_AddPoint:BeginnerDescription()
	return MOHO.Localize("/Scripts/Tool/AddPoint/BeginnerDescription=Click and drag to create a new curve segment. Click on an existing curve to add an additional point. Drag a curve endpoint on top of another point and weld them together to create a closed shape with 'Auto Weld' enabled.")
end

function LM_AddPoint:BeginnerDisabledDescription()
	return MOHO.Localize("/Scripts/Tool/AddPoint/BeginnerDisabledDescription=A vector layer needs to be selected in the Layers window, and you need to be on Frame 0 in the Timeline to use this tool.")
end

function LM_AddPoint:Creator()
	return "Lost Marble LLC, modified by J.Wesley Fowler (synthsin75)"
end

function LM_AddPoint:UILabel()
	return(MOHO.Localize("/Scripts/Tool/AddPoint/AddPoint=Add Point"))
end

function LM_AddPoint:LoadPrefs(prefs)
	self.sharpCorners = prefs:GetBool("LM_AddPoint.sharpCorners", false)
end

function LM_AddPoint:SavePrefs(prefs)
	prefs:SetBool("LM_AddPoint.sharpCorners", self.sharpCorners)
end

function LM_AddPoint:ResetPrefs()
	self.sharpCorners = false
	LM_TransformPoints.autoWeld = false
	LM_TransformPoints.autoWeldRadius = 12
	LM_TransformPoints.autoFill = true
end

function LM_AddPoint:NonDragMouseMove()
	return true -- Call MouseMoved() even if the mouse button is not down
end

-- **************************************************
-- Recurring values
-- **************************************************

LM_AddPoint.numSel = 0
LM_AddPoint.selID = 0
LM_AddPoint.startWeldVec = LM.Vector2:new_local()
LM_AddPoint.startWeldVec:Set(-10000000, -10000000)
LM_AddPoint.startWeldToPoint = true

-- **************************************************
-- The guts of this script
-- **************************************************

function LM_AddPoint:IsEnabled(moho)
	if (moho:DisableDrawingTools()) then
		return false
	end
	local mesh = moho:DrawingMesh()
	if (mesh == nil) then
		return false
	end
	if (moho.drawingLayer:CurrentAction() ~= "") then
		return false -- creating new objects in the middle of an action can lead to unexpected results
	end
	return true
end

function LM_AddPoint:IsRelevant(moho)
	if (moho:DisableDrawingTools()) then
		return false
	end
	local mesh = moho:DrawingMesh()
	if (mesh == nil) then
		return false
	end
	return true
end

function LM_AddPoint:OnInputDeviceEvent(moho, deviceEvent)
	return LM_TransformPoints:OnInputDeviceEvent(moho, deviceEvent)
end

function LM_AddPoint:OnMouseDown(moho, mouseEvent)
	local mesh = moho:DrawingMesh()
	if (mesh == nil) then
		return
	end

	self.startWeldVec:Set(-10000000, -10000000)

	moho.document:PrepUndo(moho.drawingLayer)
	moho.document:SetDirty()

	self.fixedHandles = LM_TransformPoints.fixedHandles

	local closestID = -1
	local closest = 1e6
	local curveID = -1
	local segID = -1
	local sharpCorners = self.sharpCorners

	if (mouseEvent.ctrlKey) then
		sharpCorners = not sharpCorners
	end
	if (mesh:ContinuousTriangulation()) then
		sharpCorners = true
	end

	mesh:SelectNone()
	if (not(mouseEvent.altKey)) then
		-- find the closest point for auto-welding the new point to
		local testVec1 = LM.Vector2:new_local()
		testVec1:Set(mouseEvent.drawingVec)
		closestID = mesh:ClosestPoint(testVec1)
		if (closestID >= 0) then
			local testVec2 = LM.Vector2:new_local()
			testVec2:Set(mesh:Point(closestID).fPos)

			-- convert the two chosen points to pixel coordinates
			-- this is to make sure that they are actually close enough in screen space
			local p1 = LM.Point:new_local()
			local p2 = LM.Point:new_local()
			local m = LM.Matrix:new_local()
			moho.drawingLayer:GetFullTransform(moho.frame, m, moho.document)
			m:Transform(testVec1)
			m:Transform(testVec2)
			mouseEvent.view:Graphics():WorldToScreen(testVec1, p1)
			mouseEvent.view:Graphics():WorldToScreen(testVec2, p2)
			p1.x = p1.x - p2.x
			p1.y = p1.y - p2.y
			closest = (p1.x * p1.x) + (p1.y * p1.y)
		end
	end

	self.secondPtID = -1

	if (closest < LM_TransformPoints.autoWeldRadius * LM_TransformPoints.autoWeldRadius and not(mouseEvent.altKey)) then -- add as an extension to an existing point
		LM_TransformPoints.fixedHandles = false
		if (mesh:Point(closestID):IsEndpoint()) then -- extend this curve
			mesh:AddPoint(mouseEvent.drawingVec, closestID, moho.drawingLayerFrame)
		else -- start a new curve that is connected to this point
			mesh:AddPoint(mouseEvent.drawingVec, -1, moho.drawingLayerFrame)
			if (sharpCorners) then
				mesh:Point(mesh:CountPoints() - 1):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
				mesh:Point(mesh:CountPoints() - 2):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
				mesh:Point(closestID):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
			end
			mesh:WeldPoints(mesh:CountPoints() - 2, closestID, moho.drawingLayerFrame)
		end
		if (sharpCorners) then
			mesh:Point(mesh:CountPoints() - 1):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
		end
	else
		local curveID = -1
		local segID = -1

		if (not mouseEvent.altKey) then
			local pickWidth = 3
			while (pickWidth < LM_TransformPoints.autoWeldRadius) do
				curveID = -1
				segID = -1
				curveID, segID = mouseEvent.view:PickEdge(mouseEvent.pt, curveID, segID, pickWidth)
				if (curveID >= 0) then
					break
				end
				pickWidth = pickWidth + 3
			end
		end
		if (curveID >= 0) then -- add a point in the middle of some curve
			if (moho.gridOn) then
				moho:SnapToGrid(mouseEvent.drawingStartVec)
				moho:SnapToGrid(mouseEvent.drawingVec)
			end
			local v = mesh:Curve(curveID):ClosestPointOnSegment(segID, mouseEvent.drawingVec, true, true)
			mesh:AddPoint(v, curveID, segID, moho.drawingLayerFrame, LM_TransformPoints:UseFixedHandles(moho))
--syn\/
			mesh:Curve(curveID):SetWeight(mesh:CountPoints()-1, 0, moho.drawingLayerFrame, true)
--syn/\
		else -- add a new curve segment
			LM_TransformPoints.fixedHandles = false
			if (moho.gridOn) then
				moho:SnapToGrid(mouseEvent.drawingStartVec)
				moho:SnapToGrid(mouseEvent.drawingVec)
			end
			mesh:AddPoint(mouseEvent.drawingVec, -1, moho.drawingLayerFrame)
			if (sharpCorners) then
				mesh:Point(mesh:CountPoints() - 1):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
				mesh:Point(mesh:CountPoints() - 2):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
			end
			self.secondPtID = mesh:CountPoints() - 2
		end
		if (sharpCorners) then
			mesh:Point(mesh:CountPoints() - 1):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
		end
	end

	LM_TransformPoints.selID = mesh:CountPoints() - 1
	mouseEvent.ctrlKey = false
	LM_TransformPoints:OnMouseDown(moho, mouseEvent)

	moho:AddPointKeyframe(moho.drawingFrame)

	mouseEvent.view:DrawMe()
end

function LM_AddPoint:OnMouseMoved(moho, mouseEvent)
	local mesh = moho:DrawingMesh()
	if (mesh == nil) then
		return
	end

	if (mesh:CountPoints() < 1) then
		return
	end
	
	if (not LM_TransformPoints.dragging) then

		if (mouseEvent.altKey) then
			if (self.startWeldVec.x > -1000000) then
				self.startWeldVec:Set(-10000000, -10000000)
				mouseEvent.view:DrawMe()
			end
			return
		end

		-- Display the upcoming weld points for the user's benefit
		local m = LM.Matrix:new_local()
		local testVec1 = LM.Vector2:new_local()
		local testVec2 = LM.Vector2:new_local()
		local p1 = LM.Point:new_local()
		local p2 = LM.Point:new_local()
		local dist = 0
		local curveID = -1
		local segID = -1
		local pickWidth = 3
		local id = mesh:ClosestPoint(mouseEvent.drawingVec)
		local pt

		self.startWeldVec:Set(-10000000, -10000000)
		if (id >= 0) then
			pt = mesh:Point(id)
			testVec1:Set(mouseEvent.drawingVec)
			testVec2:Set(pt.fPos)
			moho.drawingLayer:GetFullTransform(moho.frame, m, moho.document)
			m:Transform(testVec1)
			moho.view:Graphics():WorldToScreen(testVec1, p1)
			m:Transform(testVec2)
			moho.view:Graphics():WorldToScreen(testVec2, p2)

			p2.x = p1.x - p2.x
			p2.y = p1.y - p2.y
			dist = (p2.x * p2.x) + (p2.y * p2.y)
			if (dist < LM_TransformPoints.autoWeldRadius * LM_TransformPoints.autoWeldRadius) then
				self.startWeldToPoint = true
				self.startWeldVec:Set(pt.fPos)
				mouseEvent.view:DrawMe()
				return
			end
		end

		while (pickWidth < LM_TransformPoints.autoWeldRadius) do
			curveID, segID = moho.view:PickEdge(p1, curveID, segID, pickWidth)
			if (curveID >= 0) then -- add a point in the middle of some curve
				self.startWeldToPoint = false
				self.startWeldVec:Set(mesh:Curve(curveID):ClosestPointOnSegment(segID, mouseEvent.drawingVec, true, true))
				break
			end
			pickWidth = pickWidth + 3
		end

		mouseEvent.view:DrawMe()
		return
	end

	if (LM_TransformPoints.dragging) then
		if (LM_TransformPoints.selID >= 0) then
			if (mouseEvent.ctrlKey) then
				if (self.sharpCorners and not mesh:ContinuousTriangulation()) then
					mesh:Point(LM_TransformPoints.selID):SetCurvature(MOHO.SMOOTH, 0)
				else
					mesh:Point(LM_TransformPoints.selID):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
				end
			else
				if (self.sharpCorners or mesh:ContinuousTriangulation()) then
					mesh:Point(LM_TransformPoints.selID):SetCurvature(MOHO.PEAKED, moho.drawingLayerFrame)
				else
					mesh:Point(LM_TransformPoints.selID):SetCurvature(MOHO.SMOOTH, 0)
				end
			end
		end
	end
	mouseEvent.ctrlKey = false
	LM_TransformPoints:OnMouseMoved(moho, mouseEvent)
end

function LM_AddPoint:OnMouseUp(moho, mouseEvent)
	local mesh = moho:DrawingMesh()
	if (mesh == nil) then
		return
	end

	local ptID = LM_TransformPoints.selID

	self.startWeldVec:Set(-10000000, -10000000)
	mouseEvent.ctrlKey = false
	LM_TransformPoints:OnMouseUp(moho, mouseEvent)
	LM_TransformPoints.fixedHandles = self.fixedHandles

	local doUpdateUI = false

	if (moho.drawingLayerFrame > 0) then
		if (ptID >= 0 and ptID < mesh:CountPoints()) then
			local point = mesh:Point(ptID)
			point.fAnimPos:SetValue(0, point.fAnimPos.value) point.fAnimPos:DeleteKey(moho.drawingLayerFrame)
			point.fWidth:SetValue(0, point.fWidth.value) point.fWidth:DeleteKey(moho.drawingLayerFrame)
			point.fColor:SetValue(0, point.fColor.value) point.fColor:DeleteKey(moho.drawingLayerFrame)
			point.fColorStrength:SetValue(0, point.fColorStrength.value) point.fColorStrength:DeleteKey(moho.drawingLayerFrame)
			local numCurves = point:CountCurves()
			for i = 0, point:CountCurves() - 1 do
				local curve = nil
				local ptPos = -1
				curve, ptPos = point:Curve(i, ptPos)
				curve:DeleteCurvatureKey(ptPos, moho.drawingLayerFrame)
			end
			doUpdateUI = true
		end

		if (self.secondPtID >= 0 and self.secondPtID < mesh:CountPoints()) then
			local point = mesh:Point(self.secondPtID)
			point.fAnimPos:SetValue(0, point.fAnimPos.value) point.fAnimPos:DeleteKey(moho.drawingLayerFrame)
			point.fWidth:SetValue(0, point.fWidth.value) point.fWidth:DeleteKey(moho.drawingLayerFrame)
			point.fColor:SetValue(0, point.fColor.value) point.fColor:DeleteKey(moho.drawingLayerFrame)
			point.fColorStrength:SetValue(0, point.fColorStrength.value) point.fColorStrength:DeleteKey(moho.drawingLayerFrame)
			local numCurves = point:CountCurves()
			for i = 0, point:CountCurves() - 1 do
				local curve = nil
				local ptPos = -1
				curve, ptPos = point:Curve(i, ptPos)
				curve:DeleteCurvatureKey(ptPos, moho.drawingLayerFrame)
			end
			doUpdateUI = true
		end
	end

	if (ptID >= 0 and ptID < mesh:CountPoints()) then
		mesh:MakePointConsistentWithNeighbors(ptID, moho.drawingLayerFrame)
		self.secondPtID = -1

		doUpdateUI = true
	end

	if (doUpdateUI) then
		moho:UpdateUI()
	end
end

function LM_AddPoint:OnKeyDown(moho, keyEvent)
	LM_TransformPoints:OnKeyDown(moho, keyEvent)
end

function LM_AddPoint:DrawMe(moho, view)
	if (LM_TransformPoints.fillingShape) then
		local g = view:Graphics()
		local matrix = LM.Matrix:new_local()

		moho.drawingLayer:GetFullTransform(moho.frame, matrix, moho.document)
		g:Push()
		g:ApplyMatrix(matrix)

		view:DrawPreviewShape()

		g:Pop()
	elseif (not LM_TransformPoints.dragging) then
		local g = view:Graphics()
		local matrix = LM.Matrix:new_local()
	
		moho.drawingLayer:GetFullTransform(moho.frame, matrix, moho.document)
		g:Push()
		g:ApplyMatrix(matrix)

		if (self.startWeldToPoint) then
			g:SetColor(0, 255, 0, 128)
		else
			g:SetColor(255, 0, 0, 128)
		end
		g:SetSmoothing(true)
		g:SetBezierTolerance(2)
		g:FillCircle(self.startWeldVec, moho:PixelToDoc(LM_TransformPoints.autoWeldRadius) / g:CurrentScale(false))
		g:SetSmoothing(false)
	
		g:Pop()
		
		-- Draw bezier handles
		if (LM_TransformPoints.showHandles) then
			local mesh = moho:DrawingMesh()
			if (mesh == nil) then
				return
			end
		
			g:Push()
			g:ApplyMatrix(matrix)
			g:SetSmoothing(true)
		
			local meshLayer = moho:LayerAsVector(moho.drawingLayer)
			local selectedOnly = false
			--[[if (self.isDragging) then
				if (self.numSel > 1) then
					selectedOnly = true
				end
			elseif (moho:CountSelectedPoints() > 1) then
				selectedOnly = true
			end]]
			if (moho:CountSelectedPoints() < 2) then
				meshLayer:DrawHandles(moho.document, g, selectedOnly)
			end
		
			g:Pop()
		end
		return
	end
	LM_TransformPoints:DrawMe(moho, view)
end

-- **************************************************
-- Tool options - create and respond to tool's UI
-- **************************************************

LM_AddPoint.DUMMY = MOHO.MSG_BASE
LM_AddPoint.AUTOWELD = MOHO.MSG_BASE + 1
LM_AddPoint.AUTOFILL = MOHO.MSG_BASE + 2
LM_AddPoint.AUTOSTROKE = MOHO.MSG_BASE + 3
LM_AddPoint.SHARPCORNERS = MOHO.MSG_BASE + 4
LM_AddPoint.SHOWHANDLES = MOHO.MSG_BASE + 5
LM_AddPoint.FIXEDHANDLES = MOHO.MSG_BASE + 6
LM_AddPoint.SELECTITEM = MOHO.MSG_BASE + 7
LM_AddPoint.sharpCorners = false

function LM_AddPoint:DoLayout(moho, layout)
	self.menu = LM.GUI.Menu(MOHO.Localize("/Scripts/Tool/AddPoint/SelectGroup=Select Group"))

	self.popup = LM.GUI.PopupMenu(128, false)
	self.popup:SetMenu(self.menu)
	layout:AddChild(self.popup)

	self.autoWeldCheck = LM.GUI.CheckBox(MOHO.Localize("/Scripts/Tool/AddPoint/AutoWeld=Auto-weld"), self.AUTOWELD)
	layout:AddChild(self.autoWeldCheck)

	self.autoFillCheck = LM.GUI.CheckBox(MOHO.Localize("/Scripts/Tool/AddPoint/AutoFill=Auto-fill"), self.AUTOFILL)
	layout:AddChild(self.autoFillCheck)

	self.autoStrokeCheck = LM.GUI.CheckBox(MOHO.Localize("/Scripts/Tool/AddPoint/AutoStroke=Auto-stroke"), self.AUTOSTROKE)
	layout:AddChild(self.autoStrokeCheck)

	self.sharpCornersCheck = LM.GUI.CheckBox(MOHO.Localize("/Scripts/Tool/AddPoint/SharpCorners=Sharp corners"), self.SHARPCORNERS)
	layout:AddChild(self.sharpCornersCheck)
	
	if (MOHO.IsMohoPro()) then
		self.showHandleCheck = LM.GUI.ImageButton("ScriptResources/show_handles", MOHO.Localize("/Scripts/Tool/TransformPoints/ShowBezierHandles=Show Bezier Handles"), true, self.SHOWHANDLES, true)
		layout:AddChild(self.showHandleCheck)

		self.fixedHandleCheck = LM.GUI.ImageButton("ScriptResources/fixed_handles", MOHO.Localize("/Scripts/Tool/TransformPoints/FixedBezierHandles=Fixed Bezier Handles"), true, self.FIXEDHANDLES, true)
		layout:AddChild(self.fixedHandleCheck)
	end
end

function LM_AddPoint:UpdateWidgets(moho)
	if (moho:CurrentTool() ~= "LM_AddPoint") then
		return -- this could get called when doing a double-tap on a multitouch Wacom device with a different active tool
	end

	local mesh = moho:DrawingMesh()
	if (mesh == nil) then
		return
	end

	MOHO.BuildGroupMenu(self.menu, mesh, self.SELECTITEM, self.DUMMY)

	self.autoWeldCheck:SetValue(LM_TransformPoints.autoWeld)
	self.autoFillCheck:SetValue(LM_TransformPoints.autoFill)
	self.autoStrokeCheck:SetValue(LM_TransformPoints.autoStroke)
	self.sharpCornersCheck:SetValue(LM_AddPoint.sharpCorners)
	if (MOHO.IsMohoPro()) then
		self.showHandleCheck:SetValue(LM_TransformPoints.showHandles)
		self.fixedHandleCheck:SetValue(LM_TransformPoints.fixedHandles)
		self.fixedHandleCheck:Enable(LM_TransformPoints.showHandles)
	end
end

function LM_AddPoint:HandleMessage(moho, view, msg)
	local mesh = moho:DrawingMesh()
	if (mesh == nil) then
		return
	end

	if (msg == self.AUTOWELD) then
		LM_TransformPoints.autoWeld = self.autoWeldCheck:Value()
	elseif (msg == self.AUTOFILL) then
		LM_TransformPoints.autoFill = self.autoFillCheck:Value()
	elseif (msg == self.AUTOSTROKE) then
		LM_TransformPoints.autoStroke = self.autoStrokeCheck:Value()
	elseif (msg == self.SHARPCORNERS) then
		LM_AddPoint.sharpCorners = self.sharpCornersCheck:Value()
	elseif (msg == self.SHOWHANDLES) then
		if (MOHO.IsMohoPro()) then
			LM_TransformPoints.showHandles = self.showHandleCheck:Value()
			moho:UpdateUI()
		end
	elseif (msg == self.FIXEDHANDLES) then
		if (MOHO.IsMohoPro()) then
			LM_TransformPoints.fixedHandles = self.fixedHandleCheck:Value()
		end
	elseif (msg >= self.SELECTITEM) then
		mesh:SelectNone()
		local i = msg - self.SELECTITEM
		local name = mesh:Group(i):Name()
		mesh:SelectGroup(name)
		moho:UpdateUI()
	end
end
User avatar
synthsin75
Posts: 9979
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Strange curvature on what should be a Sharp Corner

Post by synthsin75 »

drumlug13 wrote: Sat Mar 04, 2023 6:52 pm ...that stretch from Control to M is too much (I know, first world problems are horrible).
Most keyboards also have a right side control button.
User avatar
drumlug13
Posts: 537
Joined: Sun May 22, 2011 9:16 pm
Location: Beautiful St. Louis, MO

Re: Strange curvature on what should be a Sharp Corner

Post by drumlug13 »

I know it's been a while Wes, but you gotta remember... I'm a complete idiot (Missed you guys)
Adam
User avatar
synthsin75
Posts: 9979
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Strange curvature on what should be a Sharp Corner

Post by synthsin75 »

Meh, who uses the right alt and control keys on the regular? Easy to forget about them.
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Strange curvature on what should be a Sharp Corner

Post by hayasidist »

synthsin75 wrote: Sat Mar 04, 2023 7:00 pm This seems to fix the problem.
Nice one Wes!
be worth logging the issue and the fix in the usual place?!
User avatar
synthsin75
Posts: 9979
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Strange curvature on what should be a Sharp Corner

Post by synthsin75 »

hayasidist wrote: Sat Mar 04, 2023 7:45 pm Nice one Wes!
be worth logging the issue and the fix in the usual place?!
Done. Thanks for reminding me.
User avatar
drumlug13
Posts: 537
Joined: Sun May 22, 2011 9:16 pm
Location: Beautiful St. Louis, MO

Re: Strange curvature on what should be a Sharp Corner

Post by drumlug13 »

Okay Wes, or anybody else who has a minute to walk me through the steps for this. It's been forever since I've tried to install a script and I don't even know where to find the code for Moho. Is that something to just paste over the existing code
for Add Point... Or is this installed as it's own script?

If you guys ever need a massive hole in your ceiling fixed or just want to relax to a live rock band in your living room, I'm your guy. But this code/script stuff I've always avoided like the plague.
Adam
User avatar
synthsin75
Posts: 9979
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Strange curvature on what should be a Sharp Corner

Post by synthsin75 »

https://dl.dropboxusercontent.com/s/gph ... t.zip?dl=0

In your custom content folder (create one from the Edit>Preferences>General tab, if you don't have one), drop these two file into your Scripts>Tool folder.
Last edited by synthsin75 on Sat Mar 04, 2023 8:18 pm, edited 1 time in total.
User avatar
drumlug13
Posts: 537
Joined: Sun May 22, 2011 9:16 pm
Location: Beautiful St. Louis, MO

Re: Strange curvature on what should be a Sharp Corner

Post by drumlug13 »

Thanks again
Adam
Post Reply