HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BRAY::ObjectPtr Class Reference

#include <BRAY_Interface.h>

Public Types

using FieldList = UT_Array< std::pair< UT_StringHolder, GT_PrimitiveHandle >>
 

Public Member Functions

 ObjectPtr ()=default
 
 ~ObjectPtr ()
 
bool isValid () const
 Test validity. More...
 
bool isLeaf () const
 Query if object is a leaf node (ie not scenegraph or instance) More...
 
bool setMaterial (ScenePtr &scene, const MaterialPtr &mat, const OptionSet &opts, exint nfacesets=0, const FacesetMaterial *faceset_mat=nullptr)
 
void setInstancePrototype (const ObjectPtr &proto)
 Set the prototype for an instance object. More...
 
void setInstanceTransforms (const UT_Array< SpacePtr > &xforms)
 Set the transform on the instance. More...
 
void setInstanceAttributes (const ScenePtr &scene, const GT_AttributeListHandle &alist)
 Set attributes on instances. More...
 
void setInstanceProperties (const ScenePtr &scene, const GT_AttributeListHandle &alist)
 
void setInstanceIds (UT_Array< exint > ids)
 
void addInstanceToScene (ObjectPtr &obj)
 Add an object to a scene. More...
 
bool validateInstance () const
 Check to make sure that number of xforms, attribute list, ids all match. More...
 
GT_PrimitiveHandle geometry () const
 
BRAY_Proceduralprocedural ()
 Pointer to the contained procedural. This may return a nullptr. More...
 
bool setGeometry (const ScenePtr &scene, const GT_PrimitiveHandle &prim)
 
bool setGeometry (const ScenePtr &scene, const GT_PrimitiveHandle &prim, const GT_DataArrayHandle &holes)
 
bool setVolume (const ScenePtr &scene, const GT_AttributeListHandle &clist, const FieldList &fields)
 
const GT_AttributeListHandlevolumeDetailAttributes () const
 Return the detail attributes for a volume primitive. More...
 
void takeOwnership (BRAY_Object *obj)
 TODO: Deprecate this. More...
 
SYS_SAFE_BOOL operator bool () const
 
const BRAY_Object * objectPtr () const
 
BRAY_Object * objectPtr ()
 
OptionSet objectProperties (ScenePtr &scene)
 
const OptionSet objectProperties (const ScenePtr &scene) const
 

Static Public Member Functions

static ObjectPtr createGeometry (const GT_PrimitiveHandle &prim)
 
static ObjectPtr createGeometry (const GT_PrimitiveHandle &prim, const GT_DataArrayHandle &holes)
 For polygonal meshes, use this to create geometry to handle holes. More...
 
static ObjectPtr createVolume (const UT_StringHolder &name)
 
static ObjectPtr createInstance (const ObjectPtr &obj, const UT_StringHolder &name)
 Create an instance of an object. More...
 
static ObjectPtr createScene ()
 Create a nested scene graph. More...
 
static ObjectPtr createProcedural (UT_UniquePtr< BRAY_Procedural > proc)
 

Protected Attributes

UT_SharedPtr< BRAY_Object > myObject
 

Detailed Description

Examples:
karma_procedurals/BRAY_HdBox.C.

Definition at line 588 of file BRAY_Interface.h.

Member Typedef Documentation

Create a volume given its detail attribute and the names and GT_PrimitiveHandles of the corresponding fields in the volume

Definition at line 609 of file BRAY_Interface.h.

Constructor & Destructor Documentation

BRAY::ObjectPtr::ObjectPtr ( )
default
BRAY::ObjectPtr::~ObjectPtr ( )

Member Function Documentation

void BRAY::ObjectPtr::addInstanceToScene ( ObjectPtr obj)

Add an object to a scene.

static ObjectPtr BRAY::ObjectPtr::createGeometry ( const GT_PrimitiveHandle prim)
static

Create an object given a GT_Primitive handle. At the current time, the only classes supported are:

Examples:
karma_procedurals/BRAY_HdBox.C.
static ObjectPtr BRAY::ObjectPtr::createGeometry ( const GT_PrimitiveHandle prim,
const GT_DataArrayHandle holes 
)
static

For polygonal meshes, use this to create geometry to handle holes.

static ObjectPtr BRAY::ObjectPtr::createInstance ( const ObjectPtr obj,
const UT_StringHolder name 
)
static

Create an instance of an object.

