relationshipSpec.h
Go to the documentation of this file.
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_SDF_RELATIONSHIP_SPEC_H
25 #define PXR_USD_SDF_RELATIONSHIP_SPEC_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/sdf/api.h"
31 #include "pxr/usd/sdf/declareSpec.h"
33 #include "pxr/usd/sdf/types.h"
34 
35 PXR_NAMESPACE_OPEN_SCOPE
36 
52 {
53  SDF_DECLARE_SPEC(SdfRelationshipSpec, SdfPropertySpec);
54 
55 public:
56  typedef SdfRelationshipSpec This;
57  typedef SdfPropertySpec Parent;
58 
62 
67  SDF_API
68  static SdfRelationshipSpecHandle
69  New(const SdfPrimSpecHandle& owner,
70  const std::string& name,
71  bool custom = true,
72  SdfVariability variability = SdfVariabilityUniform);
73 
75 
78 
83  SDF_API
85 
87  SDF_API
88  bool HasTargetPathList() const;
89 
91  SDF_API
92  void ClearTargetPathList() const;
93 
98  SDF_API
99  void ReplaceTargetPath(const SdfPath& oldPath, const SdfPath& newPath);
100 
107  SDF_API
108  void RemoveTargetPath(const SdfPath& path, bool preserveTargetOrder = false);
109 
111 
114  SDF_API
115  bool GetNoLoadHint(void) const;
116 
119  SDF_API
120  void SetNoLoadHint(bool noload);
121 
122 private:
123  SdfPath _CanonicalizeTargetPath(const SdfPath& path) const;
124 
125  SdfPath _MakeCompleteTargetSpecPath(const SdfPath& srcPath) const;
126 
127  SdfSpecHandle _GetTargetSpec(const SdfPath& path) const;
128 
129  // Allow access to _GetTarget() for the relational attribute c'tor
130  friend class SdfAttributeSpec;
131 
132  // Allow access to retrieve relationship spec for this API object.
133  friend class Sdf_PyRelationshipAccess;
134 };
135 
136 PXR_NAMESPACE_CLOSE_SCOPE
137 
138 #endif // PXR_USD_SDF_RELATIONSHIP_SPEC_H
Base class for SdfAttributeSpec and SdfRelationshipSpec.
Definition: propertySpec.h:59
Represents a set of list editing operations.
SDF_API void ClearTargetPathList() const
Clears the list of target paths on this relationship.
static SDF_API SdfRelationshipSpecHandle New(const SdfPrimSpecHandle &owner, const std::string &name, bool custom=true, SdfVariability variability=SdfVariabilityUniform)
Creates a new prim relationship instance.
SDF_API SdfTargetsProxy GetTargetPathList() const
Returns the relationship's target path list editor.
SDF_API void RemoveTargetPath(const SdfPath &path, bool preserveTargetOrder=false)
Removes the specified target path.
SDF_API bool HasTargetPathList() const
Returns true if the relationship has any target paths.
Basic Sdf data types.
SDF_API void SetNoLoadHint(bool noload)
Set whether loading the target of this relationship is necessary to load the prim we're attached to.
SDF_API void ReplaceTargetPath(const SdfPath &oldPath, const SdfPath &newPath)
Updates the specified target path.
A subclass of SdfPropertySpec that holds typed data.
Definition: attributeSpec.h:56
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
SdfVariability
An enum that identifies variability types for attributes.
Definition: types.h:179
SDF_API bool GetNoLoadHint(void) const
Get whether loading the target of this relationship is necessary to load the prim we're attached to.
A property that contains a reference to one or more SdfPrimSpec instances.