diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-10 15:58:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-10 15:58:53 +0400 |
commit | 6c951fbb98a5ddb29240c3efc9af4304ab942396 (patch) | |
tree | 7eb917c4f8cb9196f1430cf034335d2d7ebaeb1e /source/blender/editors | |
parent | 7084be920a0acb95e2db84bb7029a65bc7a76d9a (diff) |
adding back button evaluation so you can do 1/60, 90*0.1 etc as well as dimension conversion 1km-10cm+4ft
Note...
- Python3.1 you don't need to add the .0 for divisions anymore (was esp annoying for button eval)
- Simple dimension input, imperial mi/yd/ft/in, metric km/m/cm/mm, Later could display these values and have a pref for scene scale, atm it assumes 1BU == 1m.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/SConscript | 1 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript index bac3742c12f..e44de5410f1 100644 --- a/source/blender/editors/interface/SConscript +++ b/source/blender/editors/interface/SConscript @@ -9,6 +9,7 @@ for source in env.Glob('*_api.c'): incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../makesrna ../../windowmanager #/intern/guardedalloc' incs += ' #/extern/glew/include' +incs += ' ../../python/' # python button eval defs = [] diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 9e9b6165a73..f3bb975a1f7 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -66,6 +66,8 @@ #include "RNA_access.h" #include "RNA_types.h" +#include "BPY_extern.h" + #include "interface_intern.h" #define MENU_WIDTH 120 @@ -1434,10 +1436,9 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) double value; /* XXX 2.50 missing python api */ -#if 0 - if(BPY_button_eval(str, &value)) { - BKE_report(CTX_reports(C), RPT_WARNING, "Invalid Python expression, check console"); - value = 0.0f; /* Zero out value on error */ +#ifndef DISABLE_PYTHON + if(BPY_button_eval(C, str, &value)) { + value = ui_get_but_val(but); /* use its original value */ if(str[0]) return 0; |