12 #ifndef __IMX_Attribute_h__
13 #define __IMX_Attribute_h__
59 bool save(std::ostream &os)
const;
83 void copyMetadataToOptions(
UT_Options &opt)
const;
85 void updateMetadataFromOptions(
const UT_Options &opt);
92 {
return SYSconst_cast(
this)->getCEAttributeAccessor(
true,
false); }
94 {
return getCEAttributeAccessor(
false,
true); }
96 {
return getCEAttributeAccessor(
true,
true); }
100 int tupleSize()
const {
return myData ? myData->tupleSize() : 0; }
104 bool isArray()
const {
return myData ? myData->isArray() :
false; }
117 bool isOnGPU()
const {
return myData ? myData->isOnGPU() :
false; }
118 bool isOnCPU()
const {
return myData ? myData->isOnCPU() :
false; }
122 void setInUseGPUFlag()
const;
123 void clearInUseGPUFlag()
const;
139 bool isDirty()
const {
return !isOnGPU() && !isOnCPU(); }
149 bool allocated()
const {
return myData ?
true :
false; }
151 int64 getMemoryUsage()
const;
152 int64 getDeviceMemoryUsage()
const;
155 { myProperties =
props; }
157 {
return myProperties; }
163 template <
typename OP>
165 { myProperties.update(op); }
180 static void unregisterAttributes(
UT_IntArray ®istered);
186 template <
typename OP>
189 int n = getChannels();
211 template <
typename T,
typename OP>
216 case 1:
op((
T) 0);
break;
221 UT_ASSERT(!
"Unexpected number of channels.");
226 fpreal64 computeMin(
int channel = 0)
const;
227 fpreal64 computeMax(
int channel = 0)
const;
230 fpreal64 computeAverage(
int channel = 0)
const;
231 exint computeMinI(
int channel = 0)
const;
232 exint computeMaxI(
int channel = 0)
const;
244 mutable bool myStealable =
true;
IMX_Attribute & operator=(const IMX_Attribute &other)
UT_SharedPtr< GA_CEAttribute > GA_CEAttributePtr
Definition of a geometry attribute.
Data has no numeric representation.
Class which stores the default values for a GA_Attribute.
void dispatch(const OP &op) const
getFileOption("OpenEXR:storage") storage
bool isDirty() const
True if there are no VDB grids on GPU or CPU.
UT_OptionsHolder myProperties
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
UT_OptionsHolder properties() const
void swap(T &lhs, T &rhs)
GLuint GLsizei GLsizei * length
JSON reader class which handles parsing of JSON or bJSON files.
GA_TypeInfo typeInfo() const
Class which writes ASCII or binary JSON streams.
void setOwner(GA_AttributeOwner owner)
exint GA_Size
Defines the bit width for index and offset types in GA.
void setStealable(bool v) const
UT_SharedPtr< GA_CEAttribute > myData
GA_StorageClass storage() const
void setTypeInfo(GA_TypeInfo typeinfo)
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
GA_AttributeOwner owner() const
UT_SharedPtr< const GA_CEAttribute > GA_CEAttributeConstPtr
GA_CEAttributeConstPtr data() const
IMX_Attribute(IMX_Attribute &&other) noexcept
UT_SharedPtr< const IMX_Attribute > IMX_AttributeConstPtr
static void dispatch(const OP &op, int channels)
UT_SharedPtr< IMX_Attribute > IMX_AttributePtr
GA_CEAttributeAccessorPtr getCEAttributeAccessorRW()
void updateProperties(const OP &op)
IMX_Attribute(const IMX_Attribute &other)
UT_SharedPtr< GA_CEAttributeAccessor > GA_CEAttributeAccessorPtr
GLenum GLint GLint * precision
void setDefaults(const GA_Defaults &def)
IMX_Attribute & operator=(IMX_Attribute &&other)
A map of string to various well defined value types.
const GA_Defaults & defaults() const
GA_CEAttributeAccessorPtr getCEAttributeAccessorW()
GLubyte GLubyte GLubyte GLubyte w
GA_CEAttributeAccessorPtr getCEAttributeAccessorR() const
IMX_API size_t UTformatBuffer(char *buffer, size_t buffer_size, const IMX_Attribute &v)
void setProperties(const UT_OptionsHolder &props)
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
GA_Precision precision() const
GLenum GLuint GLsizei const GLenum * props