HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pathTranslation.h
Go to the documentation of this file.
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_PCP_PATH_TRANSLATION_H
8 #define PXR_USD_PCP_PATH_TRANSLATION_H
9 
10 /// \file pcp/pathTranslation.h
11 /// Path translation.
12 
13 #include "pxr/pxr.h"
14 #include "pxr/usd/pcp/api.h"
15 
17 
18 class PcpMapFunction;
19 class PcpNodeRef;
20 class SdfPath;
21 
22 /// Translates \p pathInNodeNamespace from the namespace of the prim index node
23 /// \p sourceNode to the namespace of the prim index's root node. This applies
24 /// all necessary namespace translations.
25 ///
26 /// If the path is successfully translated and \p pathWasTranslated is supplied,
27 /// it will be set to \c true. In some cases, paths may fail to translate
28 /// because they fall outside the set of paths that are allowed by nodes in the
29 /// prim index. For instance, for a referenced model, paths referring to
30 /// locations outside that model will not be translated. In these cases, this
31 /// function will return an empty SdfPath and \p pathWasTranslated will be set
32 /// to \c false.
33 ///
34 /// In Sd/Csd terminology, this is forward path translation from the
35 /// namespace of the prim spec represented by \p sourceNode to the composed
36 /// scene namespace.
37 PCP_API
38 SdfPath
40  const PcpNodeRef& sourceNode,
41  const SdfPath& pathInNodeNamespace,
42  bool* pathWasTranslated = 0);
43 
44 /// Translates \p pathInRootNamespace from the namespace of the root of the
45 /// prim index that \p destNode belongs to to the namespace of \p destNode
46 /// itself. This applies all necessary namespace translations.
47 ///
48 /// If the path is successfully translated and \p pathWasTranslated is supplied,
49 /// it will be set to \c true. In some cases, paths may fail to translate
50 /// because they fall outside the set of paths that are allowed by nodes in the
51 /// prim index. For instance, for a referenced model, paths referring to
52 /// locations outside that model will not be translated. In these cases, this
53 /// function will return an empty SdfPath and \p pathWasTranslated will be set
54 /// to \c false.
55 ///
56 /// In Sd/Csd terminology, this is reverse path translation from the
57 /// namespace of the composed scene to the namespace of the prim spec
58 /// represented by \p destNode.
59 PCP_API
60 SdfPath
62  const PcpNodeRef& destNode,
63  const SdfPath& pathInRootNamespace,
64  bool* pathWasTranslated = 0);
65 
66 /// Same as \a PcpTranslatePathFromRootToNode, but explicitly for use when
67 /// translating paths intended for use as attribute connections or relationship
68 /// targets. The primary difference is that variant selections will never
69 /// be included in the translated path. This is functionally equivalent to
70 /// calling StripAllVariantSelections() on the result of the referenced
71 /// function, but is more efficient.
72 PCP_API
73 SdfPath
75  const PcpNodeRef& destNode,
76  const SdfPath& pathInRootNamespace,
77  bool* pathWasTranslated = 0);
78 
79 /// Convenience function like \a PcpTranslatePathFromRootToNode, but
80 /// takes a function rather than a node.
81 PCP_API
82 SdfPath
84  const PcpMapFunction &mapToRoot,
85  const SdfPath &pathInRootNamespace,
86  bool *pathWasTranslated = 0);
87 
88 /// Convenience function like \a PcpTranslatePathFromNodeToRoot, but
89 /// takes a function rather than a node.
90 PCP_API
91 SdfPath
93  const PcpMapFunction &mapToRoot,
94  const SdfPath &pathInNodeNamespace,
95  bool *pathWasTranslated = 0);
96 
98 
99 #endif // PXR_USD_PCP_PATH_TRANSLATION_H
PCP_API SdfPath PcpTranslatePathFromRootToNodeUsingFunction(const PcpMapFunction &mapToRoot, const SdfPath &pathInRootNamespace, bool *pathWasTranslated=0)
PCP_API SdfPath PcpTranslateTargetPathFromRootToNode(const PcpNodeRef &destNode, const SdfPath &pathInRootNamespace, bool *pathWasTranslated=0)
PCP_API SdfPath PcpTranslatePathFromRootToNode(const PcpNodeRef &destNode, const SdfPath &pathInRootNamespace, bool *pathWasTranslated=0)
PCP_API SdfPath PcpTranslatePathFromNodeToRootUsingFunction(const PcpMapFunction &mapToRoot, const SdfPath &pathInNodeNamespace, bool *pathWasTranslated=0)
PCP_API SdfPath PcpTranslatePathFromNodeToRoot(const PcpNodeRef &sourceNode, const SdfPath &pathInNodeNamespace, bool *pathWasTranslated=0)
Definition: path.h:273
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
#define PCP_API
Definition: api.h:23