[Bf-blender-cvs] [d747bfb] master: Fix/cleanup BKE libquery's ID looper.

Bastien Montagne noreply at git.blender.org
Thu Jun 16 21:12:18 CEST 2016


Commit: d747bfbe298327a01f03a0c7d1183c98f4c85f4e
Author: Bastien Montagne
Date:   Thu Jun 16 21:09:01 2016 +0200
Branches: master
https://developer.blender.org/rBd747bfbe298327a01f03a0c7d1183c98f4c85f4e

Fix/cleanup BKE libquery's ID looper.

Some area were still not in sync with readfile.c, now should be better.

Note that readfile.c has been used as référence here re us refcounting,
not sure how accurate it is, time will say :|

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

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

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

diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index d29d219..4fe408e 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -227,6 +227,14 @@ static void library_foreach_mtex(LibraryForeachIDData *data, MTex *mtex)
 	FOREACH_FINALIZE_VOID;
 }
 
+static void library_foreach_paint(LibraryForeachIDData *data, Paint *paint)
+{
+	FOREACH_CALLBACK_INVOKE(data, paint->brush, IDWALK_USER);
+	FOREACH_CALLBACK_INVOKE(data, paint->palette, IDWALK_USER);
+
+	FOREACH_FINALIZE_VOID;
+}
+
 
 /**
  * Loop over all of the ID's this datablock links to.
@@ -278,7 +286,7 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
 				CALLBACK_INVOKE(scene->camera, IDWALK_NOP);
 				CALLBACK_INVOKE(scene->world, IDWALK_USER);
 				CALLBACK_INVOKE(scene->set, IDWALK_NOP);
-				CALLBACK_INVOKE(scene->clip, IDWALK_NOP);
+				CALLBACK_INVOKE(scene->clip, IDWALK_USER);
 				CALLBACK_INVOKE(scene->nodetree, IDWALK_NOP);
 				/* DO NOT handle scene->basact here, it's doubling with the loop over whole scene->base later,
 				 * since basact is just a pointer to one of those items. */
@@ -318,6 +326,9 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
 						CALLBACK_INVOKE(seq->clip, IDWALK_USER);
 						CALLBACK_INVOKE(seq->mask, IDWALK_USER);
 						CALLBACK_INVOKE(seq->sound, IDWALK_USER);
+						for (SequenceModifierData *smd = seq->modifiers.first; smd; smd = smd->next) {
+							CALLBACK_INVOKE(smd->mask_id, IDWALK_USER);
+						}
 					}
 					SEQ_END
 				}
@@ -330,28 +341,28 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
 
 				if (toolsett) {
 					CALLBACK_INVOKE(toolsett->skgen_template, IDWALK_NOP);
+
 					CALLBACK_INVOKE(toolsett->particle.scene, IDWALK_NOP);
 					CALLBACK_INVOKE(toolsett->particle.object, IDWALK_NOP);
 					CALLBACK_INVOKE(toolsett->particle.shape_object, IDWALK_NOP);
-					CALLBACK_INVOKE(toolsett->imapaint.stencil, IDWALK_NOP);
-					CALLBACK_INVOKE(toolsett->imapaint.clone, IDWALK_NOP);
-					CALLBACK_INVOKE(toolsett->imapaint.canvas, IDWALK_NOP);
+
+					library_foreach_paint(&data, &toolsett->imapaint.paint);
+					CALLBACK_INVOKE(toolsett->imapaint.stencil, IDWALK_USER);
+					CALLBACK_INVOKE(toolsett->imapaint.clone, IDWALK_USER);
+					CALLBACK_INVOKE(toolsett->imapaint.canvas, IDWALK_USER);
+
 					if (toolsett->vpaint) {
-						CALLBACK_INVOKE(toolsett->vpaint->paint.brush, IDWALK_NOP);
-						CALLBACK_INVOKE(toolsett->vpaint->paint.palette, IDWALK_NOP);
+						library_foreach_paint(&data, &toolsett->vpaint->paint);
 					}
 					if (toolsett->wpaint) {
-						CALLBACK_INVOKE(toolsett->wpaint->paint.brush, IDWALK_NOP);
-						CALLBACK_INVOKE(toolsett->wpaint->paint.palette, IDWALK_NOP);
+						library_foreach_paint(&data, &toolsett->wpaint->paint);
 					}
 					if (toolsett->sculpt) {
-						CALLBACK_INVOKE(toolsett->sculpt->paint.brush, IDWALK_NOP);
-						CALLBACK_INVOKE(toolsett->sculpt->paint.palette, IDWALK_NOP);
+						library_foreach_paint(&data, &toolsett->sculpt->paint);
 						CALLBACK_INVOKE(toolsett->sculpt->gravity_object, IDWALK_NOP);
 					}
 					if (toolsett->uvsculpt) {
-						CALLBACK_INVOKE(toolsett->uvsculpt->paint.brush, IDWALK_NOP);
-						CALLBACK_INVOKE(toolsett->uvsculpt->paint.palette, IDWALK_NOP);
+						library_foreach_paint(&data, &toolsett->uvsculpt->paint);
 					}
 				}
 
