diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-10-10 06:18:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-10-10 06:18:08 +0400 |
commit | 6e61448123b26d60099474405a6c585e1a7fae1a (patch) | |
tree | 7207b0c1cf5b4190173a2439684791b355856cdb /source | |
parent | 475bc908be0a9f6133f96bd8d1f1f85914b4f5d3 (diff) |
Mistake in recent schange to scn.objects.new() crashed Blender. fixed and also stopped Mesh_FromPyObject() clearning a meshes object if not called with an object.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/api2_2x/Mesh.c | 4 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Scene.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 299c999e643..5732fe0d674 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -7909,7 +7909,9 @@ Mesh *Mesh_FromPyObject( PyObject * pyobj, Object *obj ) BPy_Mesh *blen_obj; blen_obj = ( BPy_Mesh * ) pyobj; - blen_obj->object = obj; + if (obj) + blen_obj->object = obj; + return blen_obj->mesh; } diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index fe4ca5fa355..8f013f66111 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -1307,6 +1307,7 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args ) if( !PyArg_ParseTuple( args, "O", &py_data ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected an object as argument" ); + if (py_data == Py_None) { type = OB_EMPTY; } else if( Camera_CheckPyObject( py_data ) ) { @@ -1339,8 +1340,9 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args ) /* have we set data to something good? */ if( data ) { - ((ID *)object->data)->us++; object = alloc_libblock( &( G.main->object ), ID_OB, ((ID *)data)->name + 2 ); + object->data = data; + ((ID *)data)->us++; } else { if (type != OB_EMPTY) { return EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -1350,7 +1352,6 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args ) object = alloc_libblock( &( G.main->object ), ID_OB, "Empty" ); } - object->data = data; object->flag = SELECT; object->type = type; |