Particle edit: Fix missing hair with new oarticle system added
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 11:53:51 +0000 (13:53 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 11:54:39 +0000 (13:54 +0200)
source/blender/editors/physics/particle_edit.c

index de12d18..a5ca3cf 100644 (file)
@@ -4506,7 +4506,16 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
        if (!is_mode_set) {
                PTCacheEdit *edit;
 
+               /* Particle edit mode requires original object to have all strands
+                * cached. A bit annoying to do update here, but is simpler than
+                * rewriting the while edit mode code.
+                */
+               ob->id.recalc |= (ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+               DEG_evaluate_on_refresh(depsgraph);
+               BKE_object_eval_transform_all(depsgraph, scene, ob);
+               BKE_object_handle_data_update(depsgraph, scene, ob);
                ob->mode |= mode_flag;
+
                edit= PE_create_current(depsgraph, scene, ob);
 
                /* mesh may have changed since last entering editmode.