Monday, July 11, 2005

Python Strike Back


I've been taking a short break from complex decimator code today and fiddling with some more fun stuff.

Py Buttons!

Basicly, it evaluates the text as a python expression as if using eval() and puts the value back in the button as usual (meaning it checks for limits and all that). The execution is done sandboxed, it only has access to __builtin__ as well as the Blender and math modules (if it can import them).

Branching to the python evaluation code is based on the presence of the hash (#) symbol as first character. I thought it would be ironic to use the Python comment sign to signal Python evaluation. The irony is nice for memory :P. This is very faculative though, it could very well evaluate everything if it is wanted.

Right now (meaning after capturing the video), it pops the normal Python error message if it hits and error and prints the traceback in the console. It could be done silently though (as shown in the video).

Python Powa!


Saturday, July 02, 2005

Followup on my last post

I've heard from reputable sources that what I was doing with the transform code is (opening quote) insane (closing quote).
There was some other nice encouraging comments too, so I thought I might post a followup, to show people where I'm going with all this.


Not shown in the video are the changes to the constraint hotkey access in transform. First press on X/Y/Z is the global axis, as before, second press is the axis from the defined space. This is just an experiment, not sure if I like it yet (the way it works I mean, for sure I want to give access to the user defined space with hotkeys).
Also, the user defined space can be changed on the fly with Alt-space (like usual outside of transform).

Known bug: the "?" button adds to the selection, it doesn't "select" as if clicking on it.

That's pretty much it, have fun!