Loading...
Searching...
No Matches
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 PXR_USD_USD_PROPERTY_H
25#define PXR_USD_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"
35#include "pxr/base/vt/value.h"
36
37PXR_NAMESPACE_OPEN_SCOPE
38
39
40class UsdProperty;
41
55class UsdProperty : public UsdObject {
56public:
59
60 // --------------------------------------------------------------------- //
62 // --------------------------------------------------------------------- //
63
65
85 USD_API
86 SdfPropertySpecHandleVector GetPropertyStack(
87 UsdTimeCode time = UsdTimeCode::Default()) const;
88
102 USD_API
103 std::vector<std::pair<SdfPropertySpecHandle, SdfLayerOffset>>
105 UsdTimeCode time = UsdTimeCode::Default()) const;
106
114 USD_API
116
122 USD_API
124
127 USD_API
128 std::vector<std::string> SplitName() const;
129
133
137 USD_API
138 std::string GetDisplayGroup() const;
139
147 USD_API
148 bool SetDisplayGroup(const std::string& displayGroup) const;
149
152 USD_API
153 bool ClearDisplayGroup() const;
154
157 USD_API
159
162 USD_API
163 std::vector<std::string> GetNestedDisplayGroups() const;
164
172 USD_API
174 const std::vector<std::string>& nestedGroups) const;
175
183 USD_API
184 bool IsCustom() const;
185
192 USD_API
193 bool SetCustom(bool isCustom) const;
194
198
209 USD_API
210 bool IsDefined() const;
211
214 USD_API
215 bool IsAuthored() const;
216
222 USD_API
223 bool IsAuthoredAt(const class UsdEditTarget &editTarget) const;
224
226
227 // --------------------------------------------------------------------- //
229 // --------------------------------------------------------------------- //
230
251 USD_API
252 UsdProperty FlattenTo(const UsdPrim &parent) const;
253
261 USD_API
263 const TfToken &propName) const;
264
271 USD_API
272 UsdProperty FlattenTo(const UsdProperty &property) const;
273
274protected:
275 template <class Derived>
276 UsdProperty(_Null<Derived>) : UsdObject(_Null<Derived>()) {}
277
278 // Gets the targets of the given spec type. Returns true if an authored
279 // opinion is found and no composition errors occured. If foundErrors is
280 // provided, it will be set to true only if errors are encountered.
281 bool _GetTargets(SdfSpecType specType, SdfPathVector *out,
282 bool *foundErrors = nullptr) const;
283
284private:
285 friend class UsdAttribute;
286 friend class UsdObject;
287 friend class UsdPrim;
288 friend class UsdRelationship;
289 friend class Usd_PrimData;
290
291 UsdProperty(UsdObjType objType,
292 const Usd_PrimDataHandle &prim,
293 const SdfPath &proxyPrimPath,
294 const TfToken &propName)
295 : UsdObject(objType, prim, proxyPrimPath, propName) {}
296
297};
298
299
300PXR_NAMESPACE_CLOSE_SCOPE
301
302#endif // PXR_USD_USD_PROPERTY_H
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:79
Base class for Usd scenegraph objects, providing common API.
Definition: object.h:132
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Definition: property.h:55
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:58
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:128
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:84
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:112
UsdObjType
Enum values to represent the various Usd object types.
Definition: object.h:52
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:84