[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60898] trunk/blender/source/blender: Making real need to remove proxies

Sergey Sharybin sergey.vfx at gmail.com
Tue Oct 22 17:19:37 CEST 2013


Revision: 60898
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60898
Author:   nazgul
Date:     2013-10-22 15:19:37 +0000 (Tue, 22 Oct 2013)
Log Message:
-----------
Making real need to remove proxies

Otherwise some invalid pointers will be left
which could be harmless if real object stays
local, but crashes when linking them to
another files.

Was discovered here in the studio during
Project Pampa, and the steps to reproduce are:

- Create lib.blend, put armature and cube to it.
  Create a group with them.
- Create scene.blend and link group from lib.blend.
- Make a proxy from armature.
- Make group real.
- Add real objects to a group.
- Create comp.blend and link group from scene.blend.
  This step will creah.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/object.c
    trunk/blender/source/blender/editors/object/object_add.c

Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c	2013-10-22 11:37:57 UTC (rev 60897)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2013-10-22 15:19:37 UTC (rev 60898)
@@ -1302,6 +1302,11 @@
 	obn->mode = 0;
 	obn->sculpt = NULL;
 
+	/* Proxies are not to be copied. */
+	obn->proxy_from = NULL;
+	obn->proxy_group = NULL;
+	obn->proxy = NULL;
+
 	/* increase user numbers */
 	id_us_plus((ID *)obn->data);
 	id_us_plus((ID *)obn->gpd);

Modified: trunk/blender/source/blender/editors/object/object_add.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_add.c	2013-10-22 11:37:57 UTC (rev 60897)
+++ trunk/blender/source/blender/editors/object/object_add.c	2013-10-22 15:19:37 UTC (rev 60898)
@@ -1220,9 +1220,11 @@
                                        const short use_base_parent,
                                        const short use_hierarchy)
 {
+	Main *bmain = CTX_data_main(C);
 	ListBase *lb;
 	DupliObject *dob;
 	GHash *dupli_gh = NULL, *parent_gh = NULL;
+	Object *object;
 
 	if (!(base->object->transflag & OB_DUPLI))
 		return;
@@ -1237,6 +1239,7 @@
 	for (dob = lb->first; dob; dob = dob->next) {
 		Base *basen;
 		Object *ob = BKE_object_copy(dob->ob);
+
 		/* font duplis can have a totcol without material, we get them from parent
 		 * should be implemented better...
 		 */
@@ -1330,6 +1333,17 @@
 		}
 	}
 
+	/* The same how BKE_object_unlink detects which object proxies to clear. */
+	if (base->object->transflag & OB_DUPLIGROUP && base->object->dup_group) {
+		for (object = bmain->object.first; object; object = object->id.next) {
+			if (object->proxy_group == base->object) {
+				object->proxy = NULL;
+				object->proxy_from = NULL;
+				DAG_id_tag_update(&object->id, OB_RECALC_OB);
+			}
+		}
+	}
+
 	if (dupli_gh)
 		BLI_ghash_free(dupli_gh, NULL, NULL);
 	if (parent_gh)




More information about the Bf-blender-cvs mailing list