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

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

Re: MR Curve Tool 3.0 BETA

Post by KuzKuz »

Thank you for your reply, I'll be looking forward to your animated short film.
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: MR Curve Tool 3.0 BETA

Post by SimplSam »

Point selection mode: For me everything appears to be working great with all before and the new feature.

Mac crazy edit problem: I hadn't even tried it on Mac before the issue was re-raised by Hoptoad the other day, but after some digging - it looks like the issue is related to a couple of g:ApplyMatrix(matrix) statements (around lines 1453 and 1599 on my version) which are not protected by g:Push() / g:Pop() and endup influencing the drawingStartVec values. Why it doesn't break the Windows version - is a mystery.

Fixing functionality for Points controlled by Smart Bones: Do you mean allowing it to work in Action editing? I guess that could be useful, especially if we get used to using this for 'normal' point editing. But equally not high-priority for me.
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: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 3.0 BETA

Post by KuzKuz »

Thank you for your help! I added g:Push() and g:Pop(), but it needs someone with a Mac to check it.

Regarding points controlled by Smart Bones, I meant the undesired jumps in point positions and Bezier handles due to the mismatch between the actual on-screen position and the values in the keyframes.

Example in the video:



You can already use this tool in transform mode while being inside an action.

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

Re: MR Curve Tool 3.0 BETA

Post by SimplSam »

KuzKuz wrote: Mon Apr 03, 2023 12:13 pm Thank you for your help! I added g:Push() and g:Pop(), but it needs someone with a Mac to check it.
...
The fix appears to address the crazy edit problem on Mac.

However - it also negates the applied Matrix on g before it is used in the mouseDist CurrentScale calc.

Code: Select all

g:ApplyMatrix(matrix)
g:Pop()
local mouseDist = self:GetDistance(mouseEvent.drawingStartVec, mouseEvent.drawingVec)
mouseDist = mouseDist * g:CurrentScale(false)
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: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 3.0 BETA

Post by KuzKuz »

Thanks! I hope this is correct.

Code: Select all

local g = mouseEvent.view:Graphics()
g:Push()
local matrix = LM.Matrix:new_local()
moho.drawingLayer:GetFullTransform(moho.frame, matrix, moho.document)
g:ApplyMatrix(matrix)
local currentScale = g:CurrentScale(false)
g:Pop()
local mouseDist = self:GetDistance(mouseEvent.drawingStartVec, mouseEvent.drawingVec)
mouseDist = mouseDist * currentScale
Download: https://drive.google.com/file/d/1Jafrrl ... sp=sharing
User avatar
Hoptoad
Posts: 619
Joined: Sun Jan 03, 2016 4:19 pm
Location: Florida

Re: MR Curve Tool 3.0 BETA

Post by Hoptoad »

SimplSam wrote: Mon Apr 03, 2023 9:50 am Mac crazy edit problem: I hadn't even tried it on Mac before the issue was re-raised by Hoptoad the other day, but after some digging - it looks like the issue is related to a couple of g:ApplyMatrix(matrix) statements (around lines 1453 and 1599 on my version) which are not protected by g:Push() / g:Pop() and endup influencing the drawingStartVec values. Why it doesn't break the Windows version - is a mystery.
KuzKuz wrote: Mon Apr 03, 2023 12:13 pm Thank you for your help! I added g:Push() and g:Pop(), but it needs someone with a Mac to check it.
The script is working on my Mac computer now.

Thank you SimplSam for locating the problem and KuzKuz for quickly updating the script.

This script will save me time, as I can use less points while drawing shapes. When using the core drawing tools, I would often add a lot of extra points to a shape rather than switch to the curvature tool, so many of my shapes had a LOT of points. With this script, I use far less points.

Thanks for making this useful script KuzKuz.
User avatar
KuzKuz
Posts: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 3.0 BETA

Post by KuzKuz »

Great news, thank you for the feedback!
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Curve Tool 3.0 BETA

Post by Greenlaw »

