HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_StandardAttribs.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5 */
6 
7 #ifndef __GEO_StandardAttribs_h__
8 #define __GEO_StandardAttribs_h__
9 
10 #include "GEO_API.h"
11 
12 #include <GA/GA_Defaults.h>
13 #include <GA/GA_Handle.h>
14 #include <GA/GA_Names.h>
15 #include <GEO/GEO_Detail.h>
16 
17 /// Utilities for the standard attributes defined in GA_Names.
18 namespace GEO_StandardAttribs
19 {
20 /// Finds or creates a 3@transform attribute with the appropriate type info and
21 /// default value.
22 inline GA_RWHandleM3D
24 {
25  GA_RWHandleM3D attrib = detail.findFloatTuple(
27  if (!attrib.isValid())
28  {
30  if (detail.getPreferredPrecision() == GA_PRECISION_64)
31  storage = GA_STORE_REAL64;
32 
33  attrib = detail.addFloatTuple(
36  /*creation_args=*/nullptr,
37  /*attribute_options=*/nullptr,
38  storage);
39 
40  }
41 
42  // Always force the type info on existing attributes.
44 
45  return attrib;
46 }
47 
48 /// Finds or creates a 4@localtransform attribute with the appropriate type info and
49 /// default value.
50 inline GA_RWHandleM4D
52 {
53  GA_RWHandleM4D attrib = detail.findFloatTuple(
55  if (!attrib.isValid())
56  {
58  if (detail.getPreferredPrecision() == GA_PRECISION_64)
59  storage = GA_STORE_REAL64;
60 
61  attrib = detail.addFloatTuple(
64  /*creation_args=*/nullptr,
65  /*attribute_options=*/nullptr,
66  storage);
67  }
68 
69  // Always force the type info on existing attributes.
71 
72  return attrib;
73 }
74 }
75 
76 #endif
GA_RWHandleM3D createTransform3(GEO_Detail &detail, GA_AttributeOwner owner=GA_ATTRIB_POINT)
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
GA_Attribute * addFloatTuple(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringHolder &name, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0), const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_REAL32, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
GA_API const UT_StringHolder localtransform
static constexpr int tuple_size
Definition: UT_Matrix3.h:97
GA_Precision getPreferredPrecision() const
GA_API const UT_StringHolder transform
static constexpr const int tuple_size
Definition: UT_Matrix4.h:101
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:187
const GA_Attribute * findFloatTuple(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name, int min_size=1, int max_size=-1) const
GA_AttributeOwner
Definition: GA_Types.h:35
SYS_FORCE_INLINE void setTypeInfo(GA_TypeInfo type)
Definition: GA_Attribute.h:260
GA_RWHandleM4D createLocalTransform4(GEO_Detail &detail, GA_AttributeOwner owner=GA_ATTRIB_POINT)
Data represents a transform matrix. Token "matrix".
Definition: GA_Types.h:118
GA_Storage
Definition: GA_Types.h:51