[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10721] trunk/blender/source/blender/ python/api2_2x/Object.c: Python bugfix reported by reD_Fox1

Campbell Barton cbarton at metavr.com
Wed May 16 14:26:18 CEST 2007


Revision: 10721
          https://svn.blender.org//revision/?rev=10721&view=rev
Author:   campbellbarton
Date:     2007-05-16 14:26:17 +0200 (Wed, 16 May 2007)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Object.c

Modified: trunk/blender/source/blender/python/api2_2x/Object.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Object.c	2007-05-16 05:03:33 UTC (rev 10720)
+++ trunk/blender/source/blender/python/api2_2x/Object.c	2007-05-16 12:26:17 UTC (rev 10721)
@@ -2681,11 +2681,16 @@
 		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 @@
 	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 @@
 					   "old object reference count below 0" );
 			}
 		}
+		
 		Py_RETURN_NONE;
 	default:
 		return EXPP_ReturnPyObjError( PyExc_ValueError,





More information about the Bf-blender-cvs mailing list