All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
property.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_USD_PROPERTY_H
8#define PXR_USD_USD_PROPERTY_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usd/api.h"
12#include "pxr/usd/usd/common.h"
13#include "pxr/usd/usd/object.h"
14#include "pxr/usd/usd/prim.h"
15
16#include "pxr/usd/sdf/path.h"
18#include "pxr/base/vt/value.h"
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22
23class UsdProperty;
24
38class UsdProperty : public UsdObject {
39public:
42
43 // --------------------------------------------------------------------- //
45 // --------------------------------------------------------------------- //
46
48
68 USD_API
69 SdfPropertySpecHandleVector GetPropertyStack(
70 UsdTimeCode time = UsdTimeCode::Default()) const;
71
85 USD_API
86 std::vector<std::pair<SdfPropertySpecHandle, SdfLayerOffset>>
88 UsdTimeCode time = UsdTimeCode::Default()) const;
89
97 USD_API
99
105 USD_API
107
110 USD_API
111 std::vector<std::string> SplitName() const;
112
116
120 USD_API
121 std::string GetDisplayGroup() const;
122
130 USD_API
131 bool SetDisplayGroup(const std::string& displayGroup) const;
132
135 USD_API
136 bool ClearDisplayGroup() const;
137
140 USD_API
142
145 USD_API
146 std::vector<std::string> GetNestedDisplayGroups() const;
147
155 USD_API
157 const std::vector<std::string>& nestedGroups) const;
158
166 USD_API
167 bool IsCustom() const;
168
175 USD_API
176 bool SetCustom(bool isCustom) const;
177
181
192 USD_API
193 bool IsDefined() const;
194
197 USD_API
198 bool IsAuthored() const;
199
205 USD_API
206 bool IsAuthoredAt(const class UsdEditTarget &editTarget) const;
207
209
210 // --------------------------------------------------------------------- //
212 // --------------------------------------------------------------------- //
213
234 USD_API
235 UsdProperty FlattenTo(const UsdPrim &parent) const;
236
244 USD_API
246 const TfToken &propName) const;
247
254 USD_API
255 UsdProperty FlattenTo(const UsdProperty &property) const;
256
257protected:
258 template <class Derived>
259 UsdProperty(_Null<Derived>) : UsdObject(_Null<Derived>()) {}
260
261 // Gets the targets of the given spec type. Returns true if an authored
262 // opinion is found and no composition errors occured. If foundErrors is
263 // provided, it will be set to true only if errors are encountered.
264 bool _GetTargets(SdfSpecType specType, SdfPathVector *out,
265 bool *foundErrors = nullptr) const;
266
267private:
268 friend class UsdAttribute;
269 friend class UsdObject;
270 friend class UsdPrim;
271 friend class UsdRelationship;
272 friend class Usd_PrimData;
273
274 UsdProperty(UsdObjType objType,
275 const Usd_PrimDataHandle &prim,
276 const SdfPath &proxyPrimPath,
277 const TfToken &propName)
278 : UsdObject(objType, prim, proxyPrimPath, propName) {}
279
280};
281
282
283PXR_NAMESPACE_CLOSE_SCOPE
284
285#endif // PXR_USD_USD_PROPERTY_H
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:167
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:64
Base class for Usd scenegraph objects, providing common API.
Definition: object.h:115
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Definition: property.h:38
USD_API std::string GetDisplayGroup() const
Return this property's display group (metadata).
USD_API TfToken GetBaseName() const
Return this property's name with all namespace prefixes removed, i.e.
USD_API SdfPropertySpecHandleVector GetPropertyStack(UsdTimeCode time=UsdTimeCode::Default()) const
Returns a strength-ordered list of property specs that provide opinions for this property.
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 IsDefined() const
Return true if this is a builtin property or if the strongest authored SdfPropertySpec for this prope...
USD_API bool ClearDisplayGroup() const
Clears this property's display group (metadata) in the current EditTarget (only).
UsdProperty()
Construct an invalid property.
Definition: property.h:41
USD_API bool SetDisplayGroup(const std::string &displayGroup) const
Sets this property's display group (metadata).
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 edi...
USD_API TfToken GetNamespace() const
Return this property's complete namespace prefix.
USD_API std::vector< std::string > GetNestedDisplayGroups() const
Return this property's displayGroup as a sequence of groups to be nested, or an empty vector if displ...
USD_API bool HasAuthoredDisplayGroup() const
Returns true if displayGroup was explicitly authored and GetMetadata() will return a meaningful value...
USD_API UsdProperty FlattenTo(const UsdProperty &property) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
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 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's display group (metadata) to the nested sequence.
USD_API UsdProperty FlattenTo(const UsdPrim &parent, const TfToken &propName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API std::vector< std::pair< SdfPropertySpecHandle, SdfLayerOffset > > GetPropertyStackWithLayerOffsets(UsdTimeCode time=UsdTimeCode::Default()) const
Returns a strength-ordered list of property specs that provide opinions for this property paired with...
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 std::vector< std::string > SplitName() const
Return this property's name elements including namespaces and its base name as the final element.
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:111
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:72
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:113
UsdObjType
Enum values to represent the various Usd object types.
Definition: object.h:35
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:68