[Bf-blender-cvs] [f82036b6e2e] temp-pbvh-split: temp-pbvh-split: Finish merge and fix paint undo

Joseph Eagar noreply at git.blender.org
Fri Jun 3 01:16:33 CEST 2022


Commit: f82036b6e2e33abb265552bdf844f4b2695fbe2d
Author: Joseph Eagar
Date:   Thu Jun 2 16:13:19 2022 -0700
Branches: temp-pbvh-split
https://developer.blender.org/rBf82036b6e2e33abb265552bdf844f4b2695fbe2d

temp-pbvh-split: Finish merge and fix paint undo

===================================================================

M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/BKE_pbvh_pixels.hh
M	source/blender/blenkernel/intern/pbvh_intern.h
M	source/blender/blenkernel/intern/pbvh_pixels.cc
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface.cc
M	source/blender/editors/interface/interface_anim.c
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_query.cc
M	source/blender/editors/interface/interface_template_search_menu.cc
M	source/blender/editors/interface/interface_utils.cc
M	source/blender/editors/interface/view2d.cc
M	source/blender/editors/sculpt_paint/sculpt_paint_image.cc
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/editors/space_image/image_undo.c
M	source/blender/editors/space_outliner/outliner_edit.cc
M	source/blender/editors/space_outliner/outliner_intern.hh
M	source/blender/editors/space_outliner/outliner_ops.cc
M	source/blender/editors/space_outliner/outliner_tools.cc

===================================================================

diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 3df0c6bc12e..bea99b81c0f 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -594,3 +594,14 @@ bool BKE_pbvh_draw_cache_invalid(const PBVH *pbvh);
 #ifdef __cplusplus
 }
 #endif
