[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23297] trunk/blender: rna function api was overwriting useful errors with keyword errors.

Campbell Barton ideasman42 at gmail.com
Thu Sep 17 02:14:47 CEST 2009


Revision: 23297
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23297
Author:   campbellbarton
Date:     2009-09-17 02:14:47 +0200 (Thu, 17 Sep 2009)

Log Message:
-----------
rna function api was overwriting useful errors with keyword errors.
fix some missing checks in the python interface.

Modified Paths:
--------------
    trunk/blender/release/ui/buttons_data_mesh.py
    trunk/blender/release/ui/buttons_material.py
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/release/ui/buttons_data_mesh.py
===================================================================
--- trunk/blender/release/ui/buttons_data_mesh.py	2009-09-16 22:27:27 UTC (rev 23296)
+++ trunk/blender/release/ui/buttons_data_mesh.py	2009-09-17 00:14:47 UTC (rev 23297)
@@ -102,7 +102,8 @@
 		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()
 

Modified: trunk/blender/release/ui/buttons_material.py
===================================================================
--- trunk/blender/release/ui/buttons_material.py	2009-09-16 22:27:27 UTC (rev 23296)
+++ trunk/blender/release/ui/buttons_material.py	2009-09-17 00:14:47 UTC (rev 23297)
@@ -65,8 +65,9 @@
 		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"

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2009-09-16 22:27:27 UTC (rev 23296)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2009-09-17 00:14:47 UTC (rev 23297)
@@ -1994,8 +1994,10 @@
 
 	/* 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;
 





More information about the Bf-blender-cvs mailing list