@@ -398,6 +409,7 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
 					CALLBACK_INVOKE(object->pd->tex, IDWALK_USER);
 					CALLBACK_INVOKE(object->pd->f_source, IDWALK_NOP);
 				}
+				/* Note that ob->effect is deprecated, so no need to handle it here. */
 
 				if (object->pose) {
 					bPoseChannel *pchan;
@@ -608,6 +620,15 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
 					CALLBACK_INVOKE(psett->effector_weights->group, IDWALK_NOP);
 				}
 
+				if (psett->pd) {
+					CALLBACK_INVOKE(psett->pd->tex, IDWALK_USER);
+					CALLBACK_INVOKE(psett->pd->f_source, IDWALK_NOP);
+				}
+				if (psett->pd2) {
+					CALLBACK_INVOKE(psett->pd2->tex, IDWALK_USER);
+					CALLBACK_INVOKE(psett->pd2->f_source, IDWALK_NOP);
+				}
+
 				if (psett->boids) {
 					BoidState *state;
 					BoidRule *rule;
@@ -625,7 +646,6 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
 						}
 					}
 				}
-
 				break;
 			}
 
@@ -634,16 +654,23 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
 				MovieClip *clip = (MovieClip *) id;
 				MovieTracking *tracking = &clip->tracking;
 				MovieTrackingObject *object;
+				MovieTrackingTrack *track;
+				MovieTrackingPlaneTrack *plane_track;
 
 				CALLBACK_INVOKE(clip->gpd, IDWALK_USER);
-				for (object = tracking->objects.first; object; object = object->next) {
-					ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
-					MovieTrackingTrack *track;
 
-					for (track = tracksbase->first; track; track = track->next) {
+				for (track = tracking->tracks.first; track; track = track->next) {
+					CALLBACK_INVOKE(track->gpd, IDWALK_USER);
+				}
+				for (object = tracking->objects.first; object; object = object->next) {
+					for (track = object->tracks.first; track; track = track->next) {
 						CALLBACK_INVOKE(track->gpd, IDWALK_USER);
 					}
 				}
+
+				for (plane_track = tracking->plane_tracks.first; plane_track; plane_track = plane_track->next) {
+					CALLBACK_INVOKE(plane_track->image, IDWALK_USER);
+				}
 				break;
 			}
 
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 888e3aa..b11f309 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5619,7 +5619,6 @@ static void lib_link_scene(FileData *fd, Main *main)
 			for (base = sce->base.first; base; base = next) {
 				next = base->next;
 				
-				/* base->object= newlibadr_us(fd, sce->id.lib, base->object); */
 				base->object = newlibadr_us(fd, sce->id.lib, base->object);
 				
 				if (base->object == NULL) {




More information about the Bf-blender-cvs mailing list