How do I scale points?

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

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
User avatar
strider2000
Posts: 445
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

How do I scale points?

Post by strider2000 » Sun Apr 23, 2017 8:10 am

Can anyone show me how to scale points? I've tried just about everything I can think of using the API (and not doing the calculations externally and just moving the points). Basically I'm trying to take a scale that's on the layer, remove it from the layer and apply it to the points. (I've got some mouth switch layers that are scaled on the group layer)

I've tried M_Mesh:ScalePoints and LM_Matrix:Scale applied to points on a curve, but just can't seem to get things to work. The calls themselves seem pretty straightforward, so I suspect that there's some setup call or copy call I'm not doing :(

Any help is greatly appreciated. I've spent multiple hours on it, and just can't figure it out :(
My new website (just getting started) | M1 Characters for Moho
hayasidist
Posts: 2179
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: How do I scale points?

Post by hayasidist » Sun Apr 23, 2017 10:37 am

two places you can look:

my bake points script that you have / had viewtopic.php?f=9&t=28275&p=160048 and
my (or the LM_) draw shape script: viewtopic.php?f=12&t=29621

(or you might find that just running "bake" does the job for you?!)
User avatar
strider2000
Posts: 445
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: How do I scale points?

Post by strider2000 » Sun Apr 23, 2017 2:13 pm

Oh Wow! I didn't realize that the Bake Frame script would do that! I had only used it in situations where I had moved points. I had no idea it would take layer transformations and move them to the points! And it does all three at once! I can't believe how much time I've wasted in the past re-manipulating points, when I had copied things from a character of one scale to another :o

Thank you sooooooo much. Your script is even more awesome than I knew. Even though I love my own lipsync script and an eye action clean up script, I think yours has got to go to the top of my list.
My new website (just getting started) | M1 Characters for Moho
User avatar
Barry Baker
Posts: 330
Joined: Fri Aug 27, 2004 6:58 am
Location: UK
Contact:

Re: How do I scale points?

Post by Barry Baker » Tue Jun 27, 2017 8:44 pm

Hayasidist, I really need this script urgently, but the file doesn't seem to be on the mediafire link you posted. I have spent a few days building a 2.5D head at a larger scale to the body (don't ask why!), and it also included many layer transforms instead of moving the points, and now I find I can't combine it with the body any more without horrible distortions happening! It's a mess, it's driving me mad and my only hope is to bake all the transforms into the points somehow. I hope you see this.
hayasidist
Posts: 2179
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: How do I scale points?

Post by hayasidist » Wed Jun 28, 2017 10:09 am

I have no idea why mediafire seems to be blocking the unzipped LUA -- I tried a few things to sort it, but in the end I gave up and just uploaded a zipped version.

there's a new link in the post on AF http://www.kelleytown.com/forum/animato ... hichpage=2 . Please read the notes there before you install and run. Hope it does the job for you.
User avatar
Barry Baker
Posts: 330
Joined: Fri Aug 27, 2004 6:58 am
Location: UK
Contact:

Re: How do I scale points?

Post by Barry Baker » Wed Jun 28, 2017 8:39 pm

Thank you for uploading that script again Hayasidist - no doubt about it, it's saving the day, even if it means I have to bake my animation key by key and then reassemble it manually into duplicate layers. It's still far better than re-creating it from scratch!

Many of the splines need tweaking as well - there seems to be something lost in translation, but otherwise it works like a charm.

Many thanks.
User avatar
Barry Baker
Posts: 330
Joined: Fri Aug 27, 2004 6:58 am
Location: UK
Contact:

Re: How do I scale points?

Post by Barry Baker » Thu Jun 29, 2017 5:40 am

Silly me, I just realised I can copy the curvature keys directly from the original frame and paste them on the new. I don't have to do any tweaking at all!
Post Reply