Fix for missing visits of Freestyle-related ID data blocks in BKE_library_foreach_ID_...
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Fri, 6 Jun 2014 03:44:48 +0000 (12:44 +0900)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Fri, 6 Jun 2014 03:48:53 +0000 (12:48 +0900)
source/blender/blenkernel/intern/library_query.c

index e9bdc3679c12a6a445d644f0f03a12b83237fe5f..178209f52f4a5248bd2371e199ea0dc6b7468050 100644 (file)
@@ -47,6 +47,7 @@
 #include "DNA_mask_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_force.h"
+#include "DNA_scene_types.h"
 #include "DNA_sequence_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_speaker_types.h"
@@ -168,6 +169,7 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
                case ID_SCE:
                {
                        Scene *scene = (Scene *) id;
+                       SceneRenderLayer *srl;
                        Base *base;
 
                        CALLBACK_INVOKE(scene->camera, IDWALK_NOP);
@@ -178,6 +180,25 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
                        }
                        CALLBACK_INVOKE(scene->obedit, IDWALK_NOP);
 
+                       for (srl = scene->r.layers.first; srl; srl = srl->next) {
+                               FreestyleModuleConfig *fmc;
+                               FreestyleLineSet *fls;
+
+                               for (fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
+                                       if (fmc->script) {
+                                               CALLBACK_INVOKE(fmc->script, IDWALK_NOP);
+                                       }
+                               }
+                               for (fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) {
+                                       if (fls->group) {
+                                               CALLBACK_INVOKE(fls->group, IDWALK_NOP);
+                                       }
+                                       if (fls->linestyle) {
+                                               CALLBACK_INVOKE(fls->linestyle, IDWALK_NOP);
+                                       }
+                               }
+                       }
+
                        if (scene->ed) {
                                Sequence *seq;
                                SEQP_BEGIN(scene->ed, seq)
@@ -455,12 +476,38 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
                case ID_LS:
                {
                        FreestyleLineStyle *linestyle = (FreestyleLineStyle *) id;
+                       LineStyleModifier *m;
                        for (i = 0; i < MAX_MTEX; i++) {
                                if (linestyle->mtex[i]) {
                                        library_foreach_mtex(&data, linestyle->mtex[i]);
                                }
                        }
                        CALLBACK_INVOKE(linestyle->nodetree, IDWALK_NOP);
+
+                       for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) {
+                               if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
+                                       LineStyleColorModifier_DistanceFromObject *p = (LineStyleColorModifier_DistanceFromObject *)m;
+                                       if (p->target) {
+                                               CALLBACK_INVOKE(p->target, IDWALK_NOP);
+                                       }
+                               }
+                       }
+                       for (m = (LineStyleModifier *)linestyle->alpha_modifiers.first; m; m = m->next) {
+                               if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
+                                       LineStyleAlphaModifier_DistanceFromObject *p = (LineStyleAlphaModifier_DistanceFromObject *)m;
+                                       if (p->target) {
+                                               CALLBACK_INVOKE(p->target, IDWALK_NOP);
+                                       }
+                               }
+                       }
+                       for (m = (LineStyleModifier *)linestyle->thickness_modifiers.first; m; m = m->next) {
+                               if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
+                                       LineStyleThicknessModifier_DistanceFromObject *p = (LineStyleThicknessModifier_DistanceFromObject *)m;
+                                       if (p->target) {
+                                               CALLBACK_INVOKE(p->target, IDWALK_NOP);
+                                       }
+                               }
+                       }
                        break;
                }