Sketch to Billboard Plugin

I’ve been playing with billboarding in Blender recently, and I’ve created a python script to interface with a java sketching app I’ve written. It has a synthetic brush model for sketching, and the script will extrapolate alpha channels and create an appropriately mapped and textured billboard in the scene. I’ve included the executable, code, and videos of it in action at http://screamyguy.net/sketchBoard/sketchBoard.htm .

While you could do this with the built-in uv texture painting, I’m working on fleshing out the brush model for splatter and water effects, and I think you can throw together billboard scenes much more easily this way.

My friend I loved your little app! The behaviour of the brush is excellent, with a graphic tablet it gives you really the impression you are using one of those special pentel brush-pen… Nice to have it linked with blender. Imagine if one day you can have it happening fully inside a script window :slight_smile: just a dream…

Imagine if one day you can have it happening fully inside a script window

Actually, a port wouldn’t be difficult given that both languages share the openGL drawing structure. I think I’m going to download the Tuhopuu sources and see how difficult it would be to augment the texture painting brush.

Sounds interesting! Why Tuhopuu and not BF though? Isn’t Tuhopuu mostly dead anyway?

this is awesome, nice!

:cool:

EDIT: i tried to use it, i set the path to the file correctly but i get this error message when i press the ‘sketch!’ button

Traceback (most recent call last):
  File "sketchGlue.py", line 144, in bevent
  File "sketchGlue.py", line 81, in render
  File "C:\Python24\Lib\os.py", line 597, in spawnl
    return spawnv(mode, file, args)
OSError: [Errno 2] No such file or directory

and when i try to open the .jar file outside blender i cant draw anything…

EDIT 2: it works on your website, it would also be good if there was an undo tool for any mistakes you make

Traceback (most recent call last):
  File "sketchGlue.py", line 144, in bevent
  File "sketchGlue.py", line 81, in render
  File "C:\Python24\Lib\os.py", line 597, in spawnl
    return spawnv(mode, file, args)
OSError: [Errno 2] No such file or directory

and when i try to open the .jar file outside blender i cant draw anything…

A couple things to check – the line in question spawns a new process with the java app in it. This spawn line is OS specific to windows. Which OS are you using? There is a Linux version, but I forgot to put that switch in – I’ll fix that later.

I put in a little code so that the sketch button does not show up unless it finds the sketch applet, so the error above indicates that the spawn command cannot find the java install (need a full path to java.exe). So, you’ve set the path to the JAR file correctly, but did you also set the java path correctly? The default in the script is the default location for a 1.6 JRE. Also, check your slashes – double forwards in quotes on the full path.

As far as not being able to sketch in the program – does it work in the browser? This would indicate that you have a recent enough version of Java. How does it fail? The sketching area should be light gray. If it remains white, that’s the failure mode when the socket hooks can’t connect to the python plugin. There are two versions of the JAR, one for Blender and one for standalone, with the difference being the socket hooks. Ensure you are using the right one. Also, Processing sometimes crashes on launch so there’s a chance that the standalone might fail on start – just relaunch.

I’ll try and put some more error handling in the code. Current version is kind of flaky.

im using windows.

Yeah i set the path correctly for java, im updating my java instalation and i will see if that fixes it…

yeah i am using the correct one, i was trying to launch Sketchboard.jar and now i realise that thats not the standalone version so thats why iot wasnt drawing…

ok updating jave seemed to work??

but now when i press sketch it comes up saying

Unable to access jarfile c:\Documents

i have edited the path loads of times, but it still does not seem to work

It’s getting confused by the space between the word “documents” and “and”. Is your path encapsulated with quotes? Could you post your path statements as you’ve entered them into the script?

Also, the line that is causing the problem merely launches the application (which you can do manually). You can sidestep these problems right now by:

