Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-05-16 16:26:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-05-16 16:26:17 +0400
commit05dcd05520814a170a565c568cbcd67533e6ad67 (patch)
tree2a17955dc4f658b17111dc6f30094018680f4976 /source/blender/python/api2_2x/Object.c
parent26cc8488eae39bb6ff79d767ab033622e77930e5 (diff)
Python bugfix reported by reD_Fox1
ob1.shareFrom(ob2) - didnt work with the new type/realtype method of making sure all new objects were emptys until they were linked to data and the realtype is used.
Diffstat (limited to 'source/blender/python/api2_2x/Object.c')
-rw-r--r--source/blender/python/api2_2x/Object.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 8404945485b..b30ce00239d 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -2681,11 +2681,16 @@ static PyObject *Object_shareFrom( BPy_Object * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an object argument" );
- if( self->object->type != object->object->type )
+ if( !object->object->data )
+ return EXPP_ReturnPyObjError( PyExc_TypeError,
+ "Object argument has no data linked yet or is an empty" );
+
+ if( self->object->type != object->object->type &&
+ self->realtype != object->object->type)
return EXPP_ReturnPyObjError( PyExc_TypeError,
"objects are not of same data type" );
- switch ( self->object->type ) {
+ switch ( object->object->type ) {
case OB_MESH:
case OB_LAMP:
case OB_CAMERA: /* we can probably add the other types, too */
@@ -2693,6 +2698,13 @@ static PyObject *Object_shareFrom( BPy_Object * self, PyObject * args )
case OB_CURVE:
case OB_SURF:
case OB_LATTICE:
+
+ /* if this object had no data, we need to enable the realtype */
+ if (self->object->type == OB_EMPTY) {
+ self->object->type= self->realtype;
+ self->realtype = OB_EMPTY;
+ }
+
oldid = ( ID * ) self->object->data;
id = ( ID * ) object->object->data;
self->object->data = object->object->data;
@@ -2711,6 +2723,7 @@ static PyObject *Object_shareFrom( BPy_Object * self, PyObject * args )
"old object reference count below 0" );
}
}
+
Py_RETURN_NONE;
default:
return EXPP_ReturnPyObjError( PyExc_ValueError,