All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
inherits.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_INHERITS_H
25 #define USD_INHERITS_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/prim.h"
31 
32 #include "pxr/usd/sdf/declareHandles.h"
33 #include "pxr/usd/sdf/path.h"
34 
35 PXR_NAMESPACE_OPEN_SCOPE
36 
37 SDF_DECLARE_HANDLES(SdfPrimSpec);
38 
51 class UsdInherits {
52  friend class UsdPrim;
53 
54  explicit UsdInherits(const UsdPrim& prim) : _prim(prim) {}
55 
56 public:
59  USD_API
60  bool AddInherit(const SdfPath &primPath,
62 
65  USD_API
66  bool RemoveInherit(const SdfPath &primPath);
67 
70  USD_API
71  bool ClearInherits();
72 
76  USD_API
77  bool SetInherits(const SdfPathVector& items);
78 
87  USD_API
88  SdfPathVector GetAllDirectInherits() const;
89 
91  const UsdPrim &GetPrim() const { return _prim; }
92  UsdPrim GetPrim() { return _prim; }
93 
94  explicit operator bool() { return bool(_prim); }
95 
96  // ---------------------------------------------------------------------- //
97  // Private Methods and Members
98  // ---------------------------------------------------------------------- //
99 private:
100 
101  UsdPrim _prim;
102 };
103 
104 PXR_NAMESPACE_CLOSE_SCOPE
105 
106 #endif // USD_INHERITS_H
UsdListPosition
Specifies a position to add items to lists.
Definition: common.h:110
USD_API bool AddInherit(const SdfPath &primPath, UsdListPosition position=UsdListPositionBackOfPrependList)
Adds a path to the inheritPaths listOp at the current EditTarget, in the position specified by positi...
USD_API bool SetInherits(const SdfPathVector &items)
Explicitly set the inherited paths, potentially blocking weaker opinions that add or remove items...
A proxy class for applying listOp edits to the inherit paths list for a prim.
Definition: inherits.h:51
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:131
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
Represents a prim description in an SdfLayer object.
Definition: primSpec.h:74
USD_API SdfPathVector GetAllDirectInherits() const
Return all the paths in this prim's stage's local layer stack that would compose into this prim via d...
USD_API bool RemoveInherit(const SdfPath &primPath)
Removes the specified path from the inheritPaths listOp at the current EditTarget.
The position at the back of the prepend list.
Definition: common.h:120
USD_API bool ClearInherits()
Removes the authored inheritPaths listOp edits at the current edit target.
const UsdPrim & GetPrim() const
Return the prim this object is bound to.
Definition: inherits.h:91