Object Mode: Use eval_ctx mode for drawing, paint & modifiers

This commit is contained in:
2018-02-06 17:06:20 +11:00
parent ef11113399
commit c7fecab2ef
31 changed files with 453 additions and 302 deletions

View File

@@ -252,7 +252,7 @@ struct LatticeDeformData *psys_create_lattice_deform_data(ParticleSimulationData
{
struct LatticeDeformData *lattice_deform_data = NULL;
if (psys_in_edit_mode(sim->eval_ctx->view_layer, sim->psys) == 0) {
if (psys_in_edit_mode(sim->eval_ctx, sim->eval_ctx->view_layer, 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;
@@ -289,10 +289,10 @@ void psys_enable_all(Object *ob)
psys->flag &= ~PSYS_DISABLED;
}
bool psys_in_edit_mode(ViewLayer *view_layer, ParticleSystem *psys)
bool psys_in_edit_mode(const EvaluationContext *eval_ctx, ViewLayer *view_layer, ParticleSystem *psys)
{
return (view_layer->basact &&
(view_layer->basact->object->mode & OB_MODE_PARTICLE_EDIT) &&
(eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT) &&
psys == psys_get_current((view_layer->basact)->object) &&
(psys->edit || psys->pointcache->edit) &&
!psys->renderdata);
@@ -2098,7 +2098,7 @@ static bool psys_thread_context_init_path(
psys_thread_context_init(ctx, sim);
/*---start figuring out what is actually wanted---*/
if (psys_in_edit_mode(sim->eval_ctx->view_layer, psys)) {
if (psys_in_edit_mode(sim->eval_ctx, sim->eval_ctx->view_layer, psys)) {
ParticleEditSettings *pset = &scene->toolsettings->particle;
if ((psys->renderdata == 0 && use_render_params == 0) && (psys->edit == NULL || pset->flag & PE_DRAW_PART) == 0)
@@ -2187,7 +2187,7 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp
ParticleSystem *psys = ctx->sim.psys;
ParticleSettings *part = psys->part;
ParticleCacheKey **cache = psys->childcache;
ParticleCacheKey **pcache = psys_in_edit_mode(ctx->sim.eval_ctx->view_layer, psys) && psys->edit ? psys->edit->pathcache : psys->pathcache;
ParticleCacheKey **pcache = psys_in_edit_mode(ctx->sim.eval_ctx, ctx->sim.eval_ctx->view_layer, psys) && psys->edit ? psys->edit->pathcache : psys->pathcache;
ParticleCacheKey *child, *key[4];
ParticleTexture ptex;
float *cpa_fuv = 0, *par_rot = 0, rot[4];
@@ -2596,7 +2596,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
if ((psys->flag & PSYS_HAIR_DONE || psys->flag & PSYS_KEYED || psys->pointcache) == 0)
return;
if (psys_in_edit_mode(sim->eval_ctx->view_layer, psys))
if (psys_in_edit_mode(sim->eval_ctx, sim->eval_ctx->view_layer, psys))
if (psys->renderdata == 0 && (psys->edit == NULL || pset->flag & PE_DRAW_PART) == 0)
return;
@@ -3789,7 +3789,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
pind.bspline = (psys->part->flag & PART_HAIR_BSPLINE);
/* pind.dm disabled in editmode means we don't get effectors taken into
* account when subdividing for instance */
pind.dm = psys_in_edit_mode(sim->eval_ctx->view_layer, psys) ? NULL : psys->hair_out_dm;
pind.dm = psys_in_edit_mode(sim->eval_ctx, sim->eval_ctx->view_layer, psys) ? NULL : psys->hair_out_dm;
init_particle_interpolation(sim->ob, psys, pa, &pind);
do_particle_interpolation(psys, p, pa, t, &pind, state);