Loading...
Searching...
No Matches
filesystemDiscoveryHelpers.h
Go to the documentation of this file.
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7
8#ifndef PXR_USD_SDR_FILESYSTEM_DISCOVERY_HELPERS_H
9#define PXR_USD_SDR_FILESYSTEM_DISCOVERY_HELPERS_H
10
12
13#include "pxr/pxr.h"
14#include "pxr/usd/sdr/api.h"
15#include "pxr/usd/sdr/declare.h"
18
19#include <functional>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
24
31
34using SdrParseIdentifierFn = std::function<
35 bool (const TfToken &identifier,
36 TfToken *family,
37 TfToken *name,
38 SdrVersion *version)>;
39
57SDR_API
58bool
60 const TfToken &identifier,
61 TfToken *family,
62 TfToken *name,
63 SdrVersion *version);
64
83SDR_API
84SdrShaderNodeDiscoveryResultVec
86 const SdrStringVec& searchPaths,
87 const SdrStringVec& allowedExtensions,
88 bool followSymlinks = true,
89 const SdrDiscoveryPluginContext* context = nullptr,
90 const SdrParseIdentifierFn &parseIdentifierFn =
92);
93
97{
98 std::string uri;
99 std::string resolvedUri;
100};
101
103using SdrDiscoveryUriVec = std::vector<SdrDiscoveryUri>;
104
116SDR_API
119 const SdrStringVec& searchPaths,
120 const SdrStringVec& allowedExtensions,
121 bool followSymlinks = true
122);
123
124PXR_NAMESPACE_CLOSE_SCOPE
125
126#endif // PXR_USD_SDR_FILESYSTEM_DISCOVERY_HELPERS_H
A context for discovery.
SdrVersion.
Definition: declare.h:67
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides utilities that the default filesystem discovery plugin uses.
SDR_API bool SdrFsHelpersSplitShaderIdentifier(const TfToken &identifier, TfToken *family, TfToken *name, SdrVersion *version)
Given a shader's identifier token, computes the corresponding SdrShaderNode's family name,...
std::vector< SdrDiscoveryUri > SdrDiscoveryUriVec
A vector of URI/resolved URI structs.
std::function< bool(const TfToken &identifier, TfToken *family, TfToken *name, SdrVersion *version)> SdrParseIdentifierFn
Type of a function that can be used to parse a discovery result's identifier into its family,...
SDR_API SdrShaderNodeDiscoveryResultVec SdrFsHelpersDiscoverShaderNodes(const SdrStringVec &searchPaths, const SdrStringVec &allowedExtensions, bool followSymlinks=true, const SdrDiscoveryPluginContext *context=nullptr, const SdrParseIdentifierFn &parseIdentifierFn=SdrFsHelpersSplitShaderIdentifier)
Returns a vector of discovery results that have been found while walking the given search paths.
SDR_API SdrDiscoveryUriVec SdrFsHelpersDiscoverFiles(const SdrStringVec &searchPaths, const SdrStringVec &allowedExtensions, bool followSymlinks=true)
Returns a vector of discovered URIs (as both the unresolved URI and the resolved URI) that are found ...
Struct for holding a URI and its resolved URI for a file discovered by SdrFsHelpersDiscoverFiles.