From 1934ee422a47f7dcc5e63cfff5811873798561d8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Sep 2009 00:14:47 +0000 Subject: rna function api was overwriting useful errors with keyword errors. fix some missing checks in the python interface. --- release/ui/buttons_data_mesh.py | 3 ++- release/ui/buttons_material.py | 5 +++-- source/blender/python/intern/bpy_rna.c | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/release/ui/buttons_data_mesh.py b/release/ui/buttons_data_mesh.py index 33b3960b381..8796d7a46a8 100644 --- a/release/ui/buttons_data_mesh.py +++ b/release/ui/buttons_data_mesh.py @@ -102,7 +102,8 @@ class DATA_PT_shape_keys(DataButtonsPanel): kb = ob.active_shape_key row = layout.row() - row.template_list(key, "keys", ob, "active_shape_key_index", rows=2) + if key: # XXX - looks crappy + row.template_list(key, "keys", ob, "active_shape_key_index", rows=2) col = row.column() diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index 9f1c216c36b..8b58c2b8953 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -65,8 +65,9 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel): elif mat: split.template_ID(space, "pin_id") split.itemS() - - layout.itemR(mat, "type", expand=True) + + if mat: + layout.itemR(mat, "type", expand=True) class MATERIAL_PT_shading(MaterialButtonsPanel): __label__ = "Shading" diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 65c701c0041..50e32f34594 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1994,8 +1994,10 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw) /* Check if we gave args that dont exist in the function * printing the error is slow but it should only happen when developing. - * the if below is quick, checking if it passed less keyword args then we gave */ - if(kw && (PyDict_Size(kw) > kw_tot)) { + * the if below is quick, checking if it passed less keyword args then we gave. + * (Dont overwrite the error if we have one, otherwise can skip important messages and confuse with args) + */ + if(err == 0 && kw && (PyDict_Size(kw) > kw_tot)) { PyObject *key, *value; Py_ssize_t pos = 0; -- cgit v1.2.3