diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-23 00:53:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-23 00:54:35 +0300 |
commit | 29448bd99bb05ae61e4d540981026bab87702f90 (patch) | |
tree | ce5797a238562438cfb28832be7197af2f3ee654 | |
parent | 7547c6a250cd6f36c9894605b822380a1261febf (diff) |
Fix T48658: Cycles render & render preview corrupts particles
Replaces `G.is_rendering` with `use_render_params` argument.
This is needed for Cycles, which attempts to restore render-preview settings from particles,
after it gets its own particle data, but fails to restore because
`G.is_rendering` was being checked in psys_cache_paths (and other places).
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_update.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 32 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 36 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 2 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_particlesystem.c | 6 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 4 | ||||
-rw-r--r-- | source/blender/render/intern/source/pointdensity.c | 2 |
15 files changed, 66 insertions, 59 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index e17fb9f7a02..5daa94c4302 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -148,7 +148,8 @@ typedef struct ParticleThreadContext { struct ParticleData *tpars; /* path caching */ - int editupdate, between, segments, extra_segments; + bool editupdate; + int between, segments, extra_segments; int totchild, totparent, parent_pass; float cfra; @@ -293,7 +294,7 @@ void psys_set_current_num(Object *ob, int index); struct LatticeDeformData *psys_create_lattice_deform_data(struct ParticleSimulationData *sim); bool psys_in_edit_mode(struct Scene *scene, struct ParticleSystem *psys); -bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys); +bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, const bool use_render_params); bool psys_check_edited(struct ParticleSystem *psys); void psys_check_group_weights(struct ParticleSettings *part); @@ -327,11 +328,11 @@ void BKE_particlesettings_make_local(struct ParticleSettings *part); void psys_reset(struct ParticleSystem *psys, int mode); -void psys_find_parents(struct ParticleSimulationData *sim); +void psys_find_parents(struct ParticleSimulationData *sim, const bool use_render_params); -void psys_cache_paths(struct ParticleSimulationData *sim, float cfra); -void psys_cache_edit_paths(struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra); -void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, int editupdate); +void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, const bool use_render_params); +void psys_cache_edit_paths(struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, const bool use_render_params); +void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, const bool editupdate, const bool use_render_params); int do_guides(struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int pa_num, float time); void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors); float psys_get_timestep(struct ParticleSimulationData *sim); @@ -379,7 +380,7 @@ void psys_check_boid_data(struct ParticleSystem *psys); void psys_get_birth_coords(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra); -void particle_system_update(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys); +void particle_system_update(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, const bool use_render_params); /* Callback format for performing operations on ID-pointers for particle systems */ typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **idpoin, void *userdata, int cd_flag); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 14c230e4a45..8ea65bf92c1 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -770,7 +770,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Main *bmain, Sc dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation"); - if (!psys_check_enabled(ob, psys)) + if (!psys_check_enabled(ob, psys, G.is_rendering)) continue; if (ELEM(part->phystype, PART_PHYS_KEYED, PART_PHYS_BOIDS)) { @@ -2285,7 +2285,7 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob) ParticleSystem *psys = ob->particlesystem.first; for (; psys; psys = psys->next) { - if (psys_check_enabled(ob, psys)) { + if (psys_check_enabled(ob, psys, G.is_rendering)) { ob->recalc |= OB_RECALC_DATA; break; } diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index cc495b3da7a..6207217f2c7 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -5503,7 +5503,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su if (brush->collision == MOD_DPAINT_COL_PSYS) { if (brush->psys && brush->psys->part && ELEM(brush->psys->part->type, PART_EMITTER, PART_FLUID) && - psys_check_enabled(brushObj, brush->psys)) + psys_check_enabled(brushObj, brush->psys, G.is_rendering)) { /* Paint a particle system */ BKE_animsys_evaluate_animdata(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 a8268c03d95..5090e46f1fc 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -179,7 +179,7 @@ static void add_particles_to_effectors(ListBase **effectors, Scene *scene, Effec { ParticleSettings *part= psys->part; - if ( !psys_check_enabled(ob, psys) ) + if ( !psys_check_enabled(ob, psys, G.is_rendering) ) return; if ( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0) diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 63c37fddc60..c03f7c2c0ae 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -851,7 +851,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem if (part == NULL) return; - if (!psys_check_enabled(par, psys)) + if (!psys_check_enabled(par, psys, (ctx->eval_ctx->mode == DAG_EVAL_RENDER))) return; if (!for_render) diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 2468cb8b697..6d41c5c2975 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -269,7 +269,7 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx, psys_changed_type(ob, psys); } - if (psys_check_enabled(ob, psys)) { + if (psys_check_enabled(ob, psys, eval_ctx->mode == DAG_EVAL_RENDER)) { /* check use of dupli objects here */ if (psys->part && (psys->part->draw_as == PART_DRAW_REND || eval_ctx->mode == DAG_EVAL_RENDER) && ((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob) || @@ -278,7 +278,7 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx, ob->transflag |= OB_DUPLIPARTS; } - particle_system_update(scene, ob, psys); + particle_system_update(scene, ob, psys, (eval_ctx->mode == DAG_EVAL_RENDER)); psys = psys->next; } else if (psys->flag & PSYS_DELETE) { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 633227d68f3..d1f5afa26a6 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -283,7 +283,7 @@ bool psys_in_edit_mode(Scene *scene, ParticleSystem *psys) { return (scene->basact && (scene->basact->object->mode & OB_MODE_PARTICLE_EDIT) && psys == psys_get_current((scene->basact)->object) && (psys->edit || psys->pointcache->edit) && !psys->renderdata); } -bool psys_check_enabled(Object *ob, ParticleSystem *psys) +bool psys_check_enabled(Object *ob, ParticleSystem *psys, const bool use_render_params) { ParticleSystemModifierData *psmd; @@ -291,7 +291,7 @@ bool psys_check_enabled(Object *ob, ParticleSystem *psys) return 0; psmd = psys_get_modifier(ob, psys); - if (psys->renderdata || G.is_rendering) { + if (psys->renderdata || use_render_params) { if (!(psmd->modifier.mode & eModifierMode_Render)) return 0; } @@ -2007,7 +2007,7 @@ float *psys_cache_vgroup(DerivedMesh *dm, ParticleSystem *psys, int vgroup) } return vg; } -void psys_find_parents(ParticleSimulationData *sim) +void psys_find_parents(ParticleSimulationData *sim, const bool use_render_params) { ParticleSystem *psys = sim->psys; ParticleSettings *part = sim->psys->part; @@ -2019,7 +2019,7 @@ void psys_find_parents(ParticleSimulationData *sim) int from = PART_FROM_FACE; totparent = (int)(totchild * part->parents * 0.3f); - if ((sim->psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr) + if ((sim->psys->renderdata || use_render_params) && part->child_nbr && part->ren_child_nbr) totparent *= (float)part->child_nbr / (float)part->ren_child_nbr; /* hard limit, workaround for it being ignored above */ @@ -2050,7 +2050,9 @@ void psys_find_parents(ParticleSimulationData *sim) BLI_kdtree_free(tree); } -static bool psys_thread_context_init_path(ParticleThreadContext *ctx, ParticleSimulationData *sim, Scene *scene, float cfra, int editupdate) +static bool psys_thread_context_init_path( + ParticleThreadContext *ctx, ParticleSimulationData *sim, Scene *scene, + float cfra, const bool editupdate, const bool use_render_params) { ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; @@ -2064,7 +2066,7 @@ static bool psys_thread_context_init_path(ParticleThreadContext *ctx, ParticleSi if (psys_in_edit_mode(scene, psys)) { ParticleEditSettings *pset = &scene->toolsettings->particle; - if ((psys->renderdata == 0 && G.is_rendering == 0) && (psys->edit == NULL || pset->flag & PE_DRAW_PART) == 0) + if ((psys->renderdata == 0 && use_render_params == 0) && (psys->edit == NULL || pset->flag & PE_DRAW_PART) == 0) totchild = 0; segments = 1 << pset->draw_step; @@ -2073,14 +2075,14 @@ static bool psys_thread_context_init_path(ParticleThreadContext *ctx, ParticleSi if (totchild && part->childtype == PART_CHILD_FACES) { totparent = (int)(totchild * part->parents * 0.3f); - if ((psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr) + if ((psys->renderdata || use_render_params) && part->child_nbr && part->ren_child_nbr) totparent *= (float)part->child_nbr / (float)part->ren_child_nbr; /* part->parents could still be 0 so we can't test with totparent */ between = 1; } - if (psys->renderdata || G.is_rendering) + if (psys->renderdata || use_render_params) segments = 1 << part->ren_step; else { totchild = (int)((float)totchild * (float)part->disp / 100.0f); @@ -2417,7 +2419,9 @@ static void exec_child_path_cache(TaskPool * __restrict UNUSED(pool), void *task } } -void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupdate) +void psys_cache_child_paths( + ParticleSimulationData *sim, float cfra, + const bool editupdate, const bool use_render_params) { TaskScheduler *task_scheduler; TaskPool *task_pool; @@ -2430,7 +2434,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd return; /* create a task pool for child path tasks */ - if (!psys_thread_context_init_path(&ctx, sim, sim->scene, cfra, editupdate)) + if (!psys_thread_context_init_path(&ctx, sim, sim->scene, cfra, editupdate, use_render_params)) return; task_scheduler = BLI_task_scheduler_get(); @@ -2522,7 +2526,7 @@ static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCache * - Useful for making use of opengl vertex arrays for super fast strand drawing. * - Makes child strands possible and creates them too into the cache. * - Cached path data is also used to determine cut position for the editmode tool. */ -void psys_cache_paths(ParticleSimulationData *sim, float cfra) +void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_render_params) { PARTICLE_PSMD; ParticleEditSettings *pset = &sim->scene->toolsettings->particle; @@ -2546,7 +2550,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4]; float rotmat[3][3]; int k; - int segments = (int)pow(2.0, (double)((psys->renderdata || G.is_rendering) ? part->ren_step : part->draw_step)); + int segments = (int)pow(2.0, (double)((psys->renderdata || use_render_params) ? part->ren_step : part->draw_step)); int totpart = psys->totpart; float length, vec[3]; float *vg_effector = NULL; @@ -2725,7 +2729,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) if (vg_length) MEM_freeN(vg_length); } -void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cfra) +void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params) { ParticleCacheKey *ca, **cache = edit->pathcache; ParticleEditSettings *pset = &scene->toolsettings->particle; @@ -2921,7 +2925,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf sim.psys = psys; sim.psmd = psys_get_modifier(ob, psys); - psys_cache_child_paths(&sim, cfra, 1); + psys_cache_child_paths(&sim, cfra, true, use_render_params); } /* clear recalc flag if set here */ diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 4fa80723df8..c3f47fac852 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2885,7 +2885,7 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa /* Hair */ /************************************************/ /* check if path cache or children need updating and do it if needed */ -static void psys_update_path_cache(ParticleSimulationData *sim, float cfra) +static void psys_update_path_cache(ParticleSimulationData *sim, float cfra, const bool use_render_params) { ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; @@ -2909,7 +2909,7 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra) distribute_particles(sim, PART_FROM_CHILD); if (part->childtype==PART_CHILD_FACES && part->parents != 0.0f) - psys_find_parents(sim); + psys_find_parents(sim, use_render_params); } } else @@ -2947,7 +2947,7 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra) } if (!skip) { - psys_cache_paths(sim, cfra); + psys_cache_paths(sim, cfra, use_render_params); /* for render, child particle paths are computed on the fly */ if (part->childtype) { @@ -2957,7 +2957,7 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra) skip = 1; if (!skip) - psys_cache_child_paths(sim, cfra, 0); + psys_cache_child_paths(sim, cfra, 0, use_render_params); } } else if (psys->pathcache) @@ -3193,7 +3193,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) /* restore cloth effector weights */ psys->clmd->sim_parms->effector_weights = clmd_effweights; } -static void hair_step(ParticleSimulationData *sim, float cfra) +static void hair_step(ParticleSimulationData *sim, float cfra, const bool use_render_params) { ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; @@ -3225,7 +3225,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra) /* following lines were removed r29079 but cause bug [#22811], see report for details */ psys_update_effectors(sim); - psys_update_path_cache(sim, cfra); + psys_update_path_cache(sim, cfra, use_render_params); psys->flag |= PSYS_HAIR_UPDATED; } @@ -3732,7 +3732,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra) } } -static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) +static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra), const bool use_render_params) { ParticleSystem *psys = sim->psys; if (psys->particles) { @@ -3775,7 +3775,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) } gzread(gzf, &totpart, sizeof(totpart)); - totpart = (G.is_rendering)?totpart:(part->disp*totpart) / 100; + totpart = (use_render_params) ? totpart:(part->disp*totpart) / 100; part->totpart= totpart; part->sta=part->end = 1.0f; @@ -3836,6 +3836,8 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) } // fluid sim particles done } +#else + UNUSED_VARS(use_render_params); #endif // WITH_MOD_FLUID } @@ -3857,7 +3859,7 @@ static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNU * 2. Check cache (if used) and return if frame is cached * 3. Do dynamics * 4. Save to cache */ -static void system_step(ParticleSimulationData *sim, float cfra) +static void system_step(ParticleSimulationData *sim, float cfra, const bool use_render_params) { ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; @@ -3919,7 +3921,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) if (ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) { cached_step(sim, cfra); update_children(sim); - psys_update_path_cache(sim, cfra); + psys_update_path_cache(sim, cfra, use_render_params); BKE_ptcache_validate(cache, (int)cache_cfra); @@ -4137,7 +4139,7 @@ static int hair_needs_recalc(ParticleSystem *psys) /* main particle update call, checks that things are ok on the large scale and * then advances in to actual particle calculations depending on particle type */ -void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) +void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys, const bool use_render_params) { ParticleSimulationData sim= {0}; ParticleSettings *part = psys->part; @@ -4146,7 +4148,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) /* drawdata is outdated after ANY change */ if (psys->pdd) psys->pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED; - if (!psys_check_enabled(ob, psys)) + if (!psys_check_enabled(ob, psys, use_render_params)) return; cfra= BKE_scene_frame_get(scene); @@ -4215,7 +4217,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) hcfra=100.0f*(float)i/(float)psys->part->hair_step; if ((part->flag & PART_HAIR_REGROW)==0) BKE_animsys_evaluate_animdata(scene, &part->id, part->adt, hcfra, ADT_RECALC_ANIM); - system_step(&sim, hcfra); + system_step(&sim, hcfra, use_render_params); psys->cfra = hcfra; psys->recalc = 0; save_hair(&sim, hcfra); @@ -4228,12 +4230,12 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) psys->flag |= PSYS_HAIR_DONE; if (psys->flag & PSYS_HAIR_DONE) - hair_step(&sim, cfra); + hair_step(&sim, cfra, use_render_params); break; } case PART_FLUID: { - particles_fluid_step(&sim, (int)cfra); + particles_fluid_step(&sim, (int)cfra, use_render_params); break; } default: @@ -4280,14 +4282,14 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) if (part->phystype == PART_PHYS_KEYED) { psys_count_keyed_targets(&sim); set_keyed_keys(&sim); - psys_update_path_cache(&sim,(int)cfra); + psys_update_path_cache(&sim, (int)cfra, use_render_params); } break; } default: { /* the main dynamic particle system step */ - system_step(&sim, cfra); + system_step(&sim, cfra, use_render_params); break; } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index cd706c87ae0..af0b3f8b70f 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1075,7 +1075,7 @@ void DepsgraphRelationBuilder::build_particles(Scene *scene, Object *ob) OperationKey psys_key(&ob->id, DEPSNODE_TYPE_EVAL_PARTICLES, DEG_OPCODE_PSYS_EVAL, psys->name); /* XXX: if particle system is later re-enabled, we must do full rebuild? */ - if (!psys_check_enabled(ob, psys)) + if (!psys_check_enabled(ob, psys, G.is_rendering)) continue; /* TODO(sergey): Are all particle systems depends on time? diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 8d351826b86..30c102b70c5 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1173,7 +1173,7 @@ static void PE_update_selection(Scene *scene, Object *ob, int useflag) } } - psys_cache_edit_paths(scene, ob, edit, CFRA); + psys_cache_edit_paths(scene, ob, edit, CFRA, G.is_rendering); /* disable update flag */ @@ -1289,7 +1289,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag) PE_hide_keys_time(scene, edit, CFRA); /* regenerate path caches */ - psys_cache_edit_paths(scene, ob, edit, CFRA); + psys_cache_edit_paths(scene, ob, edit, CFRA, G.is_rendering); /* disable update flag */ LOOP_POINTS { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1999ff7a6cf..76c19fbb8d3 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5018,7 +5018,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv unsigned char tcol[4] = {0, 0, 0, 255}; /* 1. */ - if (part == NULL || !psys_check_enabled(ob, psys)) + if (part == NULL || !psys_check_enabled(ob, psys, G.is_rendering)) return; if (pars == NULL) return; @@ -5726,7 +5726,7 @@ static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit /* create path and child path cache if it doesn't exist already */ if (edit->pathcache == NULL) - psys_cache_edit_paths(scene, ob, edit, CFRA); + psys_cache_edit_paths(scene, ob, edit, CFRA, G.is_rendering); } static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 3f401a29945..1f9418f8353 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -341,7 +341,7 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o totchild = (int)((float)particlesystem->totchild * (float)(part->disp) / 100.0f); } - if (part == NULL || pars == NULL || !psys_check_enabled(object, particlesystem)) + if (part == NULL || pars == NULL || !psys_check_enabled(object, particlesystem, particlesystem->renderdata != NULL)) return; if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || part->ren_as == PART_DRAW_NOT) @@ -586,7 +586,7 @@ static void rna_ParticleSystem_set_resolution(ParticleSystem *particlesystem, Sc psys_render_set(object, particlesystem, mat, mat, 1, 1, 0.f); psmd->flag &= ~eParticleSystemFlag_psys_updated; - particle_system_update(scene, object, particlesystem); + particle_system_update(scene, object, particlesystem, true); } else { ParticleSystemModifierData *psmd = psys_get_modifier(object, particlesystem); @@ -596,7 +596,7 @@ static void rna_ParticleSystem_set_resolution(ParticleSystem *particlesystem, Sc } psmd->flag &= ~eParticleSystemFlag_psys_updated; - particle_system_update(scene, object, particlesystem); + particle_system_update(scene, object, particlesystem, false); } } diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 4791e41d433..d8cccca415c 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -101,7 +101,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int UNUSED(numVerts), - ModifierApplyFlag UNUSED(flag)) + ModifierApplyFlag flag) { DerivedMesh *dm = derivedData; ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md; @@ -114,7 +114,7 @@ static void deformVerts(ModifierData *md, Object *ob, else return; - if (!psys_check_enabled(ob, psys)) + if (!psys_check_enabled(ob, psys, (flag & MOD_APPLY_RENDER) != 0)) return; if (dm == NULL) { @@ -186,7 +186,7 @@ static void deformVerts(ModifierData *md, Object *ob, if (!(ob->transflag & OB_NO_PSYS_UPDATE)) { psmd->flag &= ~eParticleSystemFlag_psys_updated; - particle_system_update(md->scene, ob, psys); + particle_system_update(md->scene, ob, psys, (flag & MOD_APPLY_RENDER) != 0); psmd->flag |= eParticleSystemFlag_psys_updated; } } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index b6ee88de290..8c847773d75 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1330,7 +1330,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem part=psys->part; pars=psys->particles; - if (part==NULL || pars==NULL || !psys_check_enabled(ob, psys)) + if (part==NULL || pars==NULL || !psys_check_enabled(ob, psys, G.is_rendering)) return 0; if (part->ren_as==PART_DRAW_OB || part->ren_as==PART_DRAW_GR || part->ren_as==PART_DRAW_NOT) @@ -4697,7 +4697,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * if (ob->particlesystem.first) { psysindex= 1; for (psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) { - if (!psys_check_enabled(ob, psys)) + if (!psys_check_enabled(ob, psys, G.is_rendering)) continue; obr= RE_addRenderObject(re, ob, par, index, psysindex, ob->lay); diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 59aaad661c9..e4da4302efe 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -211,7 +211,7 @@ static void pointdensity_cache_psys(Scene *scene, CD_MASK_BAREMESH | CD_MASK_MTFACE | CD_MASK_MCOL); } - if (!psys_check_enabled(ob, psys)) { + if (!psys_check_enabled(ob, psys, use_render_params)) { psys_render_restore(ob, psys); return; } |