Fix T66686: Crash on Particle Edit, then Render
Reviewers: brecht, zeddb Reviewed By: brecht Maniphest Tasks: T66686 Differential Revision: https://developer.blender.org/D5259
This commit is contained in:
parent
9db772fe9a
commit
914427afd5
Notes:
blender-bot
2023-04-19 22:54:54 +02:00
Referenced by commit cf2c09002f
, Fix T69488: Hair particles: rekey disolves the hair then crashes
Referenced by issue #66686, Crash on Particle Edit, then Render
|
@ -685,8 +685,13 @@ void set_particle_system_modifiers_loaded(Object *object_cow)
|
|||
}
|
||||
}
|
||||
|
||||
void reset_particle_system_edit_eval(Object *object_cow)
|
||||
void reset_particle_system_edit_eval(const Depsgraph *depsgraph, Object *object_cow)
|
||||
{
|
||||
/* Inactive (and render) dependency graphs are living in own little bubble, should not care about
|
||||
* edit mode at all. */
|
||||
if (!DEG_is_active(reinterpret_cast<const ::Depsgraph *>(depsgraph))) {
|
||||
return;
|
||||
}
|
||||
LISTBASE_FOREACH (ParticleSystem *, psys, &object_cow->particlesystem) {
|
||||
ParticleSystem *orig_psys = psys->orig_psys;
|
||||
if (orig_psys->edit != NULL) {
|
||||
|
@ -696,11 +701,13 @@ void reset_particle_system_edit_eval(Object *object_cow)
|
|||
}
|
||||
}
|
||||
|
||||
void update_particles_after_copy(const Object *object_orig, Object *object_cow)
|
||||
void update_particles_after_copy(const Depsgraph *depsgraph,
|
||||
const Object *object_orig,
|
||||
Object *object_cow)
|
||||
{
|
||||
update_particle_system_orig_pointers(object_orig, object_cow);
|
||||
set_particle_system_modifiers_loaded(object_cow);
|
||||
reset_particle_system_edit_eval(object_cow);
|
||||
reset_particle_system_edit_eval(depsgraph, object_cow);
|
||||
}
|
||||
|
||||
void update_pose_orig_pointers(const bPose *pose_orig, bPose *pose_cow)
|
||||
|
@ -779,7 +786,7 @@ void update_id_after_copy(const Depsgraph *depsgraph,
|
|||
}
|
||||
BKE_pose_pchan_index_rebuild(object_cow->pose);
|
||||
}
|
||||
update_particles_after_copy(object_orig, object_cow);
|
||||
update_particles_after_copy(depsgraph, object_orig, object_cow);
|
||||
update_modifiers_orig_pointers(object_orig, object_cow);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -337,10 +337,13 @@ static PTCacheEdit *pe_get_current(Depsgraph *depsgraph, Scene *scene, Object *o
|
|||
}
|
||||
}
|
||||
|
||||
if (edit) {
|
||||
/* Don't consider inactive or render dependency graphs, since they might be evaluated for a
|
||||
* different number of childrem. or have different pointer to evaluated particle system or
|
||||
* modifier which will also cause troubles. */
|
||||
if (edit && DEG_is_active(depsgraph)) {
|
||||
edit->pid = *pid;
|
||||
if (edit->flags & PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL) {
|
||||
if (edit->psys != NULL) {
|
||||
if (edit->psys != NULL && edit->psys_eval != NULL) {
|
||||
psys_copy_particles(edit->psys, edit->psys_eval);
|
||||
pe_update_hair_particle_edit_pointers(edit);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue