MR Curve Tool 4.1

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Greenlaw
Posts: 9352
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Curve Tool

Post by Greenlaw »

mohgirl wrote: Fri Mar 17, 2023 8:30 am An error occurred during the previous installation in the software default location. Later, it was installed in the created content folder and there was no problem
Yay! Glad you got that solved.

Yes, shouldn't add or replace scripts in Moho's program location; you really don't want to alter Moho's original code.

Custom scripts like MR Curve Tool should always go in their appropriate location in your Custom Content Folder.
User avatar
KuzKuz
Posts: 501
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool

Post by KuzKuz »

Bug fixes. Also, now to move a selected point, you need to click on it or near it.
If you click far from the point, the selection will automatically be removed, and you will start creating a new curve.
This is done because if you click far from the selected point, you most likely forgot that it is selected, and will start moving it instead of creating a new curve.
Also, this will allow keeping the selection after you've moved the point.

Download link: https://drive.google.com/file/d/1Jafrrl ... sp=sharing
User avatar
Greenlaw
Posts: 9352
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Curve Tool

Post by Greenlaw »

Ha ha...everytime I'm about to write a post with comments, I find a new release!

Thanks Eugene. Downloading and testing now. 😸
User avatar
KuzKuz
Posts: 501
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool

Post by KuzKuz »

In this version, an important bug has been fixed.
Please provide feedback by this Saturday.
If there are no more problems with the tool, I would like to update it on mohoscripts this Saturday.

Download: https://drive.google.com/file/d/1Jafrrl ... sp=sharing
User avatar
Greenlaw
Posts: 9352
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Curve Tool 2.4 BETA

Post by Greenlaw »

Thanks Eugene! I've been using recent update this past weekend and almost everything is working well.

One thing I ran into, and I'm not sure this is really an issue, is when I disable Show Bezier Handles, Fixed Bezier Handles can still be active. In the native Add Points, wen I disable Show Beizer Handles, Fixed Bezier Handles automatically becomes inactive. This allows me to work with only regular Moho points. However, when using MR Curve and I want to work with only regular Moho points, I need to be sure both options are disabled. Probably not a problem, but something the user needs to be aware of.

I also ran into some issues when trying to edit multiple points at once, like trying the Curvature control with multiple points. Probably not a problem unless the user is trying to edit multiple points at once. I'm still documenting that stuff...I'll post more info this evening.

I downloaded the latest. Will install and test this tonight.
User avatar
SimplSam
Posts: 1058
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: MR Curve Tool 2.4 BETA

Post by SimplSam »

Excellent tool. Just one (or 2) things that I mentioned previously.

Esc key

I would like the ability to end the curve at the last point added to the curve.

It might just be me, but I tend to find that I draw something (open curve), and then have the dangling extension (between that point and the mouse cursor) that I don't want.

With tools like PS & Affinity they don't show the dangling bit at all, Illustrator & Inkscape do. But none of them end the drawing of the curve at the mouse cursor (unless double click, or mouse at same position as last point), but rather at the last point. Illustrator behaves most as expected with the Esc key, which ends at the last added point - keeping any curvature caused by the current mouse position.

Image

Sharp Corners toggle

Whilst I am here ... I know it is a Curve tool. But I would still probably like the option to force straight lines, without using the CTRL key. i.e. By using a Sharp/Curve toggle.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
KuzKuz
Posts: 501
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 2.4 BETA

Post by KuzKuz »

SimplSam wrote: Tue Mar 21, 2023 9:24 am Excellent tool. Just one (or 2) things that I mentioned previously.

Esc key

I would like the ability to end the curve at the last point added to the curve.

It might just be me, but I tend to find that I draw something (open curve), and then have the dangling extension (between that point and the mouse cursor) that I don't want.

With tools like PS & Affinity they don't show the dangling bit at all, Illustrator & Inkscape do. But none of them end the drawing of the curve at the mouse cursor (unless double click, or mouse at same position as last point), but rather at the last point. Illustrator behaves most as expected with the Esc key, which ends at the last added point - keeping any curvature caused by the current mouse position.

Image

Sharp Corners toggle

Whilst I am here ... I know it is a Curve tool. But I would still probably like the option to force straight lines, without using the CTRL key. i.e. By using a Sharp/Curve toggle.

Thank you for the feedback!

Esc key

I tried to add ESC tracking to the tool, but unfortunately, it didn't work out. For some reason, it doesn't work and I couldn't figure out why.
However, I can try to add a Ctrl+Enter shortcut to end the curve at the last added point and remove the point that follows the cursor.
Currently, the Enter key ends the curve at the current existing point.

Sharp Corners toggle

