[Bf-python] Object.c patch

Stephen Swaney sswaney at swbell.net
Fri Aug 22 10:17:37 CEST 2003


On the blender.org python forum, someone reported
that Object.setName( string ) was not working.

Some of the Object_set*() methods are calling
PyArg_Parse() rather than PyArg_ParseTuple() to
get their arguments.  This patch addresses that.

I didn't make any changes to the Object_setAttr()
code since I wasn't sure if it needed to be changed.

I also confess to only testing the setName() and
setLocation() methods since it's really late here
and I'm going to bed.  It *did* all compile though!

Stephen

--
Stephen Swaney
sswaney at swbell.net


-------------- next part --------------
Index: Object.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Object.c,v
retrieving revision 1.36
diff -u -r1.36 Object.c
--- Object.c	10 Aug 2003 10:03:37 -0000	1.36
+++ Object.c	22 Aug 2003 07:40:42 -0000
@@ -957,7 +957,7 @@
 {
     char    dt;
 
-    if (!PyArg_Parse (args, "b", &dt))
+    if (!PyArg_ParseTuple (args, "b", &dt))
     {
         return (PythonReturnErrorObject (PyExc_AttributeError,
                 "expected an integer as argument"));
@@ -972,7 +972,7 @@
 { 
     char    dtx;
 
-    if (!PyArg_Parse (args, "b", &dtx))
+    if (!PyArg_ParseTuple (args, "b", &dtx))
     {
         return (PythonReturnErrorObject (PyExc_AttributeError,
                 "expected an integer as argument"));
@@ -1030,7 +1030,7 @@
     int            i;
     Material    ** matlist;
 
-    if (!PyArg_Parse (args, "O", &list))
+    if (!PyArg_ParseTuple (args, "O", &list))
     {
         return (PythonReturnErrorObject (PyExc_AttributeError,
                 "expected a list of materials as argument"));
@@ -1086,7 +1086,7 @@
     char  * name;
     char    buf[21];
 
-    if (!PyArg_Parse (args, "s", &name))
+    if (!PyArg_ParseTuple (args, "s", &name))
     {
         return (PythonReturnErrorObject (PyExc_AttributeError,
                 "expected a String as argument"));
@@ -1106,7 +1106,7 @@
     ID              * id;
     ID              * oldid;
 
-    if (!PyArg_Parse (args, "O", &object))
+    if (!PyArg_ParseTuple (args, "O", &object))
     {
         PythonReturnErrorObject (PyExc_AttributeError,
                 "expected an object argument");


More information about the Bf-python mailing list