Hi,
Not sure where to post this, but well done theeth for finally comitting that patch which allows you to type python code into blender buttons to set the value. I’ve seen it sitting there for so long in the patch tracker…
Aligorith
Hi,
Not sure where to post this, but well done theeth for finally comitting that patch which allows you to type python code into blender buttons to set the value. I’ve seen it sitting there for so long in the patch tracker…
Aligorith
what?
10 letters
In current cvs, you can now click on any button, enter the # character, then type in a one-line python expression. Like with the pydrivers, some often used modules are available (Blender, Sys, and Math for example) with shortened names or their normal names.
For example, get a build of today’s cvs, click on the button displaying the current frame in the buttons window, then type:
#m.pi
After clicking out of the button or pressing enter, you should now see the number 3 in the button. What happened was that the expression m.pi was evaluated, m being the shortname for the math module, and pi being pi.
Theeth put it better in his cvs commit log:
== Python Button Evaluation ==
Users can write any valid Python expression (that evals to an int or float) inside Blender’s gui number buttons (preceded by #) and have them evaluated to their actual int or float value.
Button Evaluation has access to the same modules as PyDrivers.
For example:
#1.0*9-2.3
#ob(“Camera”).LocZ
#1.0/ob(“Cube”).LocX
#math.sin(math.pi) – or simply #m.sin(m.pi)
etc
EDIT: forgot that no testing builds posted by anyone (around the blender.org) forums have this yet.
Aligorith