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

#include <GT_AttributeList.h>

+ Inheritance diagram for GT_AttributeList:

Classes

class  iterator
 

Public Member Functions

 GT_AttributeList (const GT_AttributeMapHandle &map, int motion_segments=1)
 
 GT_AttributeList (const GT_AttributeList &src)
 
 ~GT_AttributeList ()
 
GT_AttributeListHandle addAttribute (const UT_StringHolder &name, const GT_DataArrayHandle *handles, int num_segments, bool replace_existing) const
 Create a new attribute list, adding a new attribute in the process. More...
 
GT_AttributeListHandle addAttribute (const UT_StringHolder &name, const GT_DataArrayHandle &h, bool replace_existing) const
 
GT_AttributeListHandle removeAttribute (const UT_StringRef &name) const
 Remove an attribute from this list, returning a new attribute list. More...
 
GT_AttributeListHandle removeAttributes (const UT_StringArray &name) const
 Remove multiple attributes from this, returning a new attribute list. More...
 
void harden ()
 Harden all the attribute lists. More...
 
void harden (int idx)
 Harden a single attribute. More...
 
const GT_AttributeMapHandlegetMap () const
 Get a handle to the name map for this list. More...
 
int entries () const
 Return the number of attributes in the list. More...
 
int64 getMemoryUsage () const
 
int getSegments () const
 Return the number of motion segements. More...
 
const UT_StringArraygetNames () const
 Return the list of names. More...
 
const GT_DataArrayHandleget (const UT_StringRef &name, int segment=0) const
 Return the data for the named array. More...
 
const GT_DataArrayHandleget (int index, int motion_segment=0) const
 Return the data for a given index. More...
 
const UT_StringHoldergetName (int index) const
 Return the name for a given index. More...
 
const UT_StringHoldergetExportName (int index) const
 Return the export name for a given index. More...
 
GT_Owner getOriginalOwner (int idx) const
 Get original attribute owner for the given attribute. More...
 
int getIndex (const UT_StringRef &name) const
 Return the index for a given name (returns -1 if miss) More...
 
bool hasName (const UT_StringRef &name) const
 Test of an attribute name exists. More...
 
void set (int idx, const GT_DataArrayHandle &h, int motion_segment=0)
 Assign an array to a given index in the list. More...
 
void setAllSegments (int idx, const GT_DataArrayHandle &h)
 Assign an array to a given index in the list for all motion segments. More...
 
bool copySegment (int dest_segment, const GT_AttributeListHandle &source_list, int source_segment=0)
 
GT_AttributeListHandle transform (const GT_TransformHandle &x) const
 Create a transformed version of the attributes. More...
 
GT_AttributeListHandle createConstant (GT_Offset offset, GT_Size size) const
 Create a new attribute list containing. More...
 
GT_AttributeListHandle createSubArray (GT_Offset start, GT_Size size) const
 Create an attribute list of a subset of the contents. More...
 
GT_AttributeListHandle createIndirect (const GT_DataArrayHandle &indirect, bool flatten_nested=true) const
 
GT_AttributeListHandle mergeNewAttributes (const GT_AttributeListHandle &s) const
 Merge attributes which don't already exist in this attribute list. More...
 
GT_AttributeListHandle createUV (int nu, int nv, fpreal64 s0=0, fpreal64 s1=1, fpreal64 t0=0, fpreal64 t1=1) const
 
bool getDataIdHash (int64 &hash, int segment=0) const
 
void updateGeoDetail (const GU_ConstDetailHandle &dtl, GT_Owner scope) const
 Refresh the any detail references and data IDs on all data arrays. More...
 
void dumpList (const char *label="", bool data_too=true)
 Debug method to dump the list to stdout. More...
 
bool save (UT_JSONWriter &w) const
 Save to a JSON stream. More...
 
iterator begin (int segment=0) const
 Traverse over all attributes for a given motion segment. More...
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< GT_AttributeList >
SYS_FORCE_INLINE UT_IntrusiveRefCounter () noexcept
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &) noexcept
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const noexcept
 Return current counter. More...
 
SYS_FORCE_INLINE bool conditionalAddRef () noexcept
 

Static Public Member Functions

template<typename... Pairs>
static GT_AttributeListHandle createAttributeList (Pairs &&...pairs)
 
static bool matchDefinition (const GT_AttributeListHandle &a, const GT_AttributeListHandle &b)
 
static GT_AttributeListHandle createMerged (const GT_AttributeMerge &map, const GT_AttributeListHandle &l0, GT_Offset l0_offset, GT_Size l0_size, const GT_AttributeListHandle &l1, const GT_DataArrayHandle &l1_indirect)
 
