[Bf-blender-cvs] [ec18021] master: Fix T43337: Group object disappear after append

Campbell Barton noreply at git.blender.org
Mon Mar 9 04:35:18 CET 2015


Commit: ec180218678be5704d31532fff8c20d2356b8f02
Author: Campbell Barton
Date:   Mon Mar 9 14:23:30 2015 +1100
Branches: master
https://developer.blender.org/rBec180218678be5704d31532fff8c20d2356b8f02

Fix T43337: Group object disappear after append

Relying on user-count of 1 wasn't reliable because of custom-bones.

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ceccb73..45d1c20 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9045,7 +9045,7 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
 					do_it = true;
 				}
 				else if (idcode==ID_GR) {
-					if (ob->id.us == 1 && is_link == false && ob->id.lib == lib) {
+					if ((is_link == false) && (ob->id.lib == lib)) {
 						if ((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) {
 							do_it = true;
 						}
@@ -9054,7 +9054,7 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
 				else {
 					/* when appending, make sure any indirectly loaded objects
 					 * get a base else they cant be accessed at all [#27437] */
-					if (ob->id.us==1 && is_link == false && ob->id.lib == lib) {
+					if ((is_link == false) && (ob->id.lib == lib)) {
 						/* we may be appending from a scene where we already
 						 *  have a linked object which is not in any scene [#27616] */
 						if ((ob->id.flag & LIB_PRE_EXISTING)==0) {
@@ -9074,7 +9074,9 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
 					base->lay = ob->lay;
 					base->object = ob;
 					base->flag = ob->flag;
-					ob->id.us = 1;
+
+					CLAMP_MIN(ob->id.us, 0);
+					ob->id.us += 1;
 					
 					ob->id.flag -= LIB_INDIRECT;
 					ob->id.flag |= LIB_EXTERN;




More information about the Bf-blender-cvs mailing list