1)commenting out the bob = os.spawnl… line in the script (place a # in front of it)

  1. run script as normal. Hit sketch (this will start the server, but you should not get any visual response)

  2. manually launch sketchBoard.jar by double clicking it.

Tried it on the mac, doesn’t seem to work…
It loads,but when I hit ‘Sketch’ it just hangs (had it runnin over half an hour!).
Had the paths correct…

The standalone works perfectly fine, so it’s not a java problem

‘Debugged’ for a few minutes… it seems to get trouble with the ‘conn,addr = s.accept()’ line.

Nice work though!!:smiley:

yeah that way works! thanks,

My path is a follows

#Enter your executable location here
executable = 'C:\Documents and Settings\Me\My Documents\sketchBoard.jar'    

#Enter your java path here
javaPath = 'c:\\Program Files\\Java\\jre1.5.0_06\\bin\\java.exe'

screamyGuy,
This is so cool - I tried it out and I love it!!! Many Thanks…

I agree about the undo… Also it seemed that if a line went out of the window boundary the file would not export…

Still very cool and very useful - Many Thanks…

Thanks for the input everyone! As far as undo goes, if you’ve been Blending long enough, you should know that the original Blender mantra was save after every command or don’t make mistakes. Regardless, I’ve implemented an undo buffer (Ctrl + Z) and uploaded the revised version. Just re download the app and all should be well.

Flurp:
your path has spaces, and my code can’t escape them properly. For now, try moving the jar somewhere without spaces in the path. I’m working on a way to escape them that works in python,windows, and Linux.

This is a bug… I was hoping it would fall under the radar, but I’m working on it

NaeRey:
Hmmm… My wife may have a Mac once they release the meroms, but I can’t debug your problem locally right now. The line you mention it stalling on involves connecting a network socket to the java app – the server is listening for the sketchboard app, but sketchBoard never connects. Perhaps you are using the non-networked Jar? I’m going to roll a single version that can handle being networked or standalone. Maybe this will help.

What is processing?

Do I need it to run your program?

Your tut look great !!!

Processing (http://processing.org) is set of convenience classes and an IDE for Java. It’s compiled into the executable, so you don’t need it to run. You do need a recent Java install, though. Just drop the Jar onto your hard drive (somewhere without spaces in the path – oops), set the paths in the script, and run it.

thanks screamyguy that worked, it works a treat, very useful! :slight_smile:

:cool:

please don’t use Tuhopuu, it is long dead,

just download current CVS off of the main branch and work from it,

LetterRip

im getting this error from the app on ure site and the consol in blender

"java.lang.Error: Do not use sketchBoard$Controller.add() use sketchBoard$Controller.getContentPane().add() instead

at javax.swing.JFrame.createRootPaneException(Unknown Source)

at javax.swing.JFrame.addImpl(Unknown Source)

at java.awt.Container.add(Unknown Source)

at sketchBoard$Controller.<init>(sketchBoard.java:463)

at sketchBoard.setup(sketchBoard.java:43)

at processing.core.PApplet.handleDisplay(PApplet.java:1237)

at processing.core.PGraphics.requestDisplay(PGraphics.java:568)

at processing.core.PApplet.run(PApplet.java:1406)

at java.lang.Thread.run(Unknown Source)

"

The stuff is set right app points to c:\sketchBoard.jar in blender and i have
Java™ Plug-in: Version 1.4.2_13
Using JRE version 1.4.2_13 Java HotSpot™ Client VM
any idea whats up here?
ide like to try this on the faster machine
it works on my slower one but i have the java sdk installed there
(jdk + netbeans used for a java based server)

This is a known backwards compatibility error in Java – if you upgrade your java to the new JRE (> 1.5) it will fix this. I’ll try to mod the code to work on older runtimes, though.

please don’t use Tuhopuu, it is long dead,
Will do – I guess the dev process has changed since I last looked at it.

Tuhopuu maintenance was dropped due to lack of time for Hos to maintain it. That was about two years ago, so the code base has changed tremendously (Orange and two summer of codes - and 5 releases or so…), so porting to current Blender would possibly be a lot of time and effort.

LetterRip