[Bf-python] FW: [Bf-blender-cvs] CVS commit: blender/source/blender/python/api2_2xObject.c

Gilbert, Joseph jgilbert at tigr.ORG
Thu Nov 3 16:16:30 CET 2005


I haven't looked at this but it would seem better to return
self->object->rot somehow with Py_WRAP. 

As a side note the Py_WRAP/Py_NEW has caused some confusion among script
writers. Things that return Py_WRAP'ed items give direct access to the
data structure. When you create a copy (e.g. x = y) both of these
objects are manipulating the struct data directly. 

When an object is Py_NEW'ed it's a python object returned with no direct
struct access (i.e. it's not a thin wrapper). 

If your getting a Py_WRAP'ed object and want to get a new variable that
you want to reassign or manipulate without changing the struct data
(i.e. x = y, x = 1, y.data = 2) you need to call the constructor for the
object (i.e. x = obj.Euler(), y = Euler(x), y = 'hi', x.unique())

This was part of the mathutils update and in response to the
vector_proxy issue. However, it seems that this has generated a bit of
confusion. We need to label in the documentation which methods return
WRAP'ed data (i.e. give thin access) and what does not. Even then script
writers will still do x = y by mistake and not realize why that have to
reinvert a matrix for instance.

Just some thoughts. 

-----Original Message-----
From: bf-blender-cvs-bounces at projects.blender.org
[mailto:bf-blender-cvs-bounces at projects.blender.org] On Behalf Of Ken
Hughes
Sent: Wednesday, November 02, 2005 6:29 PM
To: bf-blender-cvs at blender.org
Subject: [Bf-blender-cvs] CVS commit:
blender/source/blender/python/api2_2xObject.c

khughes (Ken Hughes) 2005/11/03 00:28:36 CET

  Modified files:
    blender/source/blender/python/api2_2x Object.c 
  
  Log:
  -- Bugfix 3333: BPy method ob.getEuler() was returning PyObject which
wrapped
     stack-allocated data (thanks, pontus).
  
  Revision  Changes    Path
  1.140     +2 -2      blender/source/blender/python/api2_2x/Object.c
 
<http://projects.blender.org/viewcvs/viewcvs.cgi/blender/source/blender/
python/api2_2x/Object.c.diff?r1=1.139&r2=1.140&cvsroot=bf-blender>
_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-blender-cvs



More information about the Bf-python mailing list