[Bf-blender-cvs] [1c77f259fd3] temp-pbvh-split: temp-pbvh-split: Support pbvh debug node box drawing outside of pbvh draw mode

Joseph Eagar noreply at git.blender.org
Sat May 7 01:13:12 CEST 2022


Commit: 1c77f259fd3b5f1768dd37eb2c06f67e67004999
Author: Joseph Eagar
Date:   Wed May 4 20:58:20 2022 -0700
Branches: temp-pbvh-split
https://developer.blender.org/rB1c77f259fd3b5f1768dd37eb2c06f67e67004999

temp-pbvh-split: Support pbvh debug node box drawing outside of pbvh
draw mode

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

M	release/datafiles/locale
M	release/scripts/addons
M	source/blender/draw/engines/basic/basic_engine.c
M	source/blender/draw/engines/eevee/eevee_materials.c
M	source/blender/draw/intern/DRW_render.h
M	source/blender/draw/intern/draw_manager_data.c

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 2e715d54178..44cf4b4bf74 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 2e715d54178e24ea463c7bc0cdeb27c682c39ecf
+Subproject commit 44cf4b4bf74f22fff55941e39cebeacec68a5a80
diff --git a/release/scripts/addons b/release/scripts/addons
index 599a8db33c4..05f16d812d6 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 599a8db33c45c2ad94f8d482f01b281252799770
+Subproject commit 05f16d812d6989e3a700ec29492220292267000d
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c
index 04a3c27959d..63f5be928dd 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -10,9 +10,11 @@
 
 #include "DRW_render.h"
 
+#include "BKE_global.h"
 #include "BKE_object.h"
 #include "BKE_paint.h"
 #include "BKE_particle.h"
+#include "BKE_pbvh.h"
 
 #include "BLI_alloca.h"
 
@@ -214,6 +216,16 @@ static void basic_cache_populate(void *vedata, Object *ob)
         DRW_shgroup_call(shgrp, geom, ob);
       }
     }
+
+    if (G.debug_value == 889 && ob->sculpt && ob->sculpt->pbvh) {
+      int debug_node_nr = 0;
+      DRW_debug_modelmat(ob->obmat);
+      BKE_pbvh_draw_debug_cb(
+          ob->sculpt->pbvh,
+          (void (*)(void *d, const float min[3], const float max[3], PBVHNodeFlags f))
+              DRW_sculpt_debug_cb,
+          &debug_node_nr);
+    }
   }
 }
 
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index a81d3e56673..cb19c70c375 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -15,6 +15,7 @@
 #include "BLI_rand.h"
 #include "BLI_string_utils.h"
 
+#include "BKE_global.h"
 #include "BKE_paint.h"
 #include "BKE_particle.h"
 
@@ -853,6 +854,16 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
             *cast_shadow = *cast_shadow || (matcache[i].shadow_grp != NULL);
           }
         }
+
+        if (G.debug_value == 889 && ob->sculpt && ob->sculpt->pbvh) {
+          int debug_node_nr = 0;
+          DRW_debug_modelmat(ob->obmat);
+          BKE_pbvh_draw_debug_cb(
+              ob->sculpt->pbvh,
+              (void (*)(void *d, const float min[3], const float max[3], PBVHNodeFlags f))
+                  DRW_sculpt_debug_cb,
+              &debug_node_nr);
+        }
       }
 
       /* Motion Blur Vectors. */
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 712118e8282..6b40c1b08c4 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -18,6 +18,7 @@
 #include "BKE_layer.h"
 #include "BKE_material.h"
 #include "BKE_scene.h"
+#include "BKE_pbvh.h"
 
 #include "BLT_translation.h"
 
@@ -470,6 +471,10 @@ void DRW_shgroup_call_instances_with_attrs(DRWShadingGroup *shgroup,
 
 void DRW_shgroup_call_sculpt(DRWShadingGroup *sh, Object *ob, bool wire, bool mask);
 void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **sh, int num_sh, Object *ob);
+void DRW_sculpt_debug_cb(void *user_data,
+                     const float bmin[3],
+                     const float bmax[3],
+                     PBVHNodeFlags flag);
 
 DRWCallBuffer *DRW_shgroup_call_buffer(DRWShadingGroup *shgroup,
                                        struct GPUVertFormat *format,
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index b5432da0957..df911fd5f2c 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -1112,10 +1112,10 @@ static void sculpt_draw_cb(DRWSculptCallbackData *scd, GPU_PBVH_Buffers *buffers
   }
 }
 
-static void sculpt_debug_cb(void *user_data,
-                            const float bmin[3],
-                            const float bmax[3],
-                            PBVHNodeFlags flag)
+void DRW_sculpt_debug_cb(void *user_data,
+                         const float bmin[3],
+                         const float bmax[3],
+                         PBVHNodeFlags flag)
 {
   int *debug_node_nr = (int *)user_data;
   BoundBox bb;
@@ -1223,7 +1223,7 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd)
     BKE_pbvh_draw_debug_cb(
         pbvh,
         (void (*)(
-            void *d, const float min[3], const float max[3], PBVHNodeFlags f))sculpt_debug_cb,
+            void *d, const float min[3], const float max[3], PBVHNodeFlags f))DRW_sculpt_debug_cb,
         &debug_node_nr);
   }
 }



More information about the Bf-blender-cvs mailing list