static GT_AttributeListHandle expandConstantMerge (const GT_AttributeMerge &map, const GT_AttributeListHandle &varying, const GT_AttributeListHandle &constant, GT_Offset const_index=0)
 
static GT_AttributeListHandle createConstantMerge (const GT_AttributeMerge &map, const GT_AttributeListHandle &varying, GT_Offset offset, const GT_AttributeListHandle &constant)
 
static GT_AttributeListHandle concatenateLists (const UT_Array< GT_AttributeListHandle > &lists)
 

Friends

class gt_CreateIndirectTask
 

Additional Inherited Members

- Protected Member Functions inherited from UT_IntrusiveRefCounter< GT_AttributeList >
SYS_FORCE_INLINE ~UT_IntrusiveRefCounter ()
 Destructor: Only derived classes can destruct this. More...
 

Detailed Description

Examples:
RAY/RAY_DemoGT.C.

Definition at line 33 of file GT_AttributeList.h.

Constructor & Destructor Documentation

GT_AttributeList::GT_AttributeList ( const GT_AttributeMapHandle map,
int  motion_segments = 1 
)

An attribute list stores a list of GT_DataArray values for each attribute defined in the map. motion_segments specifies the number of different motion segments.

GT_AttributeList::GT_AttributeList ( const GT_AttributeList src)
GT_AttributeList::~GT_AttributeList ( )

Member Function Documentation

GT_AttributeListHandle GT_AttributeList::addAttribute ( const UT_StringHolder name,
const GT_DataArrayHandle handles,
int  num_segments,
bool  replace_existing 
) const

Create a new attribute list, adding a new attribute in the process.

GT_AttributeListHandle GT_AttributeList::addAttribute ( const UT_StringHolder name,
const GT_DataArrayHandle h,
bool  replace_existing 
) const
inline

Definition at line 74 of file GT_AttributeList.h.

iterator GT_AttributeList::begin ( int  segment = 0) const
inline

Traverse over all attributes for a given motion segment.

Definition at line 287 of file GT_AttributeList.h.

static GT_AttributeListHandle GT_AttributeList::concatenateLists ( const UT_Array< GT_AttributeListHandle > &  lists)
static

Merge an array of N lists to form a single attribute list. All the data is concatenated in order.

This method will fail (return an empty list) if any lists don't have matching attributes (including motion segments & order of attributes)

The list may have NULL handles.

bool GT_AttributeList::copySegment ( int  dest_segment,
const GT_AttributeListHandle source_list,
int  source_segment = 0 
)

Copies an entire segment of data arrays from a source list to this list. This is useful when combining multiple primitives into a single motion blurred primitive for example.

Parameters
dest_segment
Data arrays are copied to this segment in this list
source_list
Data arrays are copied from this source list
source_segment
Data arrays are copied from this segment in the source_list
Warning
The source attribute list must have the same maps. The code does not verify that the maps are the same.
template<typename... Pairs>
static GT_AttributeListHandle GT_AttributeList::createAttributeList ( Pairs &&...  pairs)
inlinestatic

Create an attribute list using varying number of (const UT_StringHolder &name, const GT_DataArrayHandle &data) pairs. For example:

Definition at line 53 of file GT_AttributeList.h.

GT_AttributeListHandle GT_AttributeList::createConstant ( GT_Offset  offset,
GT_Size  size 
) const

Create a new attribute list containing.

static GT_AttributeListHandle GT_AttributeList::createConstantMerge ( const GT_AttributeMerge map,
const GT_AttributeListHandle varying,
GT_Offset  offset,
const GT_AttributeListHandle constant 
)
static

Merge two lists, creating a constant value list, selecting a single element from a varying list.

GT_AttributeListHandle GT_AttributeList::createIndirect ( const GT_DataArrayHandle indirect,
bool  flatten_nested = true 
) const

Create a new attribute list based on the indirect indicies in the list

static GT_AttributeListHandle GT_AttributeList::createMerged ( const GT_AttributeMerge map,
const GT_AttributeListHandle l0,
GT_Offset  l0_offset,
GT_Size  l0_size,
const GT_AttributeListHandle l1,
const GT_DataArrayHandle l1_indirect 
)
static

Create a merged list of the two lists. This will merge a sub-array of the first list and an indirect mapping of the second list. This is used to merge a vertex list (l0) with a point list (l1)

GT_AttributeListHandle GT_AttributeList::createSubArray ( GT_Offset  start,
GT_Size  size 
) const

Create an attribute list of a subset of the contents.

