Bifrost SDK
Bifrost SDK documentation
Bifrost::Geometry::RangeGeoPropertyGuard Class Reference

This class is a RAII guard for a Range geo property. More...

#include <GeoPropertyGuard.h>

Public Member Functions

 RangeGeoPropertyGuard ()=default
 Constructor. More...
 
 operator bool () const noexcept
 Returns true if the guard has acquired a geo property. More...
 
const Amino::Array< Bifrost::Geometry::Index > & indices () const noexcept
 Returns the index array of the geo property. More...
 
Amino::Array< Bifrost::Geometry::Index > & indices () noexcept
 Returns the index array of the geo property. More...
 
const Amino::Stringtarget () const noexcept
 Returns the target of the geo property. More...
 
Amino::Stringtarget () noexcept
 Returns the target of the geo property. More...
 
const Amino::Array< Amino::String > & dependsOn () const noexcept
 Returns the value of the depends_on field in the geo property. More...
 
Amino::Array< Amino::String > & dependsOn () noexcept
 Returns the value of the depends_on field in the geo property. More...
 

Detailed Description

This class is a RAII guard for a Range geo property.

This class is used to extract, modify and then set back a Range geo property value within a geometry object. This is the preferred method to modify the geo properties of a geometry since extracting the geo property does not increase its reference count, and thus if there are no other references to the value, it will be modified in-place and no copy-on-write will occur. See Amino::Ptr for more details on reference counting.

Do not construct a RangeGeoProperty guard directly. Use Bifrost::Geometry::createRangeGeoPropGuard instead.

{
// Extract the point positions from the mesh.
auto uvIndices = Bifrost::Geometry::createRangeGeoPropGuard(mesh, "face_vertex_uv_index");
// As a trivial modification, swap the first and last indices.
std::swap(uvIndices.indices().front(), uvIndices.indices().back());
} // At this point the guard is destroyed and the uvIndices are set back into the mesh.
void swap(Any &lhs, Any &rhs) noexcept
Swap the payloads of two instances of Any.
Definition: Any.h:358
BIFROST_GEOMETRY_DECL RangeGeoPropertyGuard createRangeGeoPropGuard(Bifrost::Object &geometry, Amino::StringView propertyName)
Create a RangeGeoPropertyGuard for the specified range geo property.

Definition at line 439 of file GeoPropertyGuard.h.

Constructor & Destructor Documentation

◆ RangeGeoPropertyGuard()

Bifrost::Geometry::RangeGeoPropertyGuard::RangeGeoPropertyGuard ( )
default

Constructor.

Member Function Documentation

◆ dependsOn() [1/2]

const Amino::Array< Amino::String > & Bifrost::Geometry::RangeGeoPropertyGuard::dependsOn ( ) const
inlinenoexcept

Returns the value of the depends_on field in the geo property.

Precondition
This guard has already acquired a geo property.

Definition at line 463 of file GeoPropertyGuard.h.

◆ dependsOn() [2/2]

Amino::Array< Amino::String > & Bifrost::Geometry::RangeGeoPropertyGuard::dependsOn ( )
inlinenoexcept

Returns the value of the depends_on field in the geo property.

Precondition
This guard has already acquired a geo property.

Definition at line 466 of file GeoPropertyGuard.h.

◆ indices() [1/2]

const Amino::Array< Bifrost::Geometry::Index > & Bifrost::Geometry::RangeGeoPropertyGuard::indices ( ) const
inlinenoexcept

Returns the index array of the geo property.

Precondition
This guard has already acquired a geo property.

Definition at line 449 of file GeoPropertyGuard.h.

◆ indices() [2/2]

Amino::Array< Bifrost::Geometry::Index > & Bifrost::Geometry::RangeGeoPropertyGuard::indices ( )
inlinenoexcept

Returns the index array of the geo property.

Precondition
This guard has already acquired a geo property.

Definition at line 452 of file GeoPropertyGuard.h.

◆ operator bool()

Bifrost::Geometry::RangeGeoPropertyGuard::operator bool ( ) const
inlineexplicitnoexcept

Returns true if the guard has acquired a geo property.

Definition at line 445 of file GeoPropertyGuard.h.

◆ target() [1/2]

const Amino::String & Bifrost::Geometry::RangeGeoPropertyGuard::target ( ) const
inlinenoexcept

Returns the target of the geo property.

Precondition
This guard has already acquired a geo property.

Definition at line 456 of file GeoPropertyGuard.h.

◆ target() [2/2]

Amino::String & Bifrost::Geometry::RangeGeoPropertyGuard::target ( )
inlinenoexcept

Returns the target of the geo property.

Precondition
This guard has already acquired a geo property.

Definition at line 459 of file GeoPropertyGuard.h.