Examples:
karma_procedurals/BRAY_HdBox.C.
static ObjectPtr BRAY::ObjectPtr::createProcedural ( UT_UniquePtr< BRAY_Procedural proc)
static

Create a procedural object. Ownership of the procedural is passed to the object.

static ObjectPtr BRAY::ObjectPtr::createScene ( )
static

Create a nested scene graph.

static ObjectPtr BRAY::ObjectPtr::createVolume ( const UT_StringHolder name)
static
GT_PrimitiveHandle BRAY::ObjectPtr::geometry ( ) const

Get the underlying GT_PrimitiveHandle (if possible). This method may return a nullptr.

bool BRAY::ObjectPtr::isLeaf ( ) const

Query if object is a leaf node (ie not scenegraph or instance)

bool BRAY::ObjectPtr::isValid ( ) const
inline

Test validity.

Definition at line 624 of file BRAY_Interface.h.

OptionSet BRAY::ObjectPtr::objectProperties ( ScenePtr scene)

This will return the object's base properties, or the scene defaults if the object isn't defined yet.

const OptionSet BRAY::ObjectPtr::objectProperties ( const ScenePtr scene) const

This will return the object's base properties, or the scene defaults if the object isn't defined yet.

const BRAY_Object* BRAY::ObjectPtr::objectPtr ( ) const
inline

Access to the underlying object

Definition at line 632 of file BRAY_Interface.h.

BRAY_Object* BRAY::ObjectPtr::objectPtr ( )
inline

Access to the underlying object

Definition at line 633 of file BRAY_Interface.h.

SYS_SAFE_BOOL BRAY::ObjectPtr::operator bool ( ) const
inline

Access to the underlying object

Definition at line 631 of file BRAY_Interface.h.

BRAY_Procedural* BRAY::ObjectPtr::procedural ( )

Pointer to the contained procedural. This may return a nullptr.

bool BRAY::ObjectPtr::setGeometry ( const ScenePtr scene,
const GT_PrimitiveHandle prim 
)

Update the geometry for the object. The method will fail if you're trying to change the underlying primitive type.

bool BRAY::ObjectPtr::setGeometry ( const ScenePtr scene,
const GT_PrimitiveHandle prim,
const GT_DataArrayHandle holes 
)

Set the list of "holes" for a polygon mesh (subdivision meshes have the list of holes specified in the subdivision tags).

void BRAY::ObjectPtr::setInstanceAttributes ( const ScenePtr scene,
const GT_AttributeListHandle alist 
)

Set attributes on instances.

void BRAY::ObjectPtr::setInstanceIds ( UT_Array< exint ids)

Set instance IDs. If not set (or given an empty array), it is assumed that the ids are contiguous 0...N-1 where N is the number of xforms.

void BRAY::ObjectPtr::setInstanceProperties ( const ScenePtr scene,
const GT_AttributeListHandle alist 
)

Set property overrides for instances. The array must have an entry for every instance. It's possible to have default options. Each attribute's name should match an object property name. Warnings will be output if an attribute doesn't match.

void BRAY::ObjectPtr::setInstancePrototype ( const ObjectPtr proto)

Set the prototype for an instance object.

void BRAY::ObjectPtr::setInstanceTransforms ( const UT_Array< SpacePtr > &  xforms)

Set the transform on the instance.

bool BRAY::ObjectPtr::setMaterial ( ScenePtr scene,
const MaterialPtr mat,
const OptionSet opts,
exint  nfacesets = 0,
const FacesetMaterial faceset_mat = nullptr 
)

Bind a material to the object. The method will fail if the underlying object cannot set the material.

bool BRAY::ObjectPtr::setVolume ( const ScenePtr scene,
const GT_AttributeListHandle clist,
const FieldList fields 
)

Update volume fields. This method will fail if the underlying primitive isn't a volume (see createVolume())

void BRAY::ObjectPtr::takeOwnership ( BRAY_Object *  obj)

TODO: Deprecate this.

bool BRAY::ObjectPtr::validateInstance ( ) const

Check to make sure that number of xforms, attribute list, ids all match.

const GT_AttributeListHandle& BRAY::ObjectPtr::volumeDetailAttributes ( ) const

Return the detail attributes for a volume primitive.

Member Data Documentation

UT_SharedPtr<BRAY_Object> BRAY::ObjectPtr::myObject
protected

Definition at line 709 of file BRAY_Interface.h.


The documentation for this class was generated from the following file: