Crash by hiting "tab" after sculpting with dyntopo. #65200

Closed
opened 2019-05-27 22:31:09 +02:00 by Paweł Żukowicz · 24 comments

System Information
Operating system: Win 10
Graphics card: 950m
Working with mouse. Graphics software updated.

Blender Version
Broken: d525c76003
Worked: (optional)

Short description of error
If you click "tab" after any change of mesh in dyntopo (relative) mode, blender crash (more often if you add detail). However if you manualy change mode in bottom. There is hight chanse to avoid crash.

I have trouble with ctrl-z too, even if blender somehow manage to not crash. He have tendency to broke after some edit of mesh without dyntopo and clicking a few times ctrl-z. Sorry i can't give much more information obout ctrl-z. It generaly starts glitching in my other projects as well over the last .. month ?

Exact steps for others to reproduce the error
Just folow short video.
2.8_human_body_only.blend
VID_20190527_221007.mp4

**System Information** Operating system: Win 10 Graphics card: 950m Working with mouse. Graphics software updated. **Blender Version** Broken: d525c76003b3 Worked: (optional) **Short description of error** If you click "tab" after any change of mesh in dyntopo (relative) mode, blender crash (more often if you add detail). However if you manualy change mode in bottom. There is hight chanse to avoid crash. I have trouble with ctrl-z too, even if blender somehow manage to not crash. He have tendency to broke after some edit of mesh without dyntopo and clicking a few times ctrl-z. Sorry i can't give much more information obout ctrl-z. It generaly starts glitching in my other projects as well over the last .. month ? **Exact steps for others to reproduce the error** Just folow short video. [2.8_human_body_only.blend](https://archive.blender.org/developer/F7072727/2.8_human_body_only.blend) [VID_20190527_221007.mp4](https://archive.blender.org/developer/F7072731/VID_20190527_221007.mp4)

Added subscriber: @zukson

Added subscriber: @zukson

#65321 was marked as duplicate of this issue

#65321 was marked as duplicate of this issue

#65356 was marked as duplicate of this issue

#65356 was marked as duplicate of this issue

#63872 was marked as duplicate of this issue

#63872 was marked as duplicate of this issue

#63866 was marked as duplicate of this issue

#63866 was marked as duplicate of this issue

#65150 was marked as duplicate of this issue

#65150 was marked as duplicate of this issue

Added subscriber: @Gvgeo-1

Added subscriber: @Gvgeo-1
Bastien Montagne was assigned by George Vogiatzis 2019-05-28 07:51:55 +02:00

when dyntopo finish, there is a problem in build_pbvh_from_regular_mesh .
When it sends BKE_pbvh_apply_vertCos(pbvh, v_cos, totvert);

