Tablet Pressure feedback in Freehand tool

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

Moderators: Víctor Paredes, Belgarath, slowtiger

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

Tablet Pressure feedback in Freehand tool

Post by 7feet »

Meant to do this a while ago. I modded the current Freehand tool so that the little red line gives accurate feedback on linewidth while you are drawing. Straight replacement for the lm_freehand.lua script (a simple mod, but as always back up the original). It's a little zip file.

Get it here.

Install in your Moho>scripts>tool folder.

Makes sketching a lot easier. Enjoy.

<EDIT> just a note. For some reason it doesn't work for the very first line that you draw after you install the tool. Why? I dunno, but it's not a very big problem. Only happens once.

<MO' EDIT> I just uploaded a new version with a tiny tweak to make the linewidth feedback a little more accurate. If you grabbed it before 7:11 pm EST 11-30-05 then reget it or, if you are feeling adventurous open the script in any text editor and look for the line "ptWidthPen = (ptWidthPen * 350) / screenScale" (it's about 1/3 of the way down) and change the 350 to 400.
User avatar
Lost Marble
Site Admin
Posts: 2354
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

Good start, but there's a problem. Try resizing the Moho window to make it really small. Now use the modified Freehand tool - the preview width is no longer correct.

I think the 350 or 400 number is a "fudge factor", right? To get it right, you need to consider the size of the window in relation to the document's size.

However, to save you some time, there will be a width preview feature in the next Moho update.
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Ah, okay, I just kinda whipped it together for right now. I hadn't tried it with different sized windows. Does it for me at the moment with what I'm using (hell, it was under 10 minutes of work), but I'll try to fix that for use until the update comes out.

Thanks for pointing that out. I didn't do my usual test-to-destruction, as I just really wanted to draw some stuff right now. And yes, it was a fudge factor that I guess worked with the window size I had. Ack.

<EDIT> Okay, I fixed that issue. New File:

lm_freehand2.zip

Recognizes the window size. I also threw in recognition for the fractional line sizes for the minimum and maximum line widths in the Freehand Options pulldown, if you are using the Test Render version of Moho.
User avatar
BA
Posts: 196
Joined: Tue Mar 08, 2005 7:28 pm
Location: Griddleville
Contact:

Post by BA »

doesn't seem to be working for me... i can't see any difference from the old tool. Am I doing something wrong?
Create cartoon characters and comics in minutes: www.bitstrips.com
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

Same here: no difference in thickness of the red line. Perhaps it's because I'm on a Mac instead of a PC.

(Wacom Intuos 3 A5, Mac OS X 10.3.9)
User avatar
BA
Posts: 196
Joined: Tue Mar 08, 2005 7:28 pm
Location: Griddleville
Contact:

Post by BA »

I'm on a PC and not seeing the diff.
Create cartoon characters and comics in minutes: www.bitstrips.com
User avatar
Rai López
Posts: 2289
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

Hmmm :P ...It works PERFECT to me!!! :D :D :D THANK YOU 7 THANK YOU! THANK YOU!! THANK YOU!!! 8)

PS: You can appreciate better the difference if you use it in a large (or maximized) Main Window and then reduce it to the minimun size and try again, now the red line shows the correct thick, before it was less accurate, plus, as 7feet said now we can use fractional figures for RT version that is GREAT for very expressive results! (THANKS! :D)
Toontoonz
Posts: 763
Joined: Fri Mar 25, 2005 9:28 pm

Post by Toontoonz »

Works for me :D - using PC.
I guess what I like best about it is one can do fractional lines down to 0.25.
It is real nice to finally see the various widths of the lines as one draws.
(Be sure to set your "Display Quality" to the highest level - including checking "Antialiasing" so you can see your lines better as you work.)

Here is a quicky test Flash video using pen lines from 0.25 - 10 and 0.25 to 3 on the freehand setttings. Click on graphic to view - 1.2 MB:
http://www.zippyvideos.com/1359613402488286/untitled/

(Guess I shouldn´t ask and haven´t fully tried this script out, but wonder why the drawing tool wasn´t always like this? I guess the answer is because of the previous not-so-good rendering quality...???) :D
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Why does it work on some computers only?

Post by Rasheed »

Image

So can someone shed some light on this?
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Rasheed - just to try and narrow it down, which version of moho are you using? It should work, because after figuring it out it's a pretty trivial change to the script. I do remember trying something similar with an older (pre Render Test) version and not getting the result I was expecting, so perhaps it lies in some new tweaks to the script interface. The only new thing I used (basically) was the SetPenWidth command, and perhaps that was broken previously and a fix leaked through in the test version.

You have the pen pressure read by Moho (from your illustration, cool way to file a bug report), so off the bat I have to default to an OS or version thing.

-- Okay, I went back to 5.2.1 and it works okay, so that's not it. Using a Wacom? What driver version? That's all fishin' in the dark, but it should work. Maybe the reason it wouldn't work on the first line drawn is carrying over. And then I haven't got a clue. If I can figure it out, I'll certainly let you know.
Toontoonz
Posts: 763
Joined: Fri Mar 25, 2005 9:28 pm

Post by Toontoonz »

Just an observation - not a criticism - that when using the freehand tool and having the taper begin and end boxes checked, the line starts and ends from a "0" pen width no matter how large the min and max width of the line are set.
(The line does not taper from the minimum brush width setting, but rather from "0" brush width setting - overriding the minimum brush width setting.)

Turn off (remove check mark) the taper begin and end settings and the line draws from the min and max settings. Note that the end of the line is then rather boxy/square/flat.
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

@7feet: I'm using
- Macintosh OS X 10.3.9 (7w98)
- Wacom TabletDriver 4.9.3-3 (latest version)
- Moho 5.2.1

I got the script working!

After uploading the Wacom Tablet driver it still didn't work, so as a last resort, I looked at the part of the Lua code that was modified. I uncommented the following line (232), by removing the double dash "--":

Code: Select all

	--print(ptWidthPen, mouseEvent.penPressure, screenScale, 1 / screenScale, screenHeight)

Code: Select all

	print(ptWidthPen, mouseEvent.penPressure, screenScale, 1 / screenScale, screenHeight)
After this I ran Moho, and it worked (the Lua monitor window was outputting line width values). Now I put the double dash comment back at the start of line 232 and restarted Moho. And it still worked. Even after rebooting my computer the script worked.

So this seems to be a simple workaround if the Lua script doesn't work on your computer.

I'm not sure why this procedure worked, but here you have it.

Image
Post Reply