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 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 
37 PXR_NAMESPACE_OPEN_SCOPE
38 
39 
40 class UsdProperty;
41 
55 class UsdProperty : public UsdObject {
56 public:
59 
60  // --------------------------------------------------------------------- //
62  // --------------------------------------------------------------------- //
63 
65 
85  USD_API
86  SdfPropertySpecHandleVector GetPropertyStack(
87  UsdTimeCode time = UsdTimeCode::Default()) const;
88 
96  USD_API
97  TfToken GetBaseName() const;
98 
104  USD_API
105  TfToken GetNamespace() const;
106 
109  USD_API
110  std::vector<std::string> SplitName() const;
111 
115 
119  USD_API
120  std::string GetDisplayGroup() const;
121 
129  USD_API
130  bool SetDisplayGroup(const std::string& displayGroup) const;
131 
134  USD_API
135  bool ClearDisplayGroup() const;
136 
139  USD_API
140  bool HasAuthoredDisplayGroup() const;
141 
144  USD_API
145  std::vector<std::string> GetNestedDisplayGroups() const;
146 
154  USD_API
156  const std::vector<std::string>& nestedGroups) const;
157 
161  USD_API
162  std::string GetDisplayName() const;
163 
169  USD_API
170  bool SetDisplayName(const std::string& name) const;
171 
174  USD_API
175  bool ClearDisplayName() const;
176 
179  USD_API
180  bool HasAuthoredDisplayName() const;
181 
189  USD_API
190  bool IsCustom() const;
191 
198  USD_API
199  bool SetCustom(bool isCustom) const;
200 
204 
215  USD_API
216  bool IsDefined() const;
217 
220  USD_API
221  bool IsAuthored() const;
222 
228  USD_API
229  bool IsAuthoredAt(const class UsdEditTarget &editTarget) const;
230 
232 
233  // --------------------------------------------------------------------- //
235  // --------------------------------------------------------------------- //
236 
257  USD_API
258  UsdProperty FlattenTo(const UsdPrim &parent) const;
259 
267  USD_API
268  UsdProperty FlattenTo(const UsdPrim &parent,
269  const TfToken &propName) const;
270 
277  USD_API
278  UsdProperty FlattenTo(const UsdProperty &property) const;
279 
280 protected:
281  template <class Derived>
282  UsdProperty(_Null<Derived>) : UsdObject(_Null<Derived>()) {}
283 
284  // Gets the targets of the given spec type. Returns true if an authored
285  // opinion is found and no composition errors occured. If foundErrors is
286  // provided, it will be set to true only if errors are encountered.
287  bool _GetTargets(SdfSpecType specType, SdfPathVector *out,
288  bool *foundErrors = nullptr) const;
289 
290 private:
291  friend class UsdAttribute;
292  friend class UsdObject;
293  friend class UsdPrim;
294  friend class UsdRelationship;
295  friend class Usd_PrimData;
296 
297  UsdProperty(UsdObjType objType,
298  const Usd_PrimDataHandle &prim,
299  const SdfPath &proxyPrimPath,
300  const TfToken &propName)
301  : UsdObject(objType, prim, proxyPrimPath, propName) {}
302 
303 };
304 
305 
306 PXR_NAMESPACE_CLOSE_SCOPE
307 
308 #endif // PXR_USD_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 edi...
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:49
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.
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:87
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:130
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:132
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
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
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:91
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.