Rotate Points tool with a changeable center of rotation

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Rotate Points tool with a changeable center of rotation

Post by 7feet »

Hey folks.

So I, among others, wanted to be able to change the origin for rotating points, so here it is. If you want to move the center, press the <alt> key and move the center moves with the cursor. Everything is the same. Took me far too long to figure it out, I started out far too complicated (as usual) and having to guess at how the API works is a pain, but it seems to work fine. Just replace the original (renaming the original first for a backup) in the Moho\scripts\tool folder.

Also, LM, I don't know if you have any policy on submissions, but I think this is a handy mod and if you wanted to throw it in the Moho release, feel free. If you wanted to I'd be happy to send you any kinda waiver needed.

--Brian
Postality
Posts: 248
Joined: Sat Aug 07, 2004 3:21 am
Location: Toronto, Ontario
Contact:

Post by Postality »

Thanx 7feet, I thought you had forget about me, haha
Anime Studio - Ultimate Game Graphics
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Nope, hadn't forgotten, just had to wait for a break in the 16 hour days at work. Don't know when I'll have a chance to write anything else. I had the strange thought to try and write something that would take motion capture files and convert them into bone rotations and scaling. Dunno, maybe I'll just do something actually useful.

--Brian
myles
Posts: 821
Joined: Sat Aug 21, 2004 3:32 am
Location: Australia, Victoria, Morwell
Contact:

Re: Rotate Points tool with a changeable center of rotation

Post by myles »

7feet wrote:So I, among others, wanted to be able to change the origin for rotating points, so here it is.
Nifty! Thanks, Brian, this is a useful modification, particularly for drawing.

Heh :) - when testing it out I re-discovered why bones are such a great idea for 2D animation - I rotated the points on a keyframe, but of course the actual direct point movement from one keyframe to the next is linear - so I got a chuckle out of the result and my assumptions.

Regards, Myles.
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Hmmm. Hadn't thought of that part, there, Myles. I wouldn't want to muck up a basic tool that much, but as I get a better handle on the math of the rotations (most of my high school geometry has vaporized over the years), I mighgt as well make a whole 'nother tool. Maybe have it add keyframes over a specified period to describe the arc. I was thinking of it more for drawing.

However, that gave me an idea. Perhaps alternate to the Layer Rotation tool to allow you to change the "apparent" origin within the tool would be a good thing. Since the layer origin isn't keyframable (and i would think that could cause some unexpected mayhem itself), this would also have to create keyframes for layer rotation and translation, but for the Flash folks it would at least keep the layer optimized. You create a lot of keyframes, but you could also incorporate some control of the ease in and out and such on the move.

Don't really want to make the basics too bulky, but theres no harm in sets of specialized tools you can patch in when you need them.

--Brian
User avatar
Rai López
Posts: 2242
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

Before nothing I must say that this script modification is the most usefull thing that I've seen! (THANKS again 7feet) and now add that it'll be usefull can modificate the center of rotation in all point modification tools... Well, I have a question about changeable center of rotation: there is a way to reset the center of rotation to his original position then of that I modificate it with ALT key? I don't Know if this is possible and actualy I close the program and re-open to reset the modificate center of rotation... Is this the one option? THANKS in advance!
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Easy enough to throw in a Reset, the tool normally just figures a center automatically. I'll do it as soon as I have the chance.

--Brian
User avatar
Rai López
Posts: 2242
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

WOW!! I´ll be waiting just here... THANK YOU VERY MUCH!! :D
hard as snails
Posts: 28
Joined: Sun Nov 27, 2005 8:58 pm
Location: uk
Contact:

Post by hard as snails »

erm hi!!!! how do i get that script into my moho????have downloaded it but then can't open it....i'm probably being stupid! happy new year from the u.k.
hilarity begins at home...
User avatar
Rai López
Posts: 2242
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

Copy it into this directory: "C:\Archivos de programa\Moho\scripts\tool" for me, or more probably for you: "C:\Program Files\Moho\scripts\tool" (you can make a Backup of your original file before overwrite it if you want), then open, RE-open or Press Ctrl+F5 for refresh the program and you'll can use it :) ...ENJOY of this SUPER USEFUL script!
User avatar
Rai López
Posts: 2242
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Re: Rotate Points tool with a changeable center of rotation

Post by Rai López »

Jaja, just now I've read this, ermmm...
7feet wrote:Just replace the original (renaming the original first for a backup) in the Moho\scripts\tool folder.
hard as snails
Posts: 28
Joined: Sun Nov 27, 2005 8:58 pm
Location: uk
Contact:

Post by hard as snails »

cheers got it!
hilarity begins at home...
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post by bupaje »

Hey 7feet thanks! Seems useful and will try it tonight.

EDIT: Tested it out - it is great. Thanks!
[url=http://burtabreu.animationblogspot.com:2gityfdw]My AnimationBlogSpot[/url:2gityfdw]
macton
Posts: 93
Joined: Thu Aug 18, 2005 6:29 am
Location: San Diego

Post by macton »

7feet wrote:However, that gave me an idea. Perhaps alternate to the Layer Rotation tool to allow you to change the "apparent" origin within the tool would be a good thing. Since the layer origin isn't keyframable (and i would think that could cause some unexpected mayhem itself), this would also have to create keyframes for layer rotation and translation, but for the Flash folks it would at least keep the layer optimized. You create a lot of keyframes, but you could also incorporate some control of the ease in and out and such on the move.
I'm not sure that you can do what I think you're describing, which is:
1. Subtract pivot point from layer translation
2. Rotate layer
3. Add pivot point to layer translation

Since Moho only supports one translation per frame (if it supported both a pre and post translation, we wouldn't really need an origin) this method would need two frames to carry out.

However, the other option is to rotate the points on the layer based on a selected pivot point. It's not optimized for Flash, but it will work fine (Although as noted above, the interpolation will be different)

I whipped up a script that does that - look under Extras here:
http://www.lostmarble.com/forum/viewtop ... highlight=
hard as snails
Posts: 28
Joined: Sun Nov 27, 2005 8:58 pm
Location: uk
Contact:

moving rotation point

Post by hard as snails »

hi,i'm trying to swing a door open using the perspective points h tool it works fine but the door swings open on an axis that runs down the middle not where it meets the door frame(where the hinges would be),i need to move the rotation point to the left....i have tried using the alt key.any ideas????
hilarity begins at home...
Post Reply