Looking for a stroke script

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
troypicou
Posts: 43
Joined: Mon Dec 15, 2014 7:04 pm

Looking for a stroke script

Post by troypicou » Tue May 22, 2018 8:47 pm

Just wondering if anyone knows of a script that allows you to adjust the strokes position. As it stands the stoke rides the middle of the line. I would like to have the option to have the stroke on the inside or the outside as well, like in illustrator.
Thanks for any assistance
Troy
User avatar
synthsin75
Posts: 7103
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Looking for a stroke script

Post by synthsin75 » Tue May 22, 2018 10:27 pm

Sorry, but that can't be changed by script.

Depending on what you need to do, you could mask a stroke to only show on one side of the curve or the other. But that's not likely to be very flexible.
User avatar
troypicou
Posts: 43
Joined: Mon Dec 15, 2014 7:04 pm

Re: Looking for a stroke script

Post by troypicou » Tue May 22, 2018 10:37 pm

Thanks for the info, maybe in a future release.
User avatar
Greenlaw
Posts: 4383
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw » Tue May 22, 2018 10:58 pm

Just a few thoughts:

I wonder if you can fake it using a Brush pattern that is only 'half stroked'. Try making two brushes, one for inside and one for outside strokes. I think the brush would look like a half circle? Sorry, I haven't actually made a brush myself yet, so not completely sure about this.

Another approach is to paste an unstroked shape on top of a stroked shape. That will 'stamp out' the inside portion of the stroke. I imagine if you use the unstroked shape as a mask, it should trim the outside part of the stroked shape.

I know these are all just workarounds but should work if you're in a pinch.

Maybe they'll add it in a future release if you submit a request.
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
User avatar
Greenlaw
Posts: 4383
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw » Tue May 22, 2018 11:26 pm

I tried the two shape tricks and they work fine.

Sorry, TinyPic seems to be down so can't upload the test pics.
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
User avatar
troypicou
Posts: 43
Joined: Mon Dec 15, 2014 7:04 pm

Re: Looking for a stroke script

Post by troypicou » Tue May 22, 2018 11:26 pm

Thanks for the suggestions!
User avatar
Greenlaw
Posts: 4383
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw » Tue May 22, 2018 11:43 pm

I just tried making a half stroke brush. Yes, a 'half-circle' shape in vertical orientation works for this. To make it work, enable Align Brush With Curve, zero out Jitter and Angle, and set a lower Spacing distance to minimize 'bumps' (12 seems to work well in my test example.)

Maybe a Pill shape would work better? TBD. Also, try a half square shape.
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
User avatar
synthsin75
Posts: 7103
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Looking for a stroke script

Post by synthsin75 » Wed May 23, 2018 1:02 am

Great trick, Dennis!

A rectangle brush works fantastic. And you only need one with a rectangle on either the right or left side. Then depending on the direction you draw the shape will determine if the stroke is interior or exterior. Here's the test brush I created:

Image
User avatar
troypicou
Posts: 43
Joined: Mon Dec 15, 2014 7:04 pm

Re: Looking for a stroke script

Post by troypicou » Wed May 23, 2018 1:17 am

Thanks
User avatar
Greenlaw
Posts: 4383
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw » Wed May 23, 2018 1:29 am

Thanks for carrying that out, Wes! Glad to hear it works. :)
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
User avatar
synthsin75
Posts: 7103
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Looking for a stroke script

Post by synthsin75 » Wed May 23, 2018 2:20 am

The one wrinkle is that scaling it past zero or flipping will invert the stroke. Good if you didn't draw it the way you wanted it, but bad if your animation needs to do either of those.
User avatar
troypicou
Posts: 43
Joined: Mon Dec 15, 2014 7:04 pm

Re: Looking for a stroke script

Post by troypicou » Wed May 23, 2018 2:30 am

That’s the issue I have run into Wes using this technique. Is there a way to freeze a stroke? When using them as textures and animating the stroke expansion shows. Just wondering I have been experimenting with using stokes as shadows and just looking for options. Thanks to the both of you for your input.
hayasidist
Posts: 2122
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Looking for a stroke script

Post by hayasidist » Wed May 23, 2018 9:40 am

Greenlaw wrote:Maybe they'll add it in a future release...
this request has been around for a while in various forms - mantis 30122 -- maybe worth adding another voice and a pointer to this thread there?
User avatar
Greenlaw
Posts: 4383
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw » Wed May 23, 2018 4:03 pm

Now that Tinypic is back up, here are the other techniques illustrated.

Image

For the mask technique, you'll probably want to make the mask layer a reference.
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
User avatar
Greenlaw
Posts: 4383
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw » Wed May 23, 2018 4:06 pm

Oh, another technique for 'outside' is to enable Outline in the Layer Property. If your shape has no stroke, this will create an outside stroke effect.

Image

This only works at render time though.

I swear, there's like a zillion ways to do stuff in Moho...and thank goodness for that. But it would still be nice to be able to just click between options for Stroke Center, Inside and Outside though. :)
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
Post Reply