Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 4 May 2018 09:51:07 +0000 (11:51 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 4 May 2018 09:53:52 +0000 (11:53 +0200)
1  2 
source/blender/render/intern/source/pipeline.c

@@@ -1234,96 -2058,103 +1234,99 @@@ bool RE_allow_render_generic_object(Obj
  #define DEPSGRAPH_WORKAROUND_HACK
  
  #ifdef DEPSGRAPH_WORKAROUND_HACK
- static void tag_dependend_objects_for_render(Scene *scene, int UNUSED(renderlay))
+ static void tag_dependend_object_for_render(Scene *scene, Object *object);
+ static void tag_dependend_group_for_render(Scene *scene, Group *group)
  {
-       FOREACH_OBJECT_RENDERABLE_BEGIN(scene, object)
-       {
-               if (object->type == OB_MESH) {
-                       if (RE_allow_render_generic_object(object)) {
-                               ModifierData *md;
-                               VirtualModifierData virtualModifierData;
-                               for (md = modifiers_getVirtualModifierList(object, &virtualModifierData);
-                                    md;
-                                    md = md->next)
-                               {
-                                       if (!modifier_isEnabled(scene, md, eModifierMode_Render)) {
-                                               continue;
-                                       }
+       if (group->id.tag & LIB_TAG_DOIT) {
+               return;
+       }
+       group->id.tag |= LIB_TAG_DOIT;
  
-                                       if (md->type == eModifierType_Boolean) {
-                                               BooleanModifierData *bmd = (BooleanModifierData *)md;
-                                               if (bmd->object && bmd->object->type == OB_MESH) {
-                                                       DEG_id_tag_update(&bmd->object->id, OB_RECALC_DATA);
-                                               }
+       for (GroupObject *go = group->gobject.first; go != NULL; go = go->next) {
+               Object *object = go->ob;
+               tag_dependend_object_for_render(scene, object);
+       }
+ }
+ static void tag_dependend_object_for_render(Scene *scene, Object *object)
+ {
+       if (object->type == OB_MESH) {
+               if (RE_allow_render_generic_object(object)) {
+                       ModifierData *md;
+                       VirtualModifierData virtualModifierData;
+                       if (object->particlesystem.first) {
 -                              DAG_id_tag_update(&object->id, OB_RECALC_DATA);
++                              DEG_id_tag_update(&object->id, OB_RECALC_DATA);
+                       }
+                       for (md = modifiers_getVirtualModifierList(object, &virtualModifierData);
+                            md;
+                            md = md->next)
+                       {
+                               if (!modifier_isEnabled(scene, md, eModifierMode_Render)) {
+                                       continue;
+                               }
+                               if (md->type == eModifierType_Boolean) {
+                                       BooleanModifierData *bmd = (BooleanModifierData *)md;
+                                       if (bmd->object && bmd->object->type == OB_MESH) {
 -                                              DAG_id_tag_update(&bmd->object->id, OB_RECALC_DATA);
++                                              DEG_id_tag_update(&bmd->object->id, OB_RECALC_DATA);
                                        }
-                                       else if (md->type == eModifierType_Array) {
-                                               ArrayModifierData *amd = (ArrayModifierData *)md;
-                                               if (amd->start_cap && amd->start_cap->type == OB_MESH) {
-                                                       DEG_id_tag_update(&amd->start_cap->id, OB_RECALC_DATA);
-                                               }
-                                               if (amd->end_cap && amd->end_cap->type == OB_MESH) {
-                                                       DEG_id_tag_update(&amd->end_cap->id, OB_RECALC_DATA);
-                                               }
+                               }
+                               else if (md->type == eModifierType_Array) {
+                                       ArrayModifierData *amd = (ArrayModifierData *)md;
+                                       if (amd->start_cap && amd->start_cap->type == OB_MESH) {
 -                                              DAG_id_tag_update(&amd->start_cap->id, OB_RECALC_DATA);
++                                              DEG_id_tag_update(&amd->start_cap->id, OB_RECALC_DATA);
                                        }
-                                       else if (md->type == eModifierType_Shrinkwrap) {
-                                               ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
-                                               if (smd->target  && smd->target->type == OB_MESH) {
-                                                       DEG_id_tag_update(&smd->target->id, OB_RECALC_DATA);
-                                               }
+                                       if (amd->end_cap && amd->end_cap->type == OB_MESH) {
 -                                              DAG_id_tag_update(&amd->end_cap->id, OB_RECALC_DATA);
++                                              DEG_id_tag_update(&amd->end_cap->id, OB_RECALC_DATA);
                                        }
-                                       else if (md->type == eModifierType_ParticleSystem) {
-                                               ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
-                                               ParticleSystem *psys = psmd->psys;
-                                               ParticleSettings *part = psys->part;
-                                               switch (part->ren_as) {
-                                                       case PART_DRAW_OB:
-                                                               if (part->dup_ob != NULL) {
-                                                                       DEG_id_tag_update(&part->dup_ob->id, OB_RECALC_DATA);
-                                                               }
-                                                               break;
-                                                       case PART_DRAW_GR:
-                                                               if (part->dup_group != NULL) {
-                                                                       for (GroupObject *go = part->dup_group->gobject.first;
-                                                                            go != NULL;
-                                                                            go = go->next)
-                                                                       {
-                                                                               DEG_id_tag_update(&go->ob->id, OB_RECALC_DATA);
-                                                                       }
+                               }
+                               else if (md->type == eModifierType_Shrinkwrap) {
+                                       ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
+                                       if (smd->target  && smd->target->type == OB_MESH) {
 -                                              DAG_id_tag_update(&smd->target->id, OB_RECALC_DATA);
++                                              DEG_id_tag_update(&smd->target->id, OB_RECALC_DATA);
+                                       }
+                               }
+                               else if (md->type == eModifierType_ParticleSystem) {
+                                       ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
+                                       ParticleSystem *psys = psmd->psys;
+                                       ParticleSettings *part = psys->part;
+                                       switch (part->ren_as) {
+                                               case PART_DRAW_OB:
+                                                       if (part->dup_ob != NULL) {
 -                                                              DAG_id_tag_update(&part->dup_ob->id, OB_RECALC_DATA);
++                                                              DEG_id_tag_update(&part->dup_ob->id, OB_RECALC_DATA);
+                                                       }
+                                                       break;
+                                               case PART_DRAW_GR:
+                                                       if (part->dup_group != NULL) {
+                                                               for (GroupObject *go = part->dup_group->gobject.first;
+                                                                    go != NULL;
+                                                                    go = go->next)
+                                                               {
 -                                                                      DAG_id_tag_update(&go->ob->id, OB_RECALC_DATA);
++                                                                      DEG_id_tag_update(&go->ob->id, OB_RECALC_DATA);
                                                                }
-                                                               break;
-                                               }
+                                                       }
+                                                       break;
                                        }
                                }
                        }
                }
        }
-       FOREACH_OBJECT_RENDERABLE_END;
+       if (object->dup_group != NULL) {
+               tag_dependend_group_for_render(scene, object->dup_group);
+       }
  }
- #endif
  
- #define DEPSGRAPH_WORKAROUND_GROUP_HACK
- #ifdef DEPSGRAPH_WORKAROUND_GROUP_HACK
- /**
-  * Make sure the COLLECTION_VIEWPORT / COLLECTION_RENDER is considered
-  * for the collections visibility.
-  *
-  * This won't be needed anymore once we have depsgraph per render engine.
-  */
- static void tag_groups_for_render(Render *re)
 -static void tag_dependend_objects_for_render(Main *bmain, Scene *scene, int renderlay)
++static void tag_dependend_objects_for_render(Main *bmain, Scene *scene)
  {
-       for (Group *group = re->main->group.first; group; group = group->id.next) {
-               DEG_id_tag_update(&group->id, 0);
-       }
- #ifdef WITH_FREESTYLE
-       if (re->freestyle_bmain) {
-               for (Group *group = re->freestyle_bmain->group.first; group; group = group->id.next) {
-                       DEG_id_tag_update(&group->id, 0);
-               }
 -      Scene *sce_iter;
 -      Base *base;
+       BKE_main_id_tag_idcode(bmain, ID_GR, LIB_TAG_DOIT, false);
 -      for (SETLOOPER(scene, sce_iter, base)) {
 -              Object *object = base->object;
 -              if ((base->lay & renderlay) == 0) {
 -                      continue;
 -              }
++      FOREACH_OBJECT_RENDERABLE_BEGIN(scene, object)
++      {
+               tag_dependend_object_for_render(scene, object);
        }
- #endif
++      FOREACH_OBJECT_RENDERABLE_END;
  }
  #endif
  
@@@ -1331,14 -2162,14 +1334,11 @@@ static void tag_scenes_for_render(Rende
  {
        bNode *node;
        Scene *sce;
--#ifdef DEPSGRAPH_WORKAROUND_HACK
--      int renderlay = re->lay;
--#endif
        
        for (sce = re->main->scene.first; sce; sce = sce->id.next) {
                sce->id.tag &= ~LIB_TAG_DOIT;
  #ifdef DEPSGRAPH_WORKAROUND_HACK
-               tag_dependend_objects_for_render(sce, renderlay);
 -              tag_dependend_objects_for_render(re->main, sce, renderlay);
++              tag_dependend_objects_for_render(re->main, sce);
  #endif
        }
        
                for (sce = re->freestyle_bmain->scene.first; sce; sce = sce->id.next) {
                        sce->id.tag &= ~LIB_TAG_DOIT;
  #ifdef DEPSGRAPH_WORKAROUND_HACK
-                       tag_dependend_objects_for_render(sce, renderlay);
 -                      tag_dependend_objects_for_render(re->freestyle_bmain, sce, renderlay);
++                      tag_dependend_objects_for_render(re->freestyle_bmain, sce);
  #endif
                }
        }
        if (RE_GetCamera(re) && composite_needs_render(re->scene, 1)) {
                re->scene->id.tag |= LIB_TAG_DOIT;
  #ifdef DEPSGRAPH_WORKAROUND_HACK
-               tag_dependend_objects_for_render(re->scene, renderlay);
 -              tag_dependend_objects_for_render(re->main, re->scene, renderlay);
++              tag_dependend_objects_for_render(re->main, re->scene);
  #endif
        }
        
                                                        node->flag |= NODE_TEST;
                                                        node->id->tag |= LIB_TAG_DOIT;
  #ifdef DEPSGRAPH_WORKAROUND_HACK
-                                                       tag_dependend_objects_for_render(scene, renderlay);
 -                                                      tag_dependend_objects_for_render(re->main, scene, renderlay);
++                                                      tag_dependend_objects_for_render(re->main, scene);
  #endif
                                                }
                                        }