All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
property.h
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 #ifndef USD_PROPERTY_H
25 #define USD_PROPERTY_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/usd/api.h"
29 #include "pxr/usd/usd/common.h"
30 #include "pxr/usd/usd/object.h"
31 #include "pxr/usd/usd/prim.h"
32 
33 #include "pxr/usd/sdf/path.h"
34 #include "pxr/usd/sdf/propertySpec.h"
35 #include "pxr/base/vt/value.h"
36 
37 PXR_NAMESPACE_OPEN_SCOPE
38 
39 
40 class UsdProperty;
41 
55 class UsdProperty : public UsdObject {
56 public:
59  : UsdObject(UsdTypeProperty, Usd_PrimDataHandle(), SdfPath(), TfToken())
60  {
61  }
62 
63  // --------------------------------------------------------------------- //
65  // --------------------------------------------------------------------- //
66 
68 
88  USD_API
89  SdfPropertySpecHandleVector GetPropertyStack(
90  UsdTimeCode time = UsdTimeCode::Default()) const;
91 
99  USD_API
100  TfToken GetBaseName() const;
101 
107  USD_API
108  TfToken GetNamespace() const;
109 
112  USD_API
113  std::vector<std::string> SplitName() const;
114 
118 
122  USD_API
123  std::string GetDisplayGroup() const;
124 
132  USD_API
133  bool SetDisplayGroup(const std::string& displayGroup) const;
134 
137  USD_API
138  bool ClearDisplayGroup() const;
139 
142  USD_API
143  bool HasAuthoredDisplayGroup() const;
144 
147  USD_API
148  std::vector<std::string> GetNestedDisplayGroups() const;
149 
157  USD_API
159  const std::vector<std::string>& nestedGroups) const;
160 
164  USD_API
165  std::string GetDisplayName() const;
166 
172  USD_API
173  bool SetDisplayName(const std::string& name) const;
174 
177  USD_API
178  bool ClearDisplayName() const;
179 
182  USD_API
183  bool HasAuthoredDisplayName() const;
184 
192  USD_API
193  bool IsCustom() const;
194 
201  USD_API
202  bool SetCustom(bool isCustom) const;
203 
207 
218  USD_API
219  bool IsDefined() const;
220 
223  USD_API
224  bool IsAuthored() const;
225 
231  USD_API
232  bool IsAuthoredAt(const class UsdEditTarget &editTarget) const;
233 
235 
236  // --------------------------------------------------------------------- //
238  // --------------------------------------------------------------------- //
239 
257  USD_API
258  UsdProperty FlattenTo(const UsdPrim &parent) const;
259 
264  USD_API
265  UsdProperty FlattenTo(const UsdPrim &parent,
266  const TfToken &propName) const;
267 
271  USD_API
272  UsdProperty FlattenTo(const UsdProperty &property) const;
273 
274 protected:
275  bool _GetTargets(SdfSpecType specType, SdfPathVector *out) const;
276 
277 private:
278  friend class UsdAttribute;
279  friend class UsdObject;
280  friend class UsdPrim;
281  friend class UsdRelationship;
282  friend class Usd_PrimData;
283 
284  UsdProperty(UsdObjType objType,
285  const Usd_PrimDataHandle &prim,
286  const SdfPath &proxyPrimPath,
287  const TfToken &propName)
288  : UsdObject(objType, prim, proxyPrimPath, propName) {}
289 
290 };
291 
292 
293 PXR_NAMESPACE_CLOSE_SCOPE
294 
295 #endif // USD_PROPERTY_H
USD_API bool IsAuthored() const
Return true if there are any authored opinions for this property in any layer that contributes to thi...
USD_API UsdProperty FlattenTo(const UsdPrim &parent) const
Flattens this property to a property spec with the same name beneath the given parent prim in the cur...
USD_API SdfPropertySpecHandleVector GetPropertyStack(UsdTimeCode time=UsdTimeCode::Default()) const
Returns a strength-ordered list of property specs that provide opinions for this property.
UsdObjType
Enum values to represent the various Usd object types.
Definition: object.h:48
USD_API bool SetCustom(bool isCustom) const
Set the value for custom at the current EditTarget, return true on success, false if the value can no...
USD_API bool SetDisplayName(const std::string &name) const
Sets this property&#39;s display name (metadata).
USD_API TfToken GetNamespace() const
Return this property&#39;s complete namespace prefix.
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:91
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
USD_API bool HasAuthoredDisplayName() const
Returns true if displayName was explicitly authored and GetMetadata() will return a meaningful value ...
USD_API std::string GetDisplayName() const
Return this property&#39;s display name (metadata).
USD_API std::string GetDisplayGroup() const
Return this property&#39;s display group (metadata).
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
USD_API std::vector< std::string > SplitName() const
Return this property&#39;s name elements including namespaces and its base name as the final element...
USD_API std::vector< std::string > GetNestedDisplayGroups() const
Return this property&#39;s displayGroup as a sequence of groups to be nested, or an empty vector if displ...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
Base class for Usd scenegraph objects, providing common API.
Definition: object.h:129
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:78
USD_API bool IsDefined() const
Return true if this is a builtin property or if the strongest authored SdfPropertySpec for this prope...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:131
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
UsdProperty()
Construct an invalid property.
Definition: property.h:58
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:128
USD_API bool HasAuthoredDisplayGroup() const
Returns true if displayGroup was explicitly authored and GetMetadata() will return a meaningful value...
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Definition: property.h:55
USD_API bool SetDisplayGroup(const std::string &displayGroup) const
Sets this property&#39;s display group (metadata).
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for &#39;default&#39;.
Definition: timeCode.h:113
USD_API bool ClearDisplayName() const
Clears this property&#39;s display name (metadata) in the current EditTarget (only).
USD_API bool IsCustom() const
Return true if this is a custom property (i.e., not part of a prim schema).
USD_API bool SetNestedDisplayGroups(const std::vector< std::string > &nestedGroups) const
Sets this property&#39;s display group (metadata) to the nested sequence.
USD_API bool IsAuthoredAt(const class UsdEditTarget &editTarget) const
Return true if there is an SdfPropertySpec authored for this property at the given editTarget...
USD_API bool ClearDisplayGroup() const
Clears this property&#39;s display group (metadata) in the current EditTarget (only). ...
USD_API TfToken GetBaseName() const
Return this property&#39;s name with all namespace prefixes removed, i.e.