File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 1110.5.x.x (relative to 10.5.15.1)
22========
33
4+ Fixes
5+ -----
6+
7+ - VDBObject : Fixed worldBound() result when bbox metadata not already present.
8+
49API
510---
611
712- SConstruct : Install "private" headers.
13+ - VDBObject : Marked metadata() as deprecated
814
91510.5.15.1 (relative to 10.5.15.0)
1016=========
Original file line number Diff line number Diff line change @@ -88,6 +88,12 @@ class IECOREVDB_API VDBObject : public IECoreScene::VisibleRenderable
8888 Imath::Box3f bound () const override ;
8989 void render ( IECoreScene::Renderer *renderer ) const override ;
9090
91+ // \deprecated
92+ // Not threadsafe ( it computes statistics if not present and stores them on the grids ).
93+ // Instead, use the VDB api, for example:
94+ // findGrid( name )->beginMeta() to iterate the metadata,
95+ // or
96+ // findGrid( name )->evalActiveVoxelBoundingBox() or activeVoxelCount() to compute statistics
9197 IECore::CompoundObjectPtr metadata ( const std::string &name );
9298
9399 // ! Are the grids in this VDBObject unmodified from the vdb file in filename?
Original file line number Diff line number Diff line change @@ -57,11 +57,23 @@ namespace
5757template <typename T>
5858Imath::Box<Imath::Vec3<T> > worldBound ( const openvdb::GridBase *grid, float padding = 0 .50f )
5959{
60- openvdb::Vec3i min = grid->metaValue <openvdb::Vec3i>( grid->META_FILE_BBOX_MIN );
61- openvdb::Vec3i max = grid->metaValue <openvdb::Vec3i>( grid->META_FILE_BBOX_MAX );
60+ openvdb::CoordBBox vdbBbox;
61+ try
62+ {
63+ vdbBbox.min () = openvdb::Coord ( grid->metaValue <openvdb::Vec3i>( grid->META_FILE_BBOX_MIN ) );
64+ vdbBbox.max () = openvdb::Coord ( grid->metaValue <openvdb::Vec3i>( grid->META_FILE_BBOX_MAX ) );
65+ }
66+ catch ( ... )
67+ {
68+ // If we don't have metadata available, then hopefully it's because the vdb was freshly created and
69+ // hasn't been saved to file yet, which should mean it's fully loaded, and we can call
70+ // evalActiveVoxelBoundingBox.
71+ // \todo : Can we guarantee that every VDB either is loaded, or has metadata?
72+ vdbBbox = grid->evalActiveVoxelBoundingBox ();
73+ }
6274
6375 openvdb::Vec3d offset = openvdb::Vec3d ( padding );
64- openvdb::BBoxd indexBounds = openvdb::BBoxd ( min - offset, max + offset );
76+ openvdb::BBoxd indexBounds = openvdb::BBoxd ( vdbBbox. min () - offset, vdbBbox. max () + offset );
6577 openvdb::BBoxd worldBounds = grid->transform ().indexToWorld ( indexBounds );
6678 openvdb::Vec3d minBB = worldBounds.min ();
6779 openvdb::Vec3d maxBB = worldBounds.max ();
You can’t perform that action at this time.
0 commit comments