+
+/* Disable optimization for a function (for debugging use only!)*/
+#ifdef __clang__
+#  define ATTR_NO_OPT __attribute__((optnone))
+#elif defined(_MSC_VER)
+#  define ATTR_NO_OPT __pragma(optimize("", off))
+#elif defined(__GNUC__)
+#  define ATTR_NO_OPT __attribute__((optimize("O0")))
+#else
+#  define ATTR_NO_OPT
+#endif
diff --git a/source/blender/blenkernel/BKE_pbvh_pixels.hh b/source/blender/blenkernel/BKE_pbvh_pixels.hh
index 2d7f6c64b96..e98b6325c07 100644
--- a/source/blender/blenkernel/BKE_pbvh_pixels.hh
+++ b/source/blender/blenkernel/BKE_pbvh_pixels.hh
@@ -169,6 +169,10 @@ struct NodeData {
   {
     undo_regions.clear();
     for (UDIMTilePixels &tile : tiles) {
+      if (tile.pixel_rows.size() == 0) {
+        continue;
+      }
+
       rcti region;
       BLI_rcti_init_minmax(&region);
       for (PackedPixelRow &pixel_row : tile.pixel_rows) {
diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h
index cc8b0e9aefd..fe612fa63ed 100644
--- a/source/blender/blenkernel/intern/pbvh_intern.h
+++ b/source/blender/blenkernel/intern/pbvh_intern.h
@@ -282,19 +282,6 @@ void pbvh_pixels_free(PBVHNode *node);
 void pbvh_pixels_free_brush_test(PBVHNode *node);
 void pbvh_free_draw_buffers(PBVH *pbvh, PBVHNode *node);
 
-
-/* Disable optimization for a function (for debugging use only!)*/
-#ifdef __clang__
-#  define ATTR_NO_OPT __attribute__((optnone))
-#elif defined(_MSC_VER)
-#  define ATTR_NO_OPT __pragma(optimize("", off))
-#elif defined(__GNUC__)
-#  define ATTR_NO_OPT __attribute__((optimize("O0")))
-#else
-#  define ATTR_NO_OPT
-#endif
-
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc
index 9a0cea77369..ebb4446e302 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@ -114,6 +114,7 @@ static void split_pixel_node(PBVH *pbvh,
   tdata->nodes_num->fetch_add(2);
 
   if (count_node_pixels(*node) <= pbvh->pixel_leaf_limit || split->depth >= pbvh->depth_limit) {
+    BKE_pbvh_pixels_node_data_get(split->node).rebuild_undo_regions();
     return;
   }
 
@@ -249,6 +250,8 @@ static void split_pixel_node(PBVH *pbvh,
     pbvh_pixels_free(node);
   }
 
+  data.undo_regions.clear();
+
   BLI_thread_queue_push(tdata->new_nodes, static_cast<void *>(split1));
   BLI_thread_queue_push(tdata->new_nodes, static_cast<void *>(split2));
 
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 9a7d42ec413..a9a9c98cab8 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -461,7 +461,7 @@ enum {
 void UI_draw_widget_scroll(struct uiWidgetColors *wcol,
                            const struct rcti *rect,
                            const struct rcti *slider,
-                           uint64_t state);
+                           int state);
 
 /**
  * Shortening string helper.
@@ -886,9 +886,9 @@ uiBut *UI_but_active_drop_name_button(const struct bContext *C);
 bool UI_but_active_drop_name(const struct bContext *C);
 bool UI_but_active_drop_color(struct bContext *C);
 
-void UI_but_flag_enable(uiBut *but, uint64_t flag);
-void UI_but_flag_disable(uiBut *but, uint64_t flag);
-bool UI_but_flag_is_set(uiBut *but, uint64_t flag);
+void UI_but_flag_enable(uiBut *but, int flag);
+void UI_but_flag_disable(uiBut *but, int flag);
+bool UI_but_flag_is_set(uiBut *but, int flag);
 
 void UI_but_drawflag_enable(uiBut *but, int flag);
 void UI_but_drawflag_disable(uiBut *but, int flag);
@@ -1632,7 +1632,7 @@ eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout,
  * callback returns true, the given buttons are considered to be matching and relevant state is
  * preserved (copied from the old to the new button). If it returns false, it's considered
  * non-matching and no further checks are done.
- *\
+ *
  * If this is set, it is always executed instead of the default comparisons. However it is only
  * executed for buttons that have the same type and the same callback. So callbacks can assume the
  * button types match.
diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc
index 0b23eb84f7c..c12d6957a95 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -848,7 +848,7 @@ static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but)
   BLI_assert(oldbut->active);
 
   /* flags from the buttons we want to refresh, may want to add more here... */
-  const uint64_t flag_copy = UI_BUT_REDALERT | UI_HAS_ICON | UI_SELECT_DRAW;
+  const int flag_copy = UI_BUT_REDALERT | UI_HAS_ICON | UI_SELECT_DRAW;
   const int drawflag_copy = 0; /* None currently. */
 
   /* still stuff needs to be copied */
@@ -994,7 +994,7 @@ static bool ui_but_update_from_old_block(const bContext *C,
     found_active = true;
   }
   else {
-    uint64_t flag_copy = UI_BUT_DRAG_MULTI;
+    int flag_copy = UI_BUT_DRAG_MULTI;
 
     /* Stupid special case: The active button may be inside (as in, overlapped on top) a tree-row
      * button which we also want to keep highlighted then. */
@@ -4244,7 +4244,7 @@ static uiBut *ui_def_but(uiBlock *block,
   return but;
 }
 
-void ui_def_but_icon(uiBut *but, const int icon, const uint64_t flag)
+void ui_def_but_icon(uiBut *but, const int icon, const int flag)
 {
   if (icon) {
     ui_icon_ensure_deferred(static_cast<const bContext *>(but->block->evil_C),
@@ -5831,17 +5831,17 @@ void UI_block_flag_disable(uiBlock *block, int flag)
   block->flag &= ~flag;
 }
 
-void UI_but_flag_enable(uiBut *but, uint64_t flag)
+void UI_but_flag_enable(uiBut *but, int flag)
 {
   but->flag |= flag;
 }
 
-void UI_but_flag_disable(uiBut *but, uint64_t flag)
+void UI_but_flag_disable(uiBut *but, int flag)
 {
   but->flag &= ~flag;
 }
 
-bool UI_but_flag_is_set(uiBut *but, uint64_t flag)
+bool UI_but_flag_is_set(uiBut *but, int flag)
 {
   return (but->flag & flag) != 0;
 }
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index b77d48552c7..e838ce37d8e 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -144,7 +144,7 @@ void ui_but_anim_decorate_update_from_flag(uiButDecorator *decorator_but)
     return;
   }
 
-  const uint64_t flag = but_anim->flag;
+  const int flag = but_anim->flag;
 
   if (flag & UI_BUT_DRIVEN) {
     but->icon = ICON_DECORATE_DRIVER;
@@ -162,7 +162,7 @@ void ui_but_anim_decorate_update_from_flag(uiButDecorator *decorator_but)
     but->icon = ICON_DECORATE;
   }
 
-  const uint64_t flag_copy = (UI_BUT_DISABLED | UI_BUT_INACTIVE);
+  const int flag_copy = (UI_BUT_DISABLED | UI_BUT_INACTIVE);
   but->flag = (but->flag & ~flag_copy) | (flag & flag_copy);
 }
 
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 67d48587a97..1b245ba9e6f 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -721,7 +721,7 @@ extern void ui_but_active_string_clear_and_exit(struct bContext *C, uiBut *but)
 extern void ui_but_set_string_interactive(struct bContext *C, uiBut *but, const char *value);
 extern uiBut *ui_but_drag_multi_edit_get(uiBut *but);
 
-void ui_def_but_icon(uiBut *but, int icon, uint64_t flag);
+void ui_def_but_icon(uiBut *but, int icon, int flag);
 /**
  * Avoid using this where possible since it's better not to ask for an icon in the first place.
  */
@@ -1438,8 +1438,8 @@ uiBlock *ui_block_find_mouse_over(const struct ARegion *region,
                                   bool only_clip);
 
 uiBut *ui_region_find_first_but_test_flag(struct ARegion *region,
-                                          uint64_t flag_include,
-                                          uint64_t flag_exclude);
+                                          int flag_include,
+                                          int flag_exclude);
 uiBut *ui_region_find_active_but(struct ARegion *region) ATTR_WARN_UNUSED_RESULT;
 bool ui_region_contains_point_px(const struct ARegion *region, const int xy[2])
     ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 49eb58a8dc9..3465373c85d 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -5347,7 +5347,7 @@ static void ui_item_align(uiLayout *litem, short nr)
   }
 }
 
-static void ui_item_flag(uiLayout *litem, uint64_t flag)
+static void ui_item_flag(uiLayout *litem, int flag)
 {
   LISTBASE_FOREACH_BACKWARD (uiItem *, item, &litem->items) {
     if (item->type == ITEM_BUTTON) {
diff --git a/source/blender/editors/interface/interface_query.cc b/source/blender/editors/interface/interface_query.cc
index 2ffe30996dc..ea1fe3923e4 100644
--- a/source/blender/editors/interface/interface_query.cc
+++ b/source/blender/editors/interface/interface_query.cc
@@ -717,9 +717,7 @@ uiBut *ui_region_find_active_but(ARegion *region)
   return nullptr;
 }
 
-uiBut *ui_region_find_first_but_test_flag(ARegion *region,
-                                          uint64_t flag_include,
-                                          uint64_t flag_exclude)
+uiBut *ui_region_find_first_but_test_flag(ARegion *region, int flag_include, int flag_exclude)
 {
   LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
     LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
diff --git a/source/blender/editors/interface/interface_template_search_menu.cc b/source/blender/editors/interface/interface_template_search_menu.cc
index 854e3dace3b..c3021028b97 100644
--- a/

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list