GT_AttributeListHandle GT_AttributeList::createUV ( int  nu,
int  nv,
fpreal64  s0 = 0,
fpreal64  s1 = 1,
fpreal64  t0 = 0,
fpreal64  t1 = 1 
) const

Create the "s" and "t" attributes for the given u/v vertex count. The attributes will only be created if nu or nv is greater than 0

void GT_AttributeList::dumpList ( const char *  label = "",
bool  data_too = true 
)

Debug method to dump the list to stdout.

int GT_AttributeList::entries ( ) const
inline

Return the number of attributes in the list.

Definition at line 98 of file GT_AttributeList.h.

static GT_AttributeListHandle GT_AttributeList::expandConstantMerge ( const GT_AttributeMerge map,
const GT_AttributeListHandle varying,
const GT_AttributeListHandle constant,
GT_Offset  const_index = 0 
)
static

Merge two lists, expanding the constant list to have arrays matching the length of the varying array.

const GT_DataArrayHandle& GT_AttributeList::get ( const UT_StringRef name,
int  segment = 0 
) const
inline

Return the data for the named array.

Definition at line 114 of file GT_AttributeList.h.

const GT_DataArrayHandle& GT_AttributeList::get ( int  index,
int  motion_segment = 0 
) const

Return the data for a given index.

bool GT_AttributeList::getDataIdHash ( int64 hash,
int  segment = 0 
) const

Get a 64b hash of all data ids in the list. Return false if any attribs have an invalid data id (-1)

const UT_StringHolder& GT_AttributeList::getExportName ( int  index) const
inline

Return the export name for a given index.

Definition at line 127 of file GT_AttributeList.h.

int GT_AttributeList::getIndex ( const UT_StringRef name) const
inline

Return the index for a given name (returns -1 if miss)

Definition at line 135 of file GT_AttributeList.h.

const GT_AttributeMapHandle& GT_AttributeList::getMap ( ) const
inline

Get a handle to the name map for this list.

Definition at line 95 of file GT_AttributeList.h.

int64 GT_AttributeList::getMemoryUsage ( ) const

Return the approximate memory usage. Because data can be shared, this may not reflect the usage accurately.

const UT_StringHolder& GT_AttributeList::getName ( int  index) const
inline

Return the name for a given index.

Definition at line 123 of file GT_AttributeList.h.

const UT_StringArray& GT_AttributeList::getNames ( ) const
inline

Return the list of names.

Definition at line 110 of file GT_AttributeList.h.

GT_Owner GT_AttributeList::getOriginalOwner ( int  idx) const
inline

Get original attribute owner for the given attribute.

Definition at line 131 of file GT_AttributeList.h.

int GT_AttributeList::getSegments ( ) const
inline

Return the number of motion segements.

Definition at line 106 of file GT_AttributeList.h.

void GT_AttributeList::harden ( )

Harden all the attribute lists.

void GT_AttributeList::harden ( int  idx)

Harden a single attribute.

bool GT_AttributeList::hasName ( const UT_StringRef name) const
inline

Test of an attribute name exists.

Definition at line 139 of file GT_AttributeList.h.

static bool GT_AttributeList::matchDefinition ( const GT_AttributeListHandle a,
const GT_AttributeListHandle b 
)
static

Test whether two attribute lists match in their definition. If both attribute lists are empty, this will count as a match.

GT_AttributeListHandle GT_AttributeList::mergeNewAttributes ( const GT_AttributeListHandle s) const

Merge attributes which don't already exist in this attribute list.

GT_AttributeListHandle GT_AttributeList::removeAttribute ( const UT_StringRef name) const

Remove an attribute from this list, returning a new attribute list.

GT_AttributeListHandle GT_AttributeList::removeAttributes ( const UT_StringArray name) const

Remove multiple attributes from this, returning a new attribute list.

bool GT_AttributeList::save ( UT_JSONWriter w) const

Save to a JSON stream.

void GT_AttributeList::set ( int  idx,
const GT_DataArrayHandle h,
int  motion_segment = 0 
)

Assign an array to a given index in the list.

Examples:
RAY/RAY_DemoGT.C.
void GT_AttributeList::setAllSegments ( int  idx,
const GT_DataArrayHandle h 
)

Assign an array to a given index in the list for all motion segments.

GT_AttributeListHandle GT_AttributeList::transform ( const GT_TransformHandle x) const

Create a transformed version of the attributes.

void GT_AttributeList::updateGeoDetail ( const GU_ConstDetailHandle dtl,
GT_Owner  scope 
) const

Refresh the any detail references and data IDs on all data arrays.

Friends And Related Function Documentation

friend class gt_CreateIndirectTask
friend

Definition at line 290 of file GT_AttributeList.h.


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