diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-09 01:31:28 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-09 01:31:28 +0400 |
commit | 51ae88aa3b84565d79ab8819807f90aa3844479a (patch) | |
tree | 355d3ef7ac873c259321c574e6fcea82b4585087 /source/blender/python/intern | |
parent | 288bfeea1ed8435cfa22938346afbabb7e91bdbb (diff) |
2.5: Mesh and Various Fixes
* 3D view Mesh menu works again, but incomplete.
* Add Properties and Toolbar to 3D View menu.
* Added "specials" menus back, vertex/edge/face and general.
* Various fixes in existing mesh operators, some were not working.
* Add MESH_OT_merge.
* Merge all subdivide ops into MESH_OT_subdivide, subdivide code
changes to make smooth + multi give good results.
* Rename all select inverse ops to *_OT_select_inverse.
* Fix "search for unknown operator" prints at startup, and some
warnings in py code.
* Don't run .pyc files on startup.
* Remove unused image window header C code.
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 20 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_operator_wrap.c | 7 |
3 files changed, 22 insertions, 13 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index bc422e5a20c..64f2d896954 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -151,7 +151,6 @@ wchar_t* Py_GetPath(void) /* must be called before Py_Initialize */ void BPY_start_python_path(void) { - char py_path[FILE_MAXDIR + 11] = ""; char *py_path_bundle= BLI_gethome_folder("python"); if(py_path_bundle==NULL) @@ -162,15 +161,21 @@ void BPY_start_python_path(void) #if (defined(WIN32) || defined(WIN64)) #if defined(FREE_WINDOWS) - sprintf(py_path, "PYTHONPATH=%s", py_path_bundle); - putenv(py_path); + { + char py_path[FILE_MAXDIR + 11] = ""; + sprintf(py_path, "PYTHONPATH=%s", py_path_bundle); + putenv(py_path); + } #else _putenv_s("PYTHONPATH", py_path_bundle); #endif #else #ifdef __sgi - sprintf(py_path, "PYTHONPATH=%s", py_path_bundle); - putenv(py_path); + { + char py_path[FILE_MAXDIR + 11] = ""; + sprintf(py_path, "PYTHONPATH=%s", py_path_bundle); + putenv(py_path); + } #else setenv("PYTHONPATH", py_path_bundle, 1); #endif @@ -484,7 +489,10 @@ void BPY_run_ui_scripts(bContext *C, int reload) while((de = readdir(dir)) != NULL) { /* We could stat the file but easier just to let python * import it and complain if theres a problem */ - + + if(strstr(de->d_name, ".pyc")) + continue; + file_extension = strstr(de->d_name, ".py"); if(file_extension && *(file_extension + 3) == '\0') { diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 004cf2fb7c7..b183120dd2d 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -130,12 +130,12 @@ static PyObject *pyop_base_getattro( BPy_OperatorBase * self, PyObject *pyname ) PyObject *ret; wmOperatorType *ot; - if ((ot= WM_operatortype_find(name))) { - ret = PyCFunction_New( pyop_base_call_meth, pyname); /* set the name string as self, PyCFunction_New incref's self */ - } - else if ((ret = PyObject_GenericGetAttr((PyObject *)self, pyname))) { + if ((ret = PyObject_GenericGetAttr((PyObject *)self, pyname))) { /* do nothing, this accounts for methoddef's add and remove */ } + else if ((ot= WM_operatortype_find(name))) { + ret = PyCFunction_New( pyop_base_call_meth, pyname); /* set the name string as self, PyCFunction_New incref's self */ + } else { PyErr_Format( PyExc_AttributeError, "Operator \"%s\" not found", name); ret= NULL; diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 60a9afda0c4..f8567414717 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -352,9 +352,10 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class) idname = _PyUnicode_AsString(item); /* remove if it already exists */ - if ((ot=WM_operatortype_find(idname))) { - if(ot->pyop_data) + if ((ot=WM_operatortype_exists(idname))) { + if(ot->pyop_data) { Py_XDECREF((PyObject*)ot->pyop_data); + } WM_operatortype_remove(idname); } @@ -402,7 +403,7 @@ PyObject *PYOP_wrap_remove(PyObject *self, PyObject *value) return NULL; } - if (!(ot= WM_operatortype_find(idname))) { + if (!(ot= WM_operatortype_exists(idname))) { PyErr_Format( PyExc_AttributeError, "Operator \"%s\" does not exists, cant remove", idname); return NULL; } |