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
17
18#include "pxr/pxr.h"
19#include "pxr/usd/sdr/api.h"
20#include "pxr/usd/sdr/declare.h"
23
24#include <functional>
25
26PXR_NAMESPACE_OPEN_SCOPE
27
29
36
39using SdrParseIdentifierFn = std::function<
40 bool (const TfToken &identifier,
41 TfToken *family,
42 TfToken *name,
43 SdrVersion *version)>;
44
62SDR_API
63bool
65 const TfToken &identifier,
66 TfToken *family,
67 TfToken *name,
68 SdrVersion *version);
69
88SDR_API
89SdrShaderNodeDiscoveryResultVec
91 const SdrStringVec& searchPaths,
92 const SdrStringVec& allowedExtensions,
93 bool followSymlinks = true,
94 const SdrDiscoveryPluginContext* context = nullptr,
95 const SdrParseIdentifierFn &parseIdentifierFn =
97);
98
102{
103 std::string uri;
104 std::string resolvedUri;
105};
106
108using SdrDiscoveryUriVec = std::vector<SdrDiscoveryUri>;
109
121SDR_API
124 const SdrStringVec& searchPaths,
125 const SdrStringVec& allowedExtensions,
126 bool followSymlinks = true
127);
128
129PXR_NAMESPACE_CLOSE_SCOPE
130
131#endif // PXR_USD_SDR_FILESYSTEM_DISCOVERY_HELPERS_H
A context for discovery.
SdrVersion.
Definition: declare.h:73
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.