DKWROOT Scripts ( Lots of Improvements )

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Trizul96
Posts: 25
Joined: Sat May 16, 2020 7:12 pm

Re: DKWROOT Scripts ( Lots of Improvements )

Post by Trizul96 »

dkwroot wrote: Tue Feb 23, 2016 7:02 am

SCRIPTS INFO:
- Set Origin of Multiple Layers in reference to their contents.
- Rotate/Skew Multiple Layers at once
- Toggle stroke/fill of multiple layers at once
- Manipulate Bones based on color
- Mirror Selected Points
- Swap Sides of selected Points
- Line up points on X/Y Axis

DOWNLOAD:
https://drive.google.com/file/d/0Bwzk-f ... jZdOI2ge8w
I cant see the tutorial, the youtube channel is restricted now. I still strugle to understand the function of swap and miroring for this script, can you please open the restriction of the video, so we can understand how to use script properly.
User avatar
SuperSGL
Posts: 364
Joined: Wed Mar 11, 2015 2:55 am
Location: New Hampshire
Contact:

Re: DKWROOT Scripts ( Lots of Improvements )

Post by SuperSGL »

I was having trouble with it as well here is an explanation I got from greenlaw:

"Using them is pretty straightforward:

1. select all the points in that shape you wish to affect. (Typically this would be all of the points. If you don't select any points the tools do nothing.)
2. select the script you wish to apply.
a. if you choose Swap Sides, Moho will replot the points along the right side of the shape to match the left side and replot the points along the left to match the right. The is mainly useful for animating smooth head and body turns. If you need the reverse of this, flip the points first using Flip Horizontal (for points, not layer) and then run the script.
b. if you choose Mirror, Moho will replot the right side of the shape to be symmetrical with the left. If you need the reverse of this, flip the points horizontally first and then run the script.

The axis coordinate it uses is probably just the center of the shape's bounding box. You can't specify this coordinate. It's not a perfect tool but there's nothing else in Moho that does this.

Also

"The tools generally work well for points along the right and left sides but they may ignore a point in the center. Normally I have the center top and center bottom points aligned to the center of the screen anyway so I never paid much attention to that.

In the test I just ran, this ignored point was the point at the bottom center, which for me would normally be at the base of a head shape.

From what I recall, I sometimes had to nudge a few things when using Swap to get an exact reflection, but this was still much easier and more accurate than flipping a baked layer to trace from and then pushing all the points around manually.

It really shouldn't matter if the bezier handles are visible or not; at least it doesn't matter here. I think it may matter if the the Bezier Lock option is enabled since this may prevent the tools from properly reshaping the paths. I normally have all the Bezier options disabled unless I really need to use them; otherwise, it just gets in the way. (As a general rule, I avoid using Bezier mode for shapes that will be deformed using Bones...but that's probably a matter of workflow preferences. I know Victor will use them but he also applies a keyframing technique to make them deform more predictably. For me, I avoid it because regular Moho points are just more predictable.)"
"Animation is not the art of drawings that move but the art of movements that are drawn."
Norman McLaren


My Animations
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Mirror Points and Swap Sides Tutorial #1

Post by Greenlaw »

There are errors in my earlier explanation of these tools (sorry about that SuperSGL) and the following info should clear up a bunch of things. I've used these tools many times but never really thought much about how they worked since, for me anyway, they just did.

Anyway, after playing around a bit last night here's some stuff I learned about these tools and a quick demonstration of how to use them.

First install the menu scripts as described earlier...
Image

...then download this project file...

mirrorSwapMiniDemo.moho

Open the file and you should see this...

Image

This is an asymmetrical shape that's humanoid on the left side and feline on the right. There are the same number of points on either side of the shape.

First let's learn the Mirror Points tool. Select the top center point as shown above and then select the Mirror Points menu script. The result should be this...

Image

Undo this so we get back to the original shape. Now select the bottom point and run Mirror Points. The result should look like this...

Image

Some more info about Mirror Points:

1. As described in the beginning, the ideal shape should have the same number of points on either side.

2. Even though Mirror Points is supposed to work with Bezier points, it's not recommended. Chances are good that you will get some errors if you use Bezier points. (More on this in a future post.) If you must use Bezier points, you might want to wait until after running this script and then make those adjustments.

3. I think the direction of the mirroring depends on the direction in which the shape was drawn and which point you choose as you axis. I'm not completely sure of the rules so TBD.

Now, how to use Swap Sides. Undo the 'cat head' so we're back to the original 'human-cat' shape.

Select the top center or bottom center point (it doesn't matter which) and choose Swap Sides. The result is this...

Image

It may appear that Moho has merely flipped the drawing but this is NOT what just happened. What actually happened is that Moho moved around the points on the left side to look like the right side of the head, and moved the points on the right side to look like the left side. This is why you need the same number of points on both sides of the shape.

So why would you ever need to do this? Well imagine the drawing is a left side head profile and you want it to animate smoothly into a drawing of a right side head profile. If you flip the shape, the points will simply cross over in during animation and make a big mess in the middle. But when the points are moved around like when using this tool, the shape will transition smoothly and predictably, without crossing over.

Anyhoo, that's the concept behind these tools in a nutshell. There's more to using them in a real-world rigging situation so I've prepared a second tutorial that goes into greater detail. I'll post tutorial #2 tonight.
Last edited by Greenlaw on Tue Jun 14, 2022 11:31 pm, edited 9 times in total.
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: DKWROOT Scripts ( Lots of Improvements )

Post by Greenlaw »

Oh, I forgot to mention something:

The Mirror Points tool seems work best when the top and bottom center points align with the layer's center. If they are offset, the results can be unpredictable (especially when using Bezier points.)

This actually happens in tutorial #2 and I'll cover how to fix the error.
User avatar
SuperSGL
Posts: 364
Joined: Wed Mar 11, 2015 2:55 am
Location: New Hampshire
Contact:

Re: DKWROOT Scripts ( Lots of Improvements )

Post by SuperSGL »

Your link points to a jpg file not the moho but that's ok I created a test image as you described at the beginning. I was selecting the whole right side of points or left side now that I'm selecting just one point I get the correct results. Thank you for the explanation really appreciate it!
"Animation is not the art of drawings that move but the art of movements that are drawn."
Norman McLaren


My Animations
User avatar
Trizul96
Posts: 25
Joined: Sat May 16, 2020 7:12 pm

Re: Mirror Points and Swap Sides Tutorial #1

Post by Trizul96 »

Greenlaw wrote: Mon Jun 13, 2022 4:55 pm There are errors in how I explained these tools work earlier (sorry for that) and the following info should clear up some of that. I've used these tools many times but never really thought much about how they worked since, for me anyway, they just did.

Anyway, after playing around a bit last night here's some stuff I learned about these tools and a quick demonstration of how to use them.

First install the menu scripts as described earlier...

Image

...then download this project file...

mirrorSwapMiniDemo.moho

Open the file and you should see this...

Image

This is an asymmetrical shape that's humanoid on the left side and feline on the right. There are the same number of points on either side of the shape.

First let's learn the Mirror Points tool. Select the top center point as shown above and then select the Mirror Points menu script. The result should be this...

Image

Undo this so we get back to the original shape. Now select the bottom point and run Mirror Points. The result should look like this...

Image

Some more info about Mirror Points:

1. As described in the beginning, the ideal shape should have the same number of points on either side.

2. Even though Mirror Points is supposed to work with Bezier points, it's not recommended. Chances are good that you will get some errors if you use Bezier points. (More on this in a future post.) If you must use Bezier points, you might want to wait until after running this scripts and then make those adjustments.

3. I think the direction of the mirroring depends on the direction in which the shape was drawn and which point you choose as you axis. I'm not completely sure of the rules so TBD.

Now, how to use Swap Sides. Undo the 'cat head' so we're back to the original 'human-cat' shape.

Select the top center or bottom center point (it doesn't matter which) and choose Swap Sides. The result is this...

Image

It may appear that Moho has merely flipped the drawing but this is NOT what just happened. What actually happened is that Moho moved around the points on the left side to look like the right side of the head, and moved the points on the right side to look like this left side. This is why you need the same number of points on both sides of the shape.

So why would you ever need to do this? Well imagine the drawing is a left side head profile and you want it to animate smoothly into a drawing of a right side head profile. If you flip the shape, the points will simply cross over in during animation and make a big mess in the middle. But when the points are moved around like when using this tool, the shape will transition smoothly and predictably, without crossing over.

Anyhoo, that's the concept behind these tools in a nutshell. There's more to using them in a real-world rigging situation so I've prepared a second tutorial that goes into greater detail. I'll post tutorial #2 tonight.
Thank you so much, I got better knowledge how to using this tool properly, your explanation is awesome, I follow through your instruction and it's work great. https://drive.google.com/file/d/1sdb8FY ... sp=sharing, Image. I dont know how to upload the screenshoot image to this comment section of this website cuz it's always fail, but here it is.
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: DKWROOT Scripts ( Lots of Improvements )

Post by Greenlaw »

SuperSGL wrote: Tue Jun 14, 2022 1:40 am Your link points to a jpg file not the moho...
D'oh! Sorry about that. The download link in the original post has been fixed, and here it is again...

mirrorSwapMiniDemo.moho

Also, sorry I didn't post Tutorial #2 last night. After work, then grocery shopping and cooking dinner for the fam, I was beat. Sigh...life! :)

Maybe tonight.
prutskneus
Posts: 1
Joined: Thu Jun 30, 2022 1:27 pm

Re: DKWROOT Scripts ( Lots of Improvements )

Post by prutskneus »

dkwroot wrote: Sun Jan 15, 2017 10:56 am
Greenlaw wrote:...
I updated the mirror and swap points scripts. They're menu scripts now and they can handle both bezier handles and strokes.

DOWNLOAD: https://drive.google.com/open?id=0Bwzk- ... mNCX1pvME0
This link does not seem to work anymore, or at least the files are not accessible. I also asked permission on Google Drive, without response. Are these tools still available to download somewhere? They sound like exactly the thing Moho is currently missing 🥹
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: DKWROOT Scripts ( Lots of Improvements )

Post by Greenlaw »

Here are links to the latest versions I have of the DKWROOT Scripts and the Menu version of Mirror/Swap Points scripts. To be clear, these files were created by dkwroot and, with his permission, I'm just reposting them because the original links no longer work...

DKWROOT Scripts
Download: DKWROOT Scripts 1.zip


SCRIPTS INFO:
- Set Origin of Multiple Layers in reference to their contents.
- Rotate/Skew Multiple Layers at once
- Toggle stroke/fill of multiple layers at once
- Manipulate Bones based on color
- Mirror Selected Points
- Swap Sides of selected Points
- Line up points on X/Y Axis

Mirror and Swap Points - Menu Script Version
Download: dr_MirrorAndSwapPointsMenuVers.zip


See earlier posts for instructions and more information about these scripts.

Sadly, I do not have the original videos to repost.
Leks Luci
Posts: 3
Joined: Sat Nov 04, 2023 9:24 pm

Re: DKWROOT Scripts ( Lots of Improvements )

Post by Leks Luci »

Hello. Here is the revised version of 'lm_select_points.lua' script file from DKWROOT_TOOLS that is compatible with Moho 14. I hope you don't mind me doing that.

Just the script itself
https://www.mediafire.com/file/y1gp89ui ... s.lua/file

And the "DKWROOT_TOOLS" repack, that only contains 'lm_select_points.lua' script file and its respective dependencies, with the correct folder structure, that is relative to your Custom Content Folder.
https://www.mediafire.com/file/4etz743v ... S.zip/file

Kind regards.
Leks
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: DKWROOT Scripts ( Lots of Improvements )

Post by Greenlaw »

Cool! Thanks for the update Leks!
martin_mrt
Posts: 6
Joined: Mon Mar 25, 2024 3:09 pm

Re: DKWROOT Scripts ( Lots of Improvements )

Post by martin_mrt »

Hi Guys!
The before mentioned script sounds very helpful for turns. All the links are dead though. Is there a new place to download or was a feature added which does that?!?
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: DKWROOT Scripts ( Lots of Improvements )

Post by Greenlaw »

The links I posted above for the scripts are active. Clicking either of them should launch your browser's download window.

I checked Leks Luci's links, and they lead to a download page. The links on the page still work.
Post Reply