Yes, I can add this option, but how should it work?
Like an inversion of the CTRL key, when it's not pressed, it creates a sharp corner, and when pressed, it creates a regular point from which you can activate Bezier handles?
Or if this option is enabled, the use of Bezier handles is completely blocked and you can only place points with sharp corners?
User avatar
SimplSam
Posts: 1058
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: MR Curve Tool 2.4 BETA

Post by SimplSam »

Gooovy. Thanks for looking into this.

I have previously used the following to detect the Esc key:

Code: Select all

(keyEvent.keyCode == LM.GUI.KEY_ESCAPE) or (keyEvent.keyCode == 27) 
With Sharp/Curve - I would expect CTRL to behave oppositely (i.e. temporarily toggle whichever state it is in to the other), and when in Sharp mode - long-press the mouse butt to activate Bezier handle mode for that point.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
KuzKuz
Posts: 501
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 2.4 BETA

Post by KuzKuz »

SimplSam wrote: Tue Mar 21, 2023 1:24 pm

Code: Select all

(keyEvent.keyCode == LM.GUI.KEY_ESCAPE) or (keyEvent.keyCode == 27) 
Thank you for the code, yes, I tried it, but it always returns false for me. Do you know what this might be related to?

As for the Sharp corners mode, would it be okay if, in this mode, Bezier handles can only be activated by holding down Ctrl and the left mouse button and dragging the cursor away from the point?
This way, less code will need to be modified.
User avatar
SimplSam
Posts: 1058
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: MR Curve Tool 2.4 BETA

Post by SimplSam »

KuzKuz wrote: Tue Mar 21, 2023 2:48 pm Thank you for the code, yes, I tried it, but it always returns false for me. Do you know what this might be related to?

As for the Sharp corners mode, would it be okay if, in this mode, Bezier handles can only be activated by holding down Ctrl and the left mouse button and dragging the cursor away from the point?
This way, less code will need to be modified.
I put a print("KC: ", keyEvent.keyCode) down in an Else block at the end of the OnKeyDown function, and for me it prints: KC: 27 - when I press the Esc key. It may be possible that that key press is consumed by something else on your system, or it's a different value?

And yes to the CTRL left-click drag is OK.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
KuzKuz
Posts: 501
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 2.4 BETA

Post by KuzKuz »

SimplSam wrote: Tue Mar 21, 2023 3:12 pm
KuzKuz wrote: Tue Mar 21, 2023 2:48 pm Thank you for the code, yes, I tried it, but it always returns false for me. Do you know what this might be related to?

As for the Sharp corners mode, would it be okay if, in this mode, Bezier handles can only be activated by holding down Ctrl and the left mouse button and dragging the cursor away from the point?
This way, less code will need to be modified.
I put a print("KC: ", keyEvent.keyCode) down in an Else block at the end of the OnKeyDown function, and for me it prints: KC: 27 - when I press the Esc key. It may be possible that that key press is consumed by something else on your system, or it's a different value?

And yes to the CTRL left-click drag is OK.
I apologize, yes, keyEvent.keyCode == 27 works! Thank you! I will add the function to end the curve on ESC.
User avatar
Greenlaw
Posts: 9352
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Curve Tool 2.4 BETA

Post by Greenlaw »

I forgot to mentions that Ctrl-Z seems to end a curve. I'm guessing that's not an official way but I sometimes use that.

Backspace also work but only after I've created 3 points.

And Double click works too of course but I have to know that I'm ending the line there before I click, and I don't always think that far ahead. :D
User avatar
KuzKuz
Posts: 501
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 2.4 BETA

Post by KuzKuz »

1. Added the ability to end the curve by pressing the ESC key, stopping at the last point you created with a click.
2. Added a Sharp corners option that inverts the Ctrl key press.

Please test these new features and let me know if everything works as expected.

Download: https://drive.google.com/file/d/1Jafrrl ... sp=sharing
User avatar
SimplSam
Posts: 1058
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: MR Curve Tool 2.4 BETA

Post by SimplSam »

Excellent! Works perfectly.

One other thing (not super important). Probably because I am messing around so much - I do Ctrl-A (Select all) or tab-key (Select connected) - and then hit Delete key, but nothing happens. On the built-in Add Points tool, that would delete all the selected points.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
KuzKuz
Posts: 501
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 2.4 BETA

Post by KuzKuz »

SimplSam wrote: Tue Mar 21, 2023 6:47 pm Excellent! Works perfectly.

One other thing (not super important). Probably because I am messing around so much - I do Ctrl-A (Select all) or tab-key (Select connected) - and then hit Delete key, but nothing happens. On the built-in Add Points tool, that would delete all the selected points.
This is strange, as I added the ability to delete selected points using the Del key.
Unfortunately, I cannot reproduce this. Is there any additional information?
Can anyone else confirm that they are unable to delete points?
Post Reply