Commit: 991d4f1c6b661d9a6b00e073d9a01c8a8a133b12
Author: Brecht Van Lommel
Date:   Thu Jun 21 16:30:34 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB991d4f1c6b661d9a6b00e073d9a01c8a8a133b12

Fix incorrect use of G.is_rendering for particles in some places.

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

M       source/blender/blenkernel/intern/dynamicpaint.c
M       source/blender/blenkernel/intern/effect.c
M       source/blender/blenkernel/intern/particle.c
M       source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M       source/blender/depsgraph/intern/depsgraph_build.cc

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

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index ed2566c9bb5..2b3ef91678f 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -5890,6 +5890,7 @@ static int dynamicPaint_doStep(
        PaintSurfaceData *sData = surface->data;
        PaintBakeData *bData = sData->bData;
        DynamicPaintCanvasSettings *canvas = surface->canvas;
+       const bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
        int ret = 1;
 
        if (sData->total_points < 1)
@@ -5960,7 +5961,7 @@ static int dynamicPaint_doStep(
                                        /* Apply brush on the surface depending 
on it's collision type */
                                        if (brush->psys && brush->psys->part &&
                                            ELEM(brush->psys->part->type, 
PART_EMITTER, PART_FLUID) &&
-                                           psys_check_enabled(brushObj, 
brush->psys, G.is_rendering))
+                                           psys_check_enabled(brushObj, 
brush->psys, for_render))
                                        {
                                                /* Paint a particle system */
                                                
BKE_animsys_evaluate_animdata(depsgraph, scene, &brush->psys->part->id, 
brush->psys->part->adt,
diff --git a/source/blender/blenkernel/intern/effect.c 
b/source/blender/blenkernel/intern/effect.c
index 7e506570b7e..c155fbc1d97 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -188,8 +188,9 @@ static void add_object_to_effectors(ListBase **effectors, 
struct Depsgraph *deps
 static void add_particles_to_effectors(ListBase **effectors, struct Depsgraph 
*depsgraph, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem 
*psys, ParticleSystem *psys_src, bool for_simulation)
 {
        ParticleSettings *part= psys->part;
+       const bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
 
-       if ( !psys_check_enabled(ob, psys, G.is_rendering) )
+       if ( !psys_check_enabled(ob, psys, for_render) )
                return;
 
        if ( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
@@ -215,7 +216,9 @@ ListBase *pdInitEffectors(
         struct Depsgraph *depsgraph, Scene *scene, Object *ob_src, 
ParticleSystem *psys_src,
         EffectorWeights *weights, bool for_simulation)
 {
-       Base *base = BKE_collection_or_layer_objects(depsgraph, scene, NULL, 
weights->group);
+       /* For dependency building, we get objects from the scene.
+        * For simulation, we get objects from the depsgraph. */
+       Base *base = BKE_collection_or_layer_objects((for_simulation) ? 
depsgraph : NULL, scene, NULL, weights->group);
        ListBase *effectors = NULL;
 
        for (; base; base = base->next) {
diff --git a/source/blender/blenkernel/intern/particle.c 
b/source/blender/blenkernel/intern/particle.c
index 693d6ac587e..494878bcc8e 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -256,7 +256,8 @@ struct LatticeDeformData 
*psys_create_lattice_deform_data(ParticleSimulationData
        if (psys_in_edit_mode(sim->depsgraph, sim->psys) == 0) {
                Object *lattice = NULL;
                ModifierData *md = (ModifierData *)psys_get_modifier(sim->ob, 
sim->psys);
-               int mode = G.is_rendering ? eModifierMode_Render : 
eModifierMode_Realtime;
+               bool for_render = DEG_get_mode(sim->depsgraph) == 
DAG_EVAL_RENDER;
+               int mode = for_render ? eModifierMode_Render : 
eModifierMode_Realtime;
 
                for (; md; md = md->next) {
                        if (md->type == eModifierType_Lattice) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 0c7e13197a6..d36e7eceb88 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -333,7 +333,8 @@ void DepsgraphRelationBuilder::add_forcefield_relations(
         bool add_absorption,
         const char *name)
 {
-       ListBase *effectors = pdInitEffectors(NULL, scene, object, psys, eff, 
false);
+       ::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph*>(graph_);
+       ListBase *effectors = pdInitEffectors(depsgraph, scene, object, psys, 
eff, false);
        if (effectors == NULL) {
                return;
        }
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc 
b/source/blender/depsgraph/intern/depsgraph_build.cc
index c39f6222a13..9c03e8c4ca3 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -356,7 +356,8 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
                                   int skip_forcefield,
                                   const char *name)
 {
-       ListBase *effectors = pdInitEffectors(NULL, scene, object, NULL, 
effector_weights, false);
+       Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
+       ListBase *effectors = pdInitEffectors(depsgraph, scene, object, NULL, 
effector_weights, false);
        if (effectors == NULL) {
                return;
        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to