HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
commandSettingsAPI.cpp
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #include ".//commandSettingsAPI.h"
26 #include "pxr/usd/usd/typed.h"
27 #include "pxr/usd/usd/tokens.h"
28 
29 #include "pxr/usd/sdf/types.h"
30 #include "pxr/usd/sdf/assetPath.h"
31 
33 
34 // Register the schema with the TfType system.
36 {
39 
40 }
41 
43  _schemaTokens,
44  (KarmaCommandSettingsAPI)
45 );
46 
47 /* virtual */
49 {
50 }
51 
52 /* static */
54 usdKarmaCommandSettingsAPI::Get(const UsdStagePtr &stage, const SdfPath &path)
55 {
56  if (!stage) {
57  TF_CODING_ERROR("Invalid stage");
59  }
60  return usdKarmaCommandSettingsAPI(stage->GetPrimAtPath(path));
61 }
62 
63 
64 /* virtual */
67 }
68 
69 /* static */
72 {
73  return UsdAPISchemaBase::_ApplyAPISchema<usdKarmaCommandSettingsAPI>(
74  prim, _schemaTokens->KarmaCommandSettingsAPI);
75 }
76 
77 /* static */
78 const TfType &
79 usdKarmaCommandSettingsAPI::_GetStaticTfType()
80 {
81  static TfType tfType = TfType::Find<usdKarmaCommandSettingsAPI>();
82  return tfType;
83 }
84 
85 /* static */
86 bool
87 usdKarmaCommandSettingsAPI::_IsTypedSchema()
88 {
89  static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
90  return isTyped;
91 }
92 
93 /* virtual */
94 const TfType &
95 usdKarmaCommandSettingsAPI::_GetTfType() const
96 {
97  return _GetStaticTfType();
98 }
99 
102 {
103  return GetPrim().GetAttribute(usdKarmaTokens()->karmaCommandCheckpoint);
104 }
105 
107 usdKarmaCommandSettingsAPI::CreateKarmaCommandCheckpointAttr(VtValue const &defaultValue, bool writeSparsely) const
108 {
109  return UsdSchemaBase::_CreateAttr(usdKarmaTokens()->karmaCommandCheckpoint,
110  SdfValueTypeNames->Int,
111  /* custom = */ false,
113  defaultValue,
114  writeSparsely);
115 }
116 
119 {
120  return GetPrim().GetAttribute(usdKarmaTokens()->karmaCommandFrame);
121 }
122 
124 usdKarmaCommandSettingsAPI::CreateKarmaCommandFrameAttr(VtValue const &defaultValue, bool writeSparsely) const
125 {
126  return UsdSchemaBase::_CreateAttr(usdKarmaTokens()->karmaCommandFrame,
127  SdfValueTypeNames->Float,
128  /* custom = */ false,
130  defaultValue,
131  writeSparsely);
132 }
133 
136 {
137  return GetPrim().GetAttribute(usdKarmaTokens()->karmaCommandFrame_count);
138 }
139 
141 usdKarmaCommandSettingsAPI::CreateKarmaCommandFrame_countAttr(VtValue const &defaultValue, bool writeSparsely) const
142 {
143  return UsdSchemaBase::_CreateAttr(usdKarmaTokens()->karmaCommandFrame_count,
144  SdfValueTypeNames->Int,
145  /* custom = */ false,
147  defaultValue,
148  writeSparsely);
149 }
150 
153 {
154  return GetPrim().GetAttribute(usdKarmaTokens()->karmaCommandFrame_inc);
155 }
156 
158 usdKarmaCommandSettingsAPI::CreateKarmaCommandFrame_incAttr(VtValue const &defaultValue, bool writeSparsely) const
159 {
160  return UsdSchemaBase::_CreateAttr(usdKarmaTokens()->karmaCommandFrame_inc,
161  SdfValueTypeNames->Float,
162  /* custom = */ false,
164  defaultValue,
165  writeSparsely);
166 }
167 
170 {
171  return GetPrim().GetAttribute(usdKarmaTokens()->karmaCommandTimelimit);
172 }
173 
175 usdKarmaCommandSettingsAPI::CreateKarmaCommandTimelimitAttr(VtValue const &defaultValue, bool writeSparsely) const
176 {
177  return UsdSchemaBase::_CreateAttr(usdKarmaTokens()->karmaCommandTimelimit,
178  SdfValueTypeNames->Int,
179  /* custom = */ false,
181  defaultValue,
182  writeSparsely);
183 }
184 
187 {
188  return GetPrim().GetAttribute(usdKarmaTokens()->karmaCommandTimelimit_image);
189 }
190 
193 {
194  return UsdSchemaBase::_CreateAttr(usdKarmaTokens()->karmaCommandTimelimit_image,
195  SdfValueTypeNames->Bool,
196  /* custom = */ false,
198  defaultValue,
199  writeSparsely);
200 }
201 
204 {
205  return GetPrim().GetAttribute(usdKarmaTokens()->karmaCommandTimelimit_nosave_partial);
206 }
207 
210 {
211  return UsdSchemaBase::_CreateAttr(usdKarmaTokens()->karmaCommandTimelimit_nosave_partial,
212  SdfValueTypeNames->Bool,
213  /* custom = */ false,
215  defaultValue,
216  writeSparsely);
217 }
218 
219 namespace {
220 static inline TfTokenVector
221 _ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
222 {
224  result.reserve(left.size() + right.size());
225  result.insert(result.end(), left.begin(), left.end());
226  result.insert(result.end(), right.begin(), right.end());
227  return result;
228 }
229 }
230 
231 /*static*/
232 const TfTokenVector&
234 {
235  static TfTokenVector localNames = {
236  usdKarmaTokens()->karmaCommandCheckpoint,
237  usdKarmaTokens()->karmaCommandFrame,
238  usdKarmaTokens()->karmaCommandFrame_count,
239  usdKarmaTokens()->karmaCommandFrame_inc,
240  usdKarmaTokens()->karmaCommandTimelimit,
241  usdKarmaTokens()->karmaCommandTimelimit_image,
242  usdKarmaTokens()->karmaCommandTimelimit_nosave_partial,
243  };
244  static TfTokenVector allNames =
245  _ConcatenateAttributeNames(
247  localNames);
248 
249  if (includeInherited)
250  return allNames;
251  else
252  return localNames;
253 }
254 
256 
257 // ===================================================================== //
258 // Feel free to add custom code below this line. It will be preserved by
259 // the code generator.
260 //
261 // Just remember to wrap code in the appropriate delimiters:
262 // 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
263 // ===================================================================== //
264 // --(BEGIN CUSTOM CODE)--
virtual ~usdKarmaCommandSettingsAPI()
Destructor.
UsdAttribute CreateKarmaCommandTimelimit_nosave_partialAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
TF_DEFINE_PRIVATE_TOKENS(_schemaTokens,(KarmaCommandSettingsAPI))
UsdAttribute GetKarmaCommandTimelimitAttr() const
GLint left
Definition: glew.h:8008
#define TF_CODING_ERROR
UsdAttribute CreateKarmaCommandFrameAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdAttribute CreateKarmaCommandFrame_incAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
usdKarmaCommandSettingsAPI(const UsdPrim &prim=UsdPrim())
UsdAttribute GetKarmaCommandFrame_incAttr() const
PXR_NAMESPACE_OPEN_SCOPE TF_REGISTRY_FUNCTION(TfType)
static TfType const & Define()
Definition: type_Impl.h:78
UsdAttribute CreateKarmaCommandTimelimitAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
static const UsdSchemaType schemaType
UsdAttribute GetKarmaCommandFrame_countAttr() const
UsdSchemaType
Definition: common.h:149
Definition: prim.h:131
Definition: typed.h:47
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:438
GLfloat right
Definition: glew.h:15186
Definition: path.h:287
UsdAttribute CreateKarmaCommandTimelimit_imageAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
virtual UsdSchemaType _GetSchemaType() const
static usdKarmaCommandSettingsAPI Apply(const UsdPrim &prim)
static const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
GLsizei const GLchar *const * path
Definition: glew.h:6461
UsdAttribute GetKarmaCommandFrameAttr() const
static usdKarmaCommandSettingsAPI Get(const UsdStagePtr &stage, const SdfPath &path)
SDF_API TfStaticData< const Sdf_ValueTypeNamesType, Sdf_ValueTypeNamesType::_Init > SdfValueTypeNames
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1245
USD_API UsdAttribute _CreateAttr(TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const
UsdAttribute CreateKarmaCommandCheckpointAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:83
static USD_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Definition: type.h:70
GLuint64EXT * result
Definition: glew.h:14007
TF_API bool IsA(TfType queryType) const
TfStaticData< usdKarmaTokensType > & usdKarmaTokens()
Definition: tokens.cpp:168
UsdAttribute CreateKarmaCommandFrame_countAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USD_API UsdAttribute GetAttribute(const TfToken &attrName) const
UsdAttribute GetKarmaCommandTimelimit_imageAttr() const
UsdPrim GetPrim() const
Return this schema object's held prim.
Definition: schemaBase.h:119
UsdAttribute GetKarmaCommandCheckpointAttr() const
Definition: value.h:182
UsdAttribute GetKarmaCommandTimelimit_nosave_partialAttr() const