Goodies first, talk later:
Download:
http://www.ghost-hack.com/p5/postprocessing/console_070308.zipIncludes source code and example project.
Hey guys. This is part of the "post-processing" series of libraries I'm working on to release.
All you do is hit tilde to bring up the console (like Quake 3 and other video-games that have consoles). From here you can access pretty much any variable of function you have written inside your Processing code.
Say you have a color variable, and you just want to tweak it to see what it looks like, but changing it requires breaking too many things, or compile or loading time would take too long to restart, etc. So all you do is bring up the console, and change it directly. Simple!
How this is done: I am using java reflection and abusing it. The console latches onto your object and it knows what static functions you have (private or public! doesn't matter) and what fields (variables) you've defined. I then wrote a text console that interprets what you write and directly calls a variable, or modifies a function.
There are a few restrictions and I'm working to fix them:1. You can only access static variables. This is because the console doesn't latch onto objects, only classes. This is something I'm hoping to change but presents somewhat of a design problem (how do you select object instances from a console).
2. Integers fail to be detected, so the console treats everything as floats. This needs to be fixed in order so that modifying color variables can work (they are integers in processing).
3. No expressions / in-line math stuff! You can't do MyFunction( anotherFunction() )!
4. Calling functions doesn't return what the function returns. The console should print out what your function spits back.
5. The console rendering fails when you have no background() in your draw loop. That's unfortunate, because the best use of this console is to tweak tiny, iterative drawing sketches.
Help neededIf anyone wants to help out, I've included the source code with the library. I'd love to see if anyone could help resolve some of the issues I listed above.
In the future, I want to be able to allow this console to run scripts. So for example, you can write a script that executes your processing program one way, and another script that runs it completely differently. You can save these scripts from the console, or load and run any scripts you've written and saved to your sketch folder.
The power is yours!! \o/