Page 1 of 2

Grids and Sine wave drawing tools

Posted: Tue Aug 02, 2011 5:13 pm
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.

Posted: Tue Aug 02, 2011 6:11 pm
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.

Posted: Tue Aug 02, 2011 7:14 pm
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.

Posted: Tue Aug 02, 2011 8:48 pm
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!

Posted: Tue Aug 02, 2011 9:03 pm
by jonbo
Excellent. This could be very useful to me. Thanks :)

Posted: Fri Aug 05, 2011 11:27 am
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

Posted: Fri Aug 05, 2011 12:13 pm
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...

Posted: Fri Aug 05, 2011 5:01 pm
by uddhava
Sounds great! Good luck.

Posted: Fri Aug 05, 2011 8:22 pm
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

Posted: Fri Aug 05, 2011 11:11 pm
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?

Posted: Mon Aug 08, 2011 9:06 pm
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.

Posted: Mon Aug 08, 2011 9:45 pm
by jonbo
Tested in AS8, so far, so good. Thanks man 8)

Posted: Tue Aug 09, 2011 3:31 pm
by uddhava
Works fine for me.
Thanks, nice improvements.

Posted: Sun Aug 28, 2011 6:00 pm
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.

Posted: Sun Aug 28, 2011 6:34 pm
by ulrik
Thanks a lot for sharing these great scripts! :D