{

if (totvert != pbvh->totvert) {
BLI_assert(!"PBVH: Given deforming vcos number does not natch PBVH vertex number!");```


blender.exe!issue_debug_notification(const wchar_t * const message) Line 28	C++
blender.exe!__acrt_report_runtime_error(const wchar_t * message) Line 154	C++
blender.exe!abort() Line 61	C++
blender.exe!BKE_pbvh_apply_vertCos(PBVH * pbvh, float[3] * vertCos, const int totvert) Line 2328	C
blender.exe!build_pbvh_from_regular_mesh(Object * ob, Mesh * me_eval_deform) Line 1443	C
blender.exe!BKE_sculpt_object_pbvh_ensure(Depsgraph * depsgraph, Object * ob) Line 1499	C

blender.exe!BKE_sculpt_update_mesh_elements(Depsgraph * depsgraph, Scene * scene, Sculpt * sd, Object * ob, bool need_pmap, bool need_mask) Line 1222 C

blender.exe!sculpt_update_after_dynamic_topology_toggle(Depsgraph * depsgraph, Scene * scene, Object * ob) Line 5623	C
blender.exe!sculpt_dynamic_topology_disable_ex(Depsgraph * depsgraph, Scene * scene, Object * ob, SculptUndoNode * unode) Line 5744	C
blender.exe!sculpt_dynamic_topology_disable_with_undo(Depsgraph * depsgraph, Scene * scene, Object * ob) Line 5763	C
blender.exe!sculpt_dynamic_topology_toggle_exec(bContext * C, wmOperator * UNUSED_op) Line 5791	C
blender.exe!sculpt_dynamic_topology_toggle_invoke(bContext * C, wmOperator * op, const wmEvent * UNUSED_event) Line 5901	C
blender.exe!wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1407	C
blender.exe!wm_operator_call_internal(bContext * C, wmOperatorType * ot, PointerRNA * properties, ReportList * reports, const short context, const bool poll_only, wmEvent * event) Line 1621	C
blender.exe!WM_operator_name_call_ptr(bContext * C, wmOperatorType * ot, short context, PointerRNA * properties) Line 1670	C
blender.exe!ui_apply_but_funcs_after(bContext * C) Line 809	C
blender.exe!ui_handler_region_menu(bContext * C, const wmEvent * event, void * UNUSED_userdata) Line 10146	C
blender.exe!wm_handler_ui_call(bContext * C, wmEventHandler_UI * handler, const wmEvent * event, int always_pass) Line 608	C
blender.exe!wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2659	C
blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2844	C
blender.exe!wm_event_do_handlers(bContext * C) Line 3212	C
blender.exe!WM_main(bContext * C) Line 420	C
blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 502	C
[External Code]	
when dyntopo finish, there is a problem in `build_pbvh_from_regular_mesh` . When it sends `BKE_pbvh_apply_vertCos(pbvh, v_cos, totvert);` ```void BKE_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)- [x], const int totvert) { ``` if (totvert != pbvh->totvert) { BLI_assert(!"PBVH: Given deforming vcos number does not natch PBVH vertex number!");``` ``` ``` blender.exe!issue_debug_notification(const wchar_t * const message) Line 28 C++ blender.exe!__acrt_report_runtime_error(const wchar_t * message) Line 154 C++ blender.exe!abort() Line 61 C++ blender.exe!BKE_pbvh_apply_vertCos(PBVH * pbvh, float[3] * vertCos, const int totvert) Line 2328 C blender.exe!build_pbvh_from_regular_mesh(Object * ob, Mesh * me_eval_deform) Line 1443 C blender.exe!BKE_sculpt_object_pbvh_ensure(Depsgraph * depsgraph, Object * ob) Line 1499 C > blender.exe!BKE_sculpt_update_mesh_elements(Depsgraph * depsgraph, Scene * scene, Sculpt * sd, Object * ob, bool need_pmap, bool need_mask) Line 1222 C blender.exe!sculpt_update_after_dynamic_topology_toggle(Depsgraph * depsgraph, Scene * scene, Object * ob) Line 5623 C blender.exe!sculpt_dynamic_topology_disable_ex(Depsgraph * depsgraph, Scene * scene, Object * ob, SculptUndoNode * unode) Line 5744 C blender.exe!sculpt_dynamic_topology_disable_with_undo(Depsgraph * depsgraph, Scene * scene, Object * ob) Line 5763 C blender.exe!sculpt_dynamic_topology_toggle_exec(bContext * C, wmOperator * UNUSED_op) Line 5791 C blender.exe!sculpt_dynamic_topology_toggle_invoke(bContext * C, wmOperator * op, const wmEvent * UNUSED_event) Line 5901 C blender.exe!wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1407 C blender.exe!wm_operator_call_internal(bContext * C, wmOperatorType * ot, PointerRNA * properties, ReportList * reports, const short context, const bool poll_only, wmEvent * event) Line 1621 C blender.exe!WM_operator_name_call_ptr(bContext * C, wmOperatorType * ot, short context, PointerRNA * properties) Line 1670 C blender.exe!ui_apply_but_funcs_after(bContext * C) Line 809 C blender.exe!ui_handler_region_menu(bContext * C, const wmEvent * event, void * UNUSED_userdata) Line 10146 C blender.exe!wm_handler_ui_call(bContext * C, wmEventHandler_UI * handler, const wmEvent * event, int always_pass) Line 608 C blender.exe!wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2659 C blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2844 C blender.exe!wm_event_do_handlers(bContext * C) Line 3212 C blender.exe!WM_main(bContext * C) Line 420 C blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 502 C [External Code] ```
Bastien Montagne removed their assignment 2019-05-28 12:02:09 +02:00
Sergey Sharybin was assigned by Bastien Montagne 2019-05-28 12:02:09 +02:00

Added subscribers: @Sergey, @mont29

Added subscribers: @Sergey, @mont29

@zukson Please follow our submission template and guidelines, also read these tips about bug reports, and make a complete, valid bug report, with required info, precise description of the issue (only ONE issue per report!), precise steps to reproduce it, small and simple .blend and/or other files to do so if needed, etc.
Videos and/or links to external sites etc. are not acceptable as bug report (they can be provided as additional information only).

This is a complex model, I cannot reproduce it from scratch with a dummy cube it'd seem…

@Gvgeo-1 Please do not assign randomly reports to people, that is not especially my area…

@Sergey issue here is that in BKE_sculpt_update_mesh_elements() (which is called when switching dyntopo off just before leaving sculpt mode), the orig mesh of the object is updated from final state of sculpt session, while the evaluated one is still based on mesh before the sculpt session (I think, at least that's what its number of verts suggests).
Thing is, I tried to force-update depsgraph (hackish DEG_on_visible_update() call in sculpt_update_after_dynamic_topology_toggle() before calling BKE_sculpt_update_mesh_elements(), but am still getting an me_eval with wrong (old) number of verts.
Assigning to you, at least to get some hits, am feeling a bit lost in that code…
Note that bug can be triggered as well by just trying to disable dyntopo after sculpting a bit, no need to go to Edit mode.

@zukson Please follow our [submission template and guidelines](https:*developer.blender.org/maniphest/task/edit/form/1/), also read [these tips about bug reports](https:*wiki.blender.org/wiki/Process/Bug_Reports), and make a complete, valid bug report, with required info, ***precise description of the issue*** (only ONE issue per report!), precise steps to reproduce it, **small and simple** .blend and/or other files to do so if needed, etc. Videos and/or links to external sites etc. **are not acceptable** as bug report (they can be provided as additional information **only**). This is a complex model, I cannot reproduce it from scratch with a dummy cube it'd seem… @Gvgeo-1 Please do not assign randomly reports to people, that is not especially my area… @Sergey issue here is that in `BKE_sculpt_update_mesh_elements()` (which is called when switching dyntopo off just before leaving sculpt mode), the orig mesh of the object is updated from final state of sculpt session, while the evaluated one is still based on mesh before the sculpt session (I think, at least that's what its number of verts suggests). Thing is, I tried to force-update depsgraph (hackish `DEG_on_visible_update()` call in `sculpt_update_after_dynamic_topology_toggle()` before calling `BKE_sculpt_update_mesh_elements()`, but am still getting an `me_eval` with wrong (old) number of verts. Assigning to you, at least to get some hits, am feeling a bit lost in that code… Note that bug can be triggered as well by just trying to disable dyntopo after sculpting a bit, no need to go to Edit mode.

@mont29 Certainly not random, I saw commit 934b9e80 that catches the problem and 3e86bb2d.

@mont29 Certainly not random, I saw commit 934b9e80 that catches the problem and 3e86bb2d.

@mont29, i don't think this is anything to do with depsgraph or evaluation, this is something to do with sculpt mode attempting to do deformed sculpt on a dynamic topology. This isn't going to work: dynamic topology only exists in sculpt mode and is not accessible in modifier stack.

Basically, BKE_pbvh_apply_vertCos() is not to be used when dynamic topology is used. Not sure why it's fine when you enable dynamic topology and why is it only becoming a problem later on.

P.S. Dynamic topology was never supported for deformed sculpting, you can see this in a simple attached file. Open in 2.79, go to sculpt mode, enable dynamic topology. deformed_dynamic_topology.blend

@mont29, i don't think this is anything to do with depsgraph or evaluation, this is something to do with sculpt mode attempting to do deformed sculpt on a dynamic topology. This isn't going to work: dynamic topology only exists in sculpt mode and is not accessible in modifier stack. Basically, `BKE_pbvh_apply_vertCos()` is not to be used when dynamic topology is used. Not sure why it's fine when you enable dynamic topology and why is it only becoming a problem later on. P.S. Dynamic topology was never supported for deformed sculpting, you can see this in a simple attached file. Open in 2.79, go to sculpt mode, enable dynamic topology. [deformed_dynamic_topology.blend](https://archive.blender.org/developer/F7075333/deformed_dynamic_topology.blend)

@mont29, bad news is: got slightly diverged into a wrong direction of investigation. Good news is, now i know what's going on and have some patch to be discussed.

Basically, we indeed need to ensure object is fully evaluated prior to re-creating the PBVH. That puts all the required bits into a nice consistent state.

We can not use DEG_on_visible_update() since that only tags for updates, it does not to actual update.
The naming is confusing, comes from some legacy history, and is probably be changed.

Here is a patch which works, but which probably required extra pair of eyes and brain to go through:

P985: (An Untitled Masterwork)

diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index ed0298cce1f..a4c68c2c5ad 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -183,7 +183,8 @@ void ED_object_sculptmode_enter_ex(struct Main *bmain,
                                    const bool force_dyntopo,
                                    struct ReportList *reports);
 void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports);
-void ED_object_sculptmode_exit_ex(struct Depsgraph *depsgraph,
+void ED_object_sculptmode_exit_ex(struct Main *bmain,
+                                  struct Depsgraph *depsgraph,
                                   struct Scene *scene,
                                   struct Object *ob);
 void ED_object_sculptmode_exit(struct bContext *C);
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index cc28ceaf95b..0f0d09c610b 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -276,7 +276,7 @@ static bool ed_object_mode_generic_exit_ex(struct Main *bmain,
       if (only_test) {
         return true;
       }
-      ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
+      ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob);
     }
   }
   else if (ob->mode & OB_MODE_POSE) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 9ba7561b18b..23656737153 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -60,6 +60,7 @@
 #include "BKE_pbvh.h"
 #include "BKE_pointcache.h"
 #include "BKE_report.h"
+#include "BKE_scene.h"
 #include "BKE_screen.h"
 #include "BKE_subsurf.h"
 
@@ -5672,10 +5673,8 @@ void sculpt_dynamic_topology_enable_ex(Depsgraph *depsgraph, Scene *scene, Objec
  *
  * If 'unode' is given, the BMesh's data is copied out to the unode
  * before the BMesh is deleted so that it can be restored from */
-void sculpt_dynamic_topology_disable_ex(Depsgraph *depsgraph,
-                                        Scene *scene,
-                                        Object *ob,
-                                        SculptUndoNode *unode)
+void sculpt_dynamic_topology_disable_ex(
+    Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, SculptUndoNode *unode)
 {
   SculptSession *ss = ob->sculpt;
   Mesh *me = ob->data;
@@ -5739,19 +5738,24 @@ void sculpt_dynamic_topology_disable_ex(Depsgraph *depsgraph,
   BKE_particlesystem_reset_all(ob);
   BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED);
 
+  DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+  BKE_scene_graph_update_tagged(depsgraph, bmain);
+
   /* Refresh */
   sculpt_update_after_dynamic_topology_toggle(depsgraph, scene, ob);
 }
 
 void sculpt_dynamic_topology_disable(bContext *C, SculptUndoNode *unode)
 {
+  Main *bmain = CTX_data_main(C);
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
   Scene *scene = CTX_data_scene(C);
   Object *ob = CTX_data_active_object(C);
-  sculpt_dynamic_topology_disable_ex(depsgraph, scene, ob, unode);
+  sculpt_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, unode);
 }
 
-static void sculpt_dynamic_topology_disable_with_undo(Depsgraph *depsgraph,
+static void sculpt_dynamic_topology_disable_with_undo(Main *bmain,
+                                                      Depsgraph *depsgraph,
                                                       Scene *scene,
                                                       Object *ob)
 {
@@ -5759,7 +5763,7 @@ static void sculpt_dynamic_topology_disable_with_undo(Depsgraph *depsgraph,
   if (ss->bm) {
     sculpt_undo_push_begin("Dynamic topology disable");
     sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END);
-    sculpt_dynamic_topology_disable_ex(depsgraph, scene, ob, NULL);
+    sculpt_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, NULL);
     sculpt_undo_push_end();
   }
 }
@@ -5779,6 +5783,7 @@ static void sculpt_dynamic_topology_enable_with_undo(Depsgraph *depsgraph,
 
 static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 {
+  Main *bmain = CTX_data_main(C);
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
   Scene *scene = CTX_data_scene(C);
   Object *ob = CTX_data_active_object(C);
@@ -5787,7 +5792,7 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(o
   WM_cursor_wait(1);
 
   if (ss->bm) {
-    sculpt_dynamic_topology_disable_with_undo(depsgraph, scene, ob);
+    sculpt_dynamic_topology_disable_with_undo(bmain, depsgraph, scene, ob);
   }
   else {
     sculpt_dynamic_topology_enable_with_undo(depsgraph, scene, ob);
@@ -6151,7 +6156,7 @@ void ED_object_sculptmode_enter(struct bContext *C, ReportList *reports)
   ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, reports);
 }
 
-void ED_object_sculptmode_exit_ex(Depsgraph *depsgraph, Scene *scene, Object *ob)
+void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
 {
   const int mode_flag = OB_MODE_SCULPT;
   Mesh *me = BKE_mesh_from_object(ob);
@@ -6177,7 +6182,7 @@ void ED_object_sculptmode_exit_ex(Depsgraph *depsgraph, Scene *scene, Object *ob
     /* Dynamic topology must be disabled before exiting sculpt
      * mode to ensure the undo stack stays in a consistent
      * state */
-    sculpt_dynamic_topology_disable_with_undo(depsgraph, scene, ob);
+    sculpt_dynamic_topology_disable_with_undo(bmain, depsgraph, scene, ob);
 
     /* store so we know to re-enable when entering sculpt mode */
     me->flag |= ME_SCULPT_DYNAMIC_TOPOLOGY;
@@ -6199,11 +6204,12 @@ void ED_object_sculptmode_exit_ex(Depsgraph *depsgraph, Scene *scene, Object *ob
 
 void ED_object_sculptmode_exit(bContext *C)
 {
+  Main *bmain = CTX_data_main(C);
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
   Scene *scene = CTX_data_scene(C);
   ViewLayer *view_layer = CTX_data_view_layer(C);
   Object *ob = OBACT(view_layer);
-  ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
+  ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob);
 }
 
 static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
@@ -6225,7 +6231,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
   }
 
   if (is_mode_set) {
-    ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
+    ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob);
   }
   else {
     ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, op->reports);
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index be4ab5809e4..b29ca1b4dd7 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -33,6 +33,7 @@
 
 #include "BKE_pbvh.h"
 
+struct Main;
 struct KeyBlock;
 struct Object;
 struct SculptOrigVertData;
@@ -58,7 +59,8 @@ void sculpt_dynamic_topology_enable_ex(struct Depsgraph *depsgraph,
                                        struct Scene *scene,
                                        struct Object *ob);
 
-void sculpt_dynamic_topology_disable_ex(struct Depsgraph *depsgraph,
+void sculpt_dynamic_topology_disable_ex(struct Main *bmain,
+                                        struct Depsgraph *depsgraph,
                                         struct Scene *scene,
                                         struct Object *ob,
                                         struct SculptUndoNode *unode);

P.S. Noticed after submitting the patch. The recalc flag is also to include ID_RECALC_PSYS_RESET. BKE_ptcache_object_reset() might be fine, since the cache is supposed to be shared.

@mont29, bad news is: got slightly diverged into a wrong direction of investigation. Good news is, now i know what's going on and have some patch to be discussed. Basically, we indeed need to ensure object is fully evaluated prior to re-creating the PBVH. That puts all the required bits into a nice consistent state. We can not use `DEG_on_visible_update()` since that only tags for updates, it does not to actual update. The naming is confusing, comes from some legacy history, and is probably be changed. Here is a patch which works, but which probably required extra pair of eyes and brain to go through: [P985: (An Untitled Masterwork)](https://archive.blender.org/developer/P985.txt) ``` diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index ed0298cce1f..a4c68c2c5ad 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -183,7 +183,8 @@ void ED_object_sculptmode_enter_ex(struct Main *bmain, const bool force_dyntopo, struct ReportList *reports); void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports); -void ED_object_sculptmode_exit_ex(struct Depsgraph *depsgraph, +void ED_object_sculptmode_exit_ex(struct Main *bmain, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void ED_object_sculptmode_exit(struct bContext *C); diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index cc28ceaf95b..0f0d09c610b 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -276,7 +276,7 @@ static bool ed_object_mode_generic_exit_ex(struct Main *bmain, if (only_test) { return true; } - ED_object_sculptmode_exit_ex(depsgraph, scene, ob); + ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob); } } else if (ob->mode & OB_MODE_POSE) { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 9ba7561b18b..23656737153 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -60,6 +60,7 @@ #include "BKE_pbvh.h" #include "BKE_pointcache.h" #include "BKE_report.h" +#include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_subsurf.h" @@ -5672,10 +5673,8 @@ void sculpt_dynamic_topology_enable_ex(Depsgraph *depsgraph, Scene *scene, Objec * * If 'unode' is given, the BMesh's data is copied out to the unode * before the BMesh is deleted so that it can be restored from */ -void sculpt_dynamic_topology_disable_ex(Depsgraph *depsgraph, - Scene *scene, - Object *ob, - SculptUndoNode *unode) +void sculpt_dynamic_topology_disable_ex( + Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, SculptUndoNode *unode) { SculptSession *ss = ob->sculpt; Mesh *me = ob->data; @@ -5739,19 +5738,24 @@ void sculpt_dynamic_topology_disable_ex(Depsgraph *depsgraph, BKE_particlesystem_reset_all(ob); BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED); + DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + BKE_scene_graph_update_tagged(depsgraph, bmain); + /* Refresh */ sculpt_update_after_dynamic_topology_toggle(depsgraph, scene, ob); } void sculpt_dynamic_topology_disable(bContext *C, SculptUndoNode *unode) { + Main *bmain = CTX_data_main(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); - sculpt_dynamic_topology_disable_ex(depsgraph, scene, ob, unode); + sculpt_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, unode); } -static void sculpt_dynamic_topology_disable_with_undo(Depsgraph *depsgraph, +static void sculpt_dynamic_topology_disable_with_undo(Main *bmain, + Depsgraph *depsgraph, Scene *scene, Object *ob) { @@ -5759,7 +5763,7 @@ static void sculpt_dynamic_topology_disable_with_undo(Depsgraph *depsgraph, if (ss->bm) { sculpt_undo_push_begin("Dynamic topology disable"); sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END); - sculpt_dynamic_topology_disable_ex(depsgraph, scene, ob, NULL); + sculpt_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, NULL); sculpt_undo_push_end(); } } @@ -5779,6 +5783,7 @@ static void sculpt_dynamic_topology_enable_with_undo(Depsgraph *depsgraph, static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); @@ -5787,7 +5792,7 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(o WM_cursor_wait(1); if (ss->bm) { - sculpt_dynamic_topology_disable_with_undo(depsgraph, scene, ob); + sculpt_dynamic_topology_disable_with_undo(bmain, depsgraph, scene, ob); } else { sculpt_dynamic_topology_enable_with_undo(depsgraph, scene, ob); @@ -6151,7 +6156,7 @@ void ED_object_sculptmode_enter(struct bContext *C, ReportList *reports) ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, reports); } -void ED_object_sculptmode_exit_ex(Depsgraph *depsgraph, Scene *scene, Object *ob) +void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob) { const int mode_flag = OB_MODE_SCULPT; Mesh *me = BKE_mesh_from_object(ob); @@ -6177,7 +6182,7 @@ void ED_object_sculptmode_exit_ex(Depsgraph *depsgraph, Scene *scene, Object *ob /* Dynamic topology must be disabled before exiting sculpt * mode to ensure the undo stack stays in a consistent * state */ - sculpt_dynamic_topology_disable_with_undo(depsgraph, scene, ob); + sculpt_dynamic_topology_disable_with_undo(bmain, depsgraph, scene, ob); /* store so we know to re-enable when entering sculpt mode */ me->flag |= ME_SCULPT_DYNAMIC_TOPOLOGY; @@ -6199,11 +6204,12 @@ void ED_object_sculptmode_exit_ex(Depsgraph *depsgraph, Scene *scene, Object *ob void ED_object_sculptmode_exit(bContext *C) { + Main *bmain = CTX_data_main(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = OBACT(view_layer); - ED_object_sculptmode_exit_ex(depsgraph, scene, ob); + ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob); } static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) @@ -6225,7 +6231,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) } if (is_mode_set) { - ED_object_sculptmode_exit_ex(depsgraph, scene, ob); + ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob); } else { ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, op->reports); diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index be4ab5809e4..b29ca1b4dd7 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -33,6 +33,7 @@ #include "BKE_pbvh.h" +struct Main; struct KeyBlock; struct Object; struct SculptOrigVertData; @@ -58,7 +59,8 @@ void sculpt_dynamic_topology_enable_ex(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); -void sculpt_dynamic_topology_disable_ex(struct Depsgraph *depsgraph, +void sculpt_dynamic_topology_disable_ex(struct Main *bmain, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct SculptUndoNode *unode); ``` P.S. Noticed after submitting the patch. The recalc flag is also to include `ID_RECALC_PSYS_RESET`. `BKE_ptcache_object_reset()` might be fine, since the cache is supposed to be shared.

@mont29 HI sory but how ?-? this could be posible to describe this in other way (i already reported some bugs when i use video as addisional help) ? I mention CTRL-Z becouse i found that conected with this error. Short video max20 sek with clear view of what i'm doing from opening file to error without any unnessesary steps. Of course i try recreate that with simple cube or ecosphere bit i failed so i have to report with this complicated to analize model. I WILL be better next time with more precise description of the error. Thank you all for your work.

@mont29 HI sory but how ?-? this could be posible to describe this in other way (i already reported some bugs when i use video as addisional help) ? I mention CTRL-Z becouse i found that conected with this error. Short video max20 sek with clear view of what i'm doing from opening file to error without any unnessesary steps. Of course i try recreate that with simple cube or ecosphere bit i failed so i have to report with this complicated to analize model. I WILL be better next time with more precise description of the error. Thank you all for your work.

Added subscribers: @megabouda, @JacquesLucke

Added subscribers: @megabouda, @JacquesLucke

Added subscribers: @ostapblender, @ZedDB

Added subscribers: @ostapblender, @ZedDB

Added subscriber: @rcuddy

Added subscriber: @rcuddy

This issue was referenced by 455e14eccd

This issue was referenced by 455e14eccd1c54e99114ee44553a96bfc57981ab

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Added subscriber: @AhmedNassef

Added subscriber: @AhmedNassef

Added subscribers: @gurralol, @brecht, @DanielBystedt

Added subscribers: @gurralol, @brecht, @DanielBystedt

Hello,
I read that the issue is "resolved". What is process from here, do we wait for a future update release for blender which will include the patch? I just tried and the issue is still happening.
Thanks and regards,

Hello, I read that the issue is "resolved". What is process from here, do we wait for a future update release for blender which will include the patch? I just tried and the issue is still happening. Thanks and regards,

Hard to tell why this the issue is still happening for you since we don't have information about your build hash, platform and things like that.

Current builds which are available on builder.blender.org should have this issue resolved. If the bug is still happening for you, make a new report following the bug report guidelines.

Anyway, usual process is simple:

  • Wait for the next buildbot round to give new builds
  • Test the new builds
  • Report a new bug if the issue is still happening for you (there could be multiple code aspects even for the similar-sounding bug. Having those reported separately helps tracking down history).
  • Be happy if the issue is solved.
Hard to tell why this the issue is still happening for you since we don't have information about your build hash, platform and things like that. Current builds which are available on builder.blender.org should have this issue resolved. If the bug is still happening for you, make a new report following the bug report guidelines. Anyway, usual process is simple: - Wait for the next buildbot round to give new builds - Test the new builds - Report a new bug if the issue is still happening for you (there could be multiple code aspects even for the similar-sounding bug. Having those reported separately helps tracking down history). - Be happy if the issue is solved.

Indeed, my build was outdated. Downloading the latest build solved the issue.
Thanks !

Indeed, my build was outdated. Downloading the latest build solved the issue. Thanks !
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#65200
No description provided.