- new __main__ module wasnt de-referenced after adding into sys.modules
- made int buttons round floats better 10.6 --> 11
This commit is contained in:
@@ -1644,7 +1644,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
|
||||
value= atof(str);
|
||||
#endif
|
||||
|
||||
if(!ui_is_but_float(but)) value= (int)value;
|
||||
if(!ui_is_but_float(but)) value= (int)floor(value + 0.5);
|
||||
if(but->type==NUMABS) value= fabs(value);
|
||||
|
||||
/* not that we use hard limits here */
|
||||
|
||||
@@ -159,6 +159,7 @@ static PyObject *CreateGlobalDictionary(bContext *C, const char *filename)
|
||||
PyInterpreterState *interp= PyThreadState_GET()->interp;
|
||||
PyObject *mod_main= PyModule_New("__main__");
|
||||
PyDict_SetItemString(interp->modules, "__main__", mod_main);
|
||||
Py_DECREF(mod_main); /* sys.modules owns now */
|
||||
|
||||
PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
|
||||
PyModule_AddStringConstant(mod_main, "__name__", "__main__");
|
||||
|
||||
Reference in New Issue
Block a user