KuzKuz wrote: Mon Apr 03, 2023 12:13 pm Regarding points controlled by Smart Bones, I meant the undesired jumps in point positions and Bezier handles due to the mismatch between the actual on-screen position and the values in the keyframes.
Ah, I see! This hasn't been a problem for me because I simply avoid using Bezier points in these situations. When I know this is going to happen, I make sure to use only regular Moho points and everything is fine.

So, while it would be nice to have this capability, it isn't currently a big priority me either.

I'm curious though: I would have assumed a fix for this needed to occur within Moho's core Smart Bones technology. Can a drawing/point-editing tool really solve this? (Not that I know anything about how any of this actually works.) :D
User avatar
KuzKuz
Posts: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 3.0 BETA

Post by KuzKuz »

Thanks!
Greenlaw wrote: Mon Apr 03, 2023 3:31 pm I'm curious though: I would have assumed a fix for this needed to occur within Moho's core Smart Bones technology. Can a drawing/point-editing tool really solve this? (Not that I know anything about how any of this actually works.) :D
Yes, it would be great to have special API methods to facilitate the calculation of the impact of Smart Bones on points and Bezier curves. However, it is possible to do this with what is available, although it is much more complicated.
User avatar
KuzKuz
Posts: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 3.0 BETA

Post by KuzKuz »

It seems that version 3.0 is ready.

Please share your experience by this Friday, whether everything is working as it should.
If no issues are found, I will publish the final version of the script on mohoscripts. Thank you all for your help.
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Curve Tool 3.0 BETA

Post by Greenlaw »

Congratulations Eugene!

MR Curve Tool is an exciting new way to draw with Moho...thank you so much for creating and sharing it!
Last edited by Greenlaw on Mon Apr 03, 2023 11:19 pm, edited 1 time in total.
User avatar
KuzKuz
Posts: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 3.0 BETA

Post by KuzKuz »

Thank you for your help and feedback. Without you, this tool would have been much more primitive.
User avatar
Hoptoad
Posts: 619
Joined: Sun Jan 03, 2016 4:19 pm
Location: Florida

Re: MR Curve Tool 3.0 RC1

Post by Hoptoad »

I've over-written this script a couple times after you updated it, and now I have 2 tool icons for "Curve Tool 3.0 Beta" in the tool window. I don't know how I did that.

One icon is the proper icon showing three points and a curve, and the other icon is the "X" with a question mark on it. I checked the Tool folder, and I only have one installation of "mr_curve_tool.lua".

Do you know how I can get rid of the "X" with a question mark icon? Both buttons work, but I only need one.
User avatar
KuzKuz
Posts: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Curve Tool 3.0 RC1

Post by KuzKuz »

Hoptoad wrote: Tue Apr 04, 2023 12:54 am I've over-written this script a couple times after you updated it, and now I have 2 tool icons for "Curve Tool 3.0 Beta" in the tool window. I don't know how I did that.

One icon is the proper icon showing three points and a curve, and the other icon is the "X" with a question mark on it. I checked the Tool folder, and I only have one installation of "mr_curve_tool.lua".

Do you know how I can get rid of the "X" with a question mark icon? Both buttons work, but I only need one.
Try using the search function and check if the mr_curve_tool.lua file is duplicated in the ContentFolder\Moho Pro\Scripts directory.
If possible, attach screenshots of the internal folders of this directory.
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Curve Tool 3.0 RC1

Post by Greenlaw »

I would double check that you don't have the script installed twice, maybe under slightly different names.

To check this...

1. go to File > Open Custom Content Folder.
2. open the Scripts > Tool folder.
3. look for the script in here and make sure there is only one copy.

If there is only one copy, maybe there is a second one in the Moho program folder? If so, you should remove that one. You probably know this already but it's not recommended to install custom scripts to the program folder.

If you still have a problem with this, look in the Tools folder again and open the file called _tools_list.txt. This is the settings file for how the tools are organized in the Tools window. Scroll down to the bottom and see if MR Curve is listed twice. If it is, delete one of the entries.

Now if that doesn't fix things, I'm stumped.

Hope this helps.
Post Reply