Page 1 of 2

Edit Bezier Curve

Posted: Mon Apr 26, 2021 12:08 pm
by hayasidist
There was a request for a script that would allow you to grab a curve and drag it about, automatically updating the bezier handles... http://www.lostmarble.com/forum/viewtop ... =5&t=33883


here's an INITIAL version -- use with care .. it has been tested in a benign environment, but I'm fairly sure that active use will find a way to break it...

https://www.mediafire.com/file/vhxz93hn ... r.zip/file

It will run on 12.0 and later -- it is compatible with 13.5 .. only a few hours to go for that now! ;-)


What it does:

- click on a curve segment, then drag the mouse -- the segment arc will follow the mouse and the bezier handles will get updated automatically.

- the segment has six zones:
--- too close to a moho mesh point (and the tool will silently refuse to do anything)
--- in the next 1/6th of the segment - when only the nearest bezier handle will be affected
--- from there to the middle where both handles are (proportionally) affected

and the same three zones on the way to the other end point of the segment...

IOW: too close to a moho point: no action
close to a moho point -- just the one Bezier handle moves
elsewhere -- both handles move

===

I've noticed a couple of "not quite as tidy as I'd have liked" behaviours: sometimes the mouse / pointer will not stay "stuck" to the curve -- the segment still moves in response, but there's a visual gap often when the resulting Bezier handle becomes "very long" ... if this becomes a significant problem let me know please..

Unlike Krita, it does not show the handles moving; and does not give a visual indication that a segment is selected - and I'm planning on leaving it that way unless there's a clamour for such..

As ever - let me know how it works for you / bugs etc / requests for enhancements..

Re: Edit Bezier Curve

Posted: Mon Apr 26, 2021 6:54 pm
by rocken
I am so honoured and happy you made this script.
wowwww.
this is sooooooo useful.
Thanks a million
testing it out now
hayasidist wrote: Mon Apr 26, 2021 12:08 pm There was a request for a script that would allow you to grab a curve and drag it about, automatically updating the bezier handles... http://www.lostmarble.com/forum/viewtop ... =5&t=33883


here's an INITIAL version -- use with care .. it has been tested in a benign environment, but I'm fairly sure that active use will find a way to break it...

https://www.mediafire.com/file/vhxz93hn ... r.zip/file

It will run on 12.0 and later -- it is compatible with 13.5 .. only a few hours to go for that now! ;-)


What it does:

- click on a curve segment, then drag the mouse -- the segment arc will follow the mouse and the bezier handles will get updated automatically.

- the segment has six zones:
--- too close to a moho mesh point (and the tool will silently refuse to do anything)
--- in the next 1/6th of the segment - when only the nearest bezier handle will be affected
--- from there to the middle where both handles are (proportionally) affected

and the same three zones on the way to the other end point of the segment...

IOW: too close to a moho point: no action
close to a moho point -- just the one Bezier handle moves
elsewhere -- both handles move

===

I've noticed a couple of "not quite as tidy as I'd have liked" behaviours: sometimes the mouse / pointer will not stay "stuck" to the curve -- the segment still moves in response, but there's a visual gap often when the resulting Bezier handle becomes "very long" ... if this becomes a significant problem let me know please..

Unlike Krita, it does not show the handles moving; and does not give a visual indication that a segment is selected - and I'm planning on leaving it that way unless there's a clamour for such..

As ever - let me know how it works for you / bugs etc / requests for enhancements..

Re: Edit Bezier Curve

Posted: Mon Apr 26, 2021 7:17 pm
by SimplSam
Good stuff. I had a quick play. It mostly works, but kinda does not feel quite right. I will need to play more...

Re: Edit Bezier Curve

Posted: Tue Apr 27, 2021 4:26 am
by alanthebox
I didn't realize how much I missed this functionality until now! Thanks for putting this together!

Re: Edit Bezier Curve

Posted: Tue Apr 27, 2021 7:57 am
by Lukas
Nice 😎
I've bumped into some weird behaviour, but for quickly bending a straight line to a curve this is really userful!

Re: Edit Bezier Curve

Posted: Tue Apr 27, 2021 8:18 am
by hayasidist
Lukas wrote: Tue Apr 27, 2021 7:57 am Nice 😎
I've bumped into some weird behaviour, but for quickly bending a straight line to a curve this is really userful!
if you can somehow post / describe the weirds I'll take a look --- one thing I found was that the "just this handle" zone can both cause and remedy odd "peaky" behaviours in the segment...

Re: Edit Bezier Curve

Posted: Sun May 02, 2021 12:39 pm
by rocken
Experimented with the Script on MH 13.5 (Demo Version)
I don't know if this is caused by the script but after making using of it to reshape the curves, I deleted the shape entirely and when I drew another shape (tested with a circle and a rectangle) with the DRAW SHAPE. the BEZIER handles begin to act weirdly.: not responding when i click on them also the bezier handles support on the TRANSFORM POINTS panel disappears entirely.. However, on returning to the reshape curve script, i can still bend curves with ease. You can see in this gif I uploaded.Image

Re: Edit Bezier Curve

Posted: Sun May 02, 2021 1:42 pm
by hayasidist
Demo Version?! In the (factory) Transform points tool, the bezier handles icons are only displayed in the Pro version... I wonder if demo means no pro features??

from a cold start, do you see the Bezier handle icons?

Re: Edit Bezier Curve

Posted: Sun May 02, 2021 1:52 pm
by rocken
Yes...I see the Bezier Handles from a cold start...

Re: Edit Bezier Curve

Posted: Sun May 02, 2021 4:17 pm
by hayasidist
hmm -- I can't yet reproduce that here -- possibly dumb q: you are using the LM version of Transform Points? -- the only way those icons don't appear is if IsMohoPro() is "false". And LM's Shape?

could you install this simple script -- I ran it from Custom Content / Scripts / Menu / script writing, but anywhere sensible will do.

run before and after the weird behaviours please. I'm half expecting it to say both times that it's 13.5 Pro and "show handles" but ...

Code: Select all

ScriptName = "HS_ReportMoho"
HS_ReportMoho = {}
local thisUUT = "D"

function HS_ReportMoho:Test()
	return true
--	return false
end

function HS_ReportMoho:Name()
	return "Report Moho"
end

function HS_ReportMoho:Version()
	return "version 1.02"
end

function HS_ReportMoho:IsBeginnerScript()
	return false
end

function HS_ReportMoho:Description()
	return "Report basic info about Moho"
end

function HS_ReportMoho:Creator()
	return "Hayasidist"
end

function HS_ReportMoho:UILabel()
	return "Report Moho " .. HS_ReportMoho:Version()
end


function HS_ReportMoho:ColorizeIcon()
	return true
end
function HS_ReportMoho:Run(moho, view)
--	HS_Test_harness:diagnosePrint (thisUUT,  self:Name(), self:Version())

	local i, j, k, n, p, q, s

	local err
	print (self:Name() .. " " .. self:Version())
	if type (MOHO.ScriptInterface.AppVersion) == "function" then

		if MOHO.IsMohoPro() then
			s = "Moho Pro"
		else
			s = "Debut"
		end

		if moho:IsPro() ~= MOHO.IsMohoPro() then
			s = "Unclear if " .. s
		end


		q = "show bezier handles"
		if not LM_TransformPoints.showHandles then
			q = "do not " .. q
		end
		print (s .. " version " .. moho:AppVersion() .. ". Transform Points - " .. q)

		print (LM_TransformPoints:Name() .. " version " .. LM_TransformPoints:Version() .. " by " .. LM_TransformPoints:Creator())
		print (LM_Shape:Name() .. " version " .. LM_Shape:Version() .. " by " .. LM_Shape:Creator())

	else
		print ("unsupported version")
	end


end

[EDIT]: code updated to reflect the mediafire version...

Re: Edit Bezier Curve

Posted: Sun May 02, 2021 4:48 pm
by rocken
Do i copy this into a notepad text ?I am a complete noob to scripting

Re: Edit Bezier Curve

Posted: Sun May 02, 2021 4:59 pm
by hayasidist
ah - ok ... sorry - trying to be efficient and skipping an upload - yes - any text editor will do -- and save it as HS_ReportMoho.lua (make sure you get the extension right - Notepad tries hard to make you call it .txt - even after you call it .lua)

If you're struggling, or just plain put off by the idea I'll upload a version to mediafire.

[EDIT] -- here's a link to a slightly newer version - with a couple of extra "this info might just help" fields... https://www.mediafire.com/file/edtivppq ... o.lua/file

Re: Edit Bezier Curve

Posted: Sun Apr 24, 2022 4:10 pm
by lucasfranca
Too bad it doesn't work on a non-zero frame!

Re: Edit Bezier Curve

Posted: Sun Apr 24, 2022 5:08 pm
by hayasidist
lucasfranca wrote: Sun Apr 24, 2022 4:10 pm Too bad it doesn't work on a non-zero frame!
works fine in the timeline here ... win10 Moho 13.5.x

if you have an example file that you can share, I'll take a look

Re: Edit Bezier Curve

Posted: Thu Apr 28, 2022 3:04 pm
by lucasfranca
hayasidist wrote: Sun Apr 24, 2022 5:08 pm
lucasfranca wrote: Sun Apr 24, 2022 4:10 pm Too bad it doesn't work on a non-zero frame!
works fine in the timeline here ... win10 Moho 13.5.x

if you have an example file that you can share, I'll take a look
The tool does not appear in a non-zero frame. Do I have an old version of it? My version is 1.8.