Page MenuHome

Refactor: Deduplicate and simplify BVH Utils code
ClosedPublic

Authored by Germano Cavalcante (mano-wii) on Apr 4 2022, 10:44 PM.

Details

Summary
  • Merge all bvhtree_from_mesh_*.*_setup_data in a single utility
  • Create bvhtree_from_editmesh_setup_data
  • Setup data only once in BKE_bvhtree_from_mesh_get and BKE_bvhtree_from_editmesh_get

Functional changes in BKE_bvhtree_from_mesh_get and BKE_bvhtree_from_editmesh_get:

  • If a null tree is cached, don't set the data to zero. This tree is not an error and the others members can still be used.
  • If a null tree is returned, don't set the data to zero. Matches the previous change.
  • If a null tree is returned, do not call free_bvhtree_from_mesh or free_bvhtree_from_editmesh. They don't do anything in this case.

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 21459
Build 21459: arc lint + arc unit

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.Apr 4 2022, 10:44 PM
Germano Cavalcante (mano-wii) created this revision.
  • missed data->cached setup member
  • Read the in_cache variable to set the data->cache when available
Germano Cavalcante (mano-wii) planned changes to this revision.Apr 4 2022, 11:58 PM

data->cached still unset in some places

It looks correct to me. The fact that there's two ways to fill in data is still very confusing to me, but seems no worse than before.

This revision is now accepted and ready to land.Apr 5 2022, 10:17 PM