Minor tweak to ASP6's freehand tool

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Minor tweak to ASP6's freehand tool

Post by Rudiger »

UPDATED - 23 April 2011

With the introduction of the sequencer in Anime Studio 6, I thought it could work great as a story boarding tool by sketching out frames with the Freehand tool and rendering them to bitmaps to reduce file size. The whole process works really well, although I still want to write a script to automatically render the current view and bring it back in as a bitmap. The only thing was that the freehand tool sets the width of the first point of the stroke as soon as you press down on the pen, resulting in all of the strokes it creates always starting out being quire pointed. In fact, I found myself jamming the pen down on my tablet to try and increase the initial width of the stroke.

Anyway, before something broke I decided to have a bash at modifying the Freehand tool. It turned out to be surprisingly easy. All it does is carry on updating the width of the first point of the stroke in the OnMouseMoved method until it gets outside of the pixel tolerance radius. The only problem now is that the start of the stroke can be quite square, but I'm working on another script that will be able to round off stroke endpoints and I may even add it to the Freehand tool as an option.

So here are the links to my modified versions of the tool: At the same time I also made the width variation not go past the current line width as my poor Photoshop-corrupted mind couldn't handle the way it was. If anyone's already fallen in love with this feature I have included an alternate version of my mod that still varies the width in the original way.
rt_freehand_OrigWidthVar.zip

By the way, I can't thank Mike enough for giving us this kind of access to the core tools in Anime Studio. I can't think of one other commercial program that would let you customize a drawing tool as this level. It's like being able to make your own pencil that perfectly suits your own style of drawing.

By the way I haven't forgotten about posting my nudge keyframe tools that I promised a few people. It's just that I uncovered a few bugs in my scripts and possible also in AnimeStudio in porting it over to version 6. I hope to have something to post sometime this week, though.
Last edited by Rudiger on Sat Apr 23, 2011 2:24 am, edited 5 times in total.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Post by chucky »

Hi rudiger , good on you for playing with the freehand tool, I like it a lot so any improvements would be cool, I will check it out asap.

I was actually wondering especially after seeeing that you have been playing with the freehand tool which might have some similar areas of code regarding the point approximity and angle reduction (big breath),if you had seen my motrack thread .

viewtopic.php?t=13580
Do you think the same logic of point reduction along vectors in the frehand tool might be applied to keyframes?
Have a look at the thread there are screengrabs to illustrate what I mean.
Don't mean to hijack, back now to the advertised broadcast. :D
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Post by Rudiger »

Hi Chucky,

Yeah, you are right. In both cases you have a continuous path of points and you want to throw away all points that fall below the angle and pixel tolerances. Of course you can't vary the curvature of keyframes along motion paths like you can with points along curves, but the freehand tool doesn't do that anyway, so you should be able to copy and paste the freehand tool code straight in.

So I take it that you just want it as a menu script that you run to optimise an existing motion path. I'll have a crack at it tomorrow and post a link to your other thread.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Post by chucky »

Oh that's wicked Rudiger, you are a true CHAMPION!
I'm so glad you get what I am taking about, sometimes even to me my sentences just sound like random words in a very long line...... :wink:
Hope to play with your freehand script/tool after work.
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 »

Thanks for this tool. I'm experimenting right now with it.
I just have a question -and maybe it's better to put it here instead starting a new thread- Is there anyway to obtain sharp curves with the freehand tool?
I mean, it always seems to maintain the same default curvature value, don't care how pointed you draw. Is there anyway to interpret the curvature of the freehand and apply it to the line points. It would be awesome to obtain different curvature values on each point.
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Post by Rudiger »

Hi Selgin,

Yeah, the freehand tool completely ignores the curvature setting of the points. You could probably put in some code that checks for an abrupt change in angle and interprets it as a sharp corner. You just wouldn't want it to be too sensitive though. I can add it to my todo list. Like I said, it's nuts that you can do this sort of customization to a tool in a commercial program.
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 »

Rudiger wrote:Yeah, the freehand tool completely ignores the curvature setting of the points. You could probably put in some code that checks for an abrupt change in angle and interprets it as a sharp corner. You just wouldn't want it to be too sensitive though. I can add it to my todo list. Like I said, it's nuts that you can do this sort of customization to a tool in a commercial program.
Thank you, Rudiger. For avoiding the tool being too sensitive maybe it be personalized with a numeric value, just like pixel and angle tolerance.
And yes, it's a huge feature to script tools. After some time using AS, it's completely different to what I get at first, and I know it will continue changing. It's fantastic to have a software so flexible.
donnie
Posts: 111
Joined: Mon Oct 16, 2006 11:53 pm

