Loading...
Searching...
No Matches
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
123 USD_API
124 std::string GetDisplayGroup() const;
125
136 USD_API
137 bool SetDisplayGroup(const std::string& displayGroup) const;
138
144 USD_API
145 bool ClearDisplayGroup() const;
146
152 USD_API
154
160 USD_API
161 std::vector<std::string> GetNestedDisplayGroups() const;
162
173 USD_API
175 const std::vector<std::string>& nestedGroups) const;
176
184 USD_API
185 bool IsCustom() const;
186
193 USD_API
194 bool SetCustom(bool isCustom) const;
195
199
210 USD_API
211 bool IsDefined() const;
212
215 USD_API
216 bool IsAuthored() const;
217
223 USD_API
224 bool IsAuthoredAt(const class UsdEditTarget &editTarget) const;
225
227
228 // --------------------------------------------------------------------- //
230 // --------------------------------------------------------------------- //
231
252 USD_API
253 UsdProperty FlattenTo(const UsdPrim &parent) const;
254
262 USD_API
264 const TfToken &propName) const;
265
272 USD_API
273 UsdProperty FlattenTo(const UsdProperty &property) const;
274
275protected:
276 template <class Derived>
277 UsdProperty(_Null<Derived>) : UsdObject(_Null<Derived>()) {}
278
279 // Gets the targets of the given spec type. Returns true if an authored
280 // opinion is found and no composition errors occured. If foundErrors is
281 // provided, it will be set to true only if errors are encountered.
282 bool _GetTargets(SdfSpecType specType, SdfPathVector *out,
283 bool *foundErrors = nullptr) const;
284
285private:
286 friend class UsdAttribute;
287 friend class UsdObject;
288 friend class UsdPrim;
289 friend class UsdRelationship;
290 friend class Usd_PrimData;
291
292 UsdProperty(UsdObjType objType,
293 const Usd_PrimDataHandle &prim,
294 const SdfPath &proxyPrimPath,
295 const TfToken &propName)
296 : UsdObject(objType, prim, proxyPrimPath, propName) {}
297
298};
299
300
301PXR_NAMESPACE_CLOSE_SCOPE
302
303#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:183
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
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:68
UsdObjType
Enum values to represent the various Usd object types.
Definition: object.h:35