Grids and Sine wave drawing tools

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Grids and Sine wave drawing tools

Post by hayasidist »

Ok people ... be gentle with me - this is my first serious attempt at scripting for AS. For sure there are many other ways to do what this toolset does, so if no-one wants it --- well, as Thumper would say "if you can't say something nice don't say nothing at all..."

The file is at http://www.mediafire.com/?x5wsnah3wg3tc5e. It's a zip with a Readme, the LUA and the icons. It has been tested only on ASP7.

This set of tools is based on the SHAPE tools that come with Anime Studio.
The three key things are: Multipoint straight line; Grid; Sine wave (the other three were more of a practice run than anything else).

constructive criticism / ideas for improvement and enhancement etc always welcome.
ponysmasher
Posts: 370
Joined: Thu Aug 05, 2004 2:23 am
Location: Los Angeles
Contact:

Post by ponysmasher »

I haven't tested your script yet (browsing on my phone during vacation), but I think it's great that you've started writing scripts. The more people writing scripts, the better.

And it's a great feeling when you need Anime Studio to do something and you can write a script that does it.
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

It's always fantastic to have a new scripter in the club :)
Thanks for sharing your first one, Hayasidist. I tested it on version 8 and works perfectly.
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 11:31 am
Location: New Zealand

Post by funksmaname »

cool man, will give it a try - i was just trying to make a grid the other day to test something and it presented itself as a missing option :) Also, making sine waves might be useful one day!
jonbo
Posts: 896
Joined: Thu Apr 08, 2010 2:53 am

Post by jonbo »

Excellent. This could be very useful to me. Thanks :)
User avatar
uddhava
Posts: 315
Joined: Tue Nov 04, 2008 7:24 pm
Location: American back in Hungary

Post by uddhava »

Thanks, hayasidist,

Interesting....nice shapes. They could be useful. They remind me of some
Adobe Illustrator plugins I've seen.

I wish I had some skill at scripting. I feel it would be a little too much for me to start. I joked with my step son that he should learn to write scripts for ASP, but when he said he could try, I felt I might be exploiting him.

....Any way keep up the good work.

udd
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Post by hayasidist »

Hi All,

thanks for your encouraging and positive replies.


WIP on this set is going in this direction:

number of points is configurable (menu bar entry option)

- "round edged" square is being ditched and replaced by circle segment (quadrant / semi circ or anything less than a full 360 circle) (if you want a round edged square then use the drawing tool then curvature .. :wink: )

- 4-point oval is being replaced by multipoint ellipse

- grid -- number of rows / columns configurable
- line -- number of points config
- star -- number of "spikes" config
- sine -- number of points in the curve config

My main current (soon to be resolved?!? :? ) problem is with point curvature on the ellipse (odd things happen where x or y dimension gets very small wrt the other) - so if you're not straining at the leash for the update, please hang on for a few days when I hope to get the issues fixed and the files into a release pack.

==
looking to the subsequent updates:

A question for the scripters ...

there's the set of functions mouseEvent. alt/shift/ctrl Key. is there a similar function to capture such as Arrow-up / arrow down key strokes at the same time as mouse is dragging. And/or mouse right click / thumbwheel??? I've been browsing the documentation that I've found in this part of the forum, but no luck finding anything useful so far...
User avatar
uddhava
Posts: 315
Joined: Tue Nov 04, 2008 7:24 pm
Location: American back in Hungary

Post by uddhava »

Sounds great! Good luck.
ponysmasher
Posts: 370
Joined: Thu Aug 05, 2004 2:23 am
Location: Los Angeles
Contact:

Post by ponysmasher »

hayasidist wrote: A question for the scripters ...

there's the set of functions mouseEvent. alt/shift/ctrl Key. is there a similar function to capture such as Arrow-up / arrow down key strokes at the same time as mouse is dragging. And/or mouse right click / thumbwheel??? I've been browsing the documentation that I've found in this part of the forum, but no luck finding anything useful so far...
Right mouse and scroll wheel, no. They're always used by AS. But keys you can. The K key would be used like this:

Code: Select all

if (keyEvent.key == 'k') then
Some keys you have to use the built in keycode constants for, like the up key:

Code: Select all

if (keyEvent.keyCode == LM.GUI.KEY_UP) then
The other constants are:

KEY_RETURN - The Return or Enter key
KEY_ESCAPE - The Escape key
KEY_TAB - The Tab key
KEY_BACKSPACE - The Backspace key
KEY_DELETE - The Delete key
KEY_HOME - The Home key
KEY_END - The End key
KEY_PAGEUP - The Page Up key
KEY_PAGEDOWN - The Page Down key
KEY_LEFT - The left arrow key
KEY_UP - The up arrow key
KEY_RIGHT - The right arrow key
KEY_DOWN - The down arrow key
KEY_F1 - The F1 key
KEY_F2 - The F2 key
KEY_F3 - The F3 key
KEY_F4 - The F4 key
KEY_F5 - The F5 key
KEY_F6 - The F6 key
KEY_F7 - The F7 key
KEY_F8 - The F8 key
KEY_F9 - The F9 key
KEY_F10 - The F10 key
KEY_F11 - The F11 key
KEY_F12 - The F12 key

There's more info in the scripting reference under Moho, KeyEvent
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Post by hayasidist »

Thanks a lot - I hadn't found that ref... so much info - a blessing and a problem at the same time. I'll give it a go.

But in the meantime, another question comes to mind - If I'm trapping these keystrokes, does this mean that if (say) I trap an "S" key that this will override the S as Scale Points ... for just as long as I have the "trap" active?
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Post by hayasidist »

Tools updated.
=========

the new version is at http://www.mediafire.com/?v9hqb20h3vobumd

The zip file has Readme, the LUA and the icons. It has been tested only on ASP7.

Main changes: number of points is selectable; circle segment replaces rectangle; generic ellipse replaces predefined oval (but you can still make the "eye" shape by creating a four-point shape); grid size selectable; grid fill now supported; UI flaws fixed in oval and sine.

as ever, comments / suggestions welcome.
jonbo
Posts: 896
Joined: Thu Apr 08, 2010 2:53 am

Post by jonbo »

Tested in AS8, so far, so good. Thanks man 8)
User avatar
uddhava
Posts: 315
Joined: Tue Nov 04, 2008 7:24 pm
Location: American back in Hungary

Post by uddhava »

Works fine for me.
Thanks, nice improvements.
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Post by hayasidist »

Hi Again,

tweaked this around a bit more. the new version is at the old URL http://www.mediafire.com/?v9hqb20h3vobumd.

Key new things are better and more options; draw polygon added, "glitches" in sine and grid fixed.

The zip file has Readme, the LUA and the icons. It has been tested only on ASP7.

as ever, helpful comments and suggestions welcome.
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

Thanks a lot for sharing these great scripts! :D
Post Reply