Post by donnie »

Hey Rudger thats a nice mod! Thanks for sharing.

Great to hear that the Nudge Keframes tool is still in the works too! :)
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Post by Rudiger »

selgin wrote:
Rudiger wrote:Yeah, the freehand tool completely ignores the curvature setting of the points. You could probably put in some code that checks for an abrupt change in angle and interprets it as a sharp corner. You just wouldn't want it to be too sensitive though. I can add it to my todo list. Like I said, it's nuts that you can do this sort of customization to a tool in a commercial program.
Thank you, Rudiger. For avoiding the tool being too sensitive maybe it be personalized with a numeric value, just like pixel and angle tolerance.
And yes, it's a huge feature to script tools. After some time using AS, it's completely different to what I get at first, and I know it will continue changing. It's fantastic to have a software so flexible.
I had some thoughts as to how you could add adaptive curvature to the freehand tool. What if you had the parameters smoothAngleThreshold and peakAngleThreshold that let you set the angle at which it starts and finishes sharpening up points?
Example 1: If you set smoothAngleThreshold to 90 and peakAngleThreshold to 0 it would only sharpen acute angles and the more acute the angle, the sharper it would make it.
Example 2: If you set both parameters to 90, it would make all acute angles sharp corners, perfect if you are drawing geometrical type shapes.
Example 3: If you set both parameters to 0, it would operate the same way it does now.

It could be integrated into the existing angleTolerance code, so the performance hit should be minimal.
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 »

If I understood well, that sounds fantastic! With a freehand which let you draw sharpened shapes maybe I'll never use add points to begin sculpting.
And the flexibility of the controls will transform the freehand in a dream :D. Oh, please, if you have some news, don't forget to write them here!

Thanks!
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Post by Rudiger »

Thanks, Selgin. Glad you like the idea. As we start adding more and more parameters to this tool, trying to find the best combination for different situations is going to get more and more difficult. What I think I'll do is add a drop-down list of presets like, sharp, smooth, detailed, etc, which set the parameters for you automatically. You would be able to add your own custom presets to the list as well.
User avatar
madrobot
Posts: 667
Joined: Mon Apr 07, 2008 3:07 pm

Post by madrobot »

Rudiger that sounds like an excellent idea.

Maximising options, flexibility and user customisability.
User avatar
Blue
Posts: 157
Joined: Fri Jul 03, 2009 1:55 am
Location: Los Angeles
Contact:

Post by Blue »

I just wanted to say these proposed improvements to the Freehand tool sound awesome. I too am looking to storyboard within ASP.

I like the idea of the having the angles, based on angle variable input, either smooth or sharpen an angle. As it stands, you can not draw a geometric shape without having to use separate lines.
joelstoryboards.com - (WinXP SP3, ASP 6.1)
User avatar
Blue
Posts: 157
Joined: Fri Jul 03, 2009 1:55 am
Location: Los Angeles
Contact:

Post by Blue »

Haven't tried your freehand tool above, not sure what you've changed. I think the angle (sharpness) variables are a necessary inclusion.

I LOVE your Brush Tool idea and would be willing to go in with few others on it. However, I think a separate point reduction tool or script will definitely be necessary to compliment the tool.

BRUSH TOOL
What I've basically got in mind is for it create filled shapes based on your strokes, adding to existing shapes with ctl key is pressed and subtracting when alt key is pressed
joelstoryboards.com - (WinXP SP3, ASP 6.1)
rogermate
Posts: 296
Joined: Mon Jun 02, 2008 5:53 am
Location: Mars

Post by rogermate »

Blue wrote:Haven't tried your freehand tool above, not sure what you've changed. I think the angle (sharpness) variables are a necessary inclusion.

I LOVE your Brush Tool idea and would be willing to go in with few others on it. However, I think a separate point reduction tool or script will definitely be necessary to compliment the tool.

BRUSH TOOL
What I've basically got in mind is for it create filled shapes based on your strokes, adding to existing shapes with ctl key is pressed and subtracting when alt key is pressed
Hi Rudiger,

"between painting in strokes and painting in shapes"

Sorry for the barage of questions, perhaps they might contribute towards defining or explaining the tool.

Could you explain how the tool might toggle between the two? One thing I'm not understanding is how a stroke could be expanded by painting. Wouldn't the result just be an additional stroke.
But painting shapes would imply an expanding (or contracting, neat idea like erasing) shape and I could see how the outer shape boundaries would change.

Also, it is likely to happen that a stroke is done which does not overlap the "current" underlying shape. Does it become a new shape. I assume that the tool would only operate on shape / strokes in the current layer.

Could the brush have a shape or pattern?
Post Reply