Loading...
Searching...
No Matches
filesystemDiscoveryHelpers.h
Go to the documentation of this file.
1//
2// Copyright 2018 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_NDR_FILESYSTEM_DISCOVERY_HELPERS_H
9#define PXR_USD_NDR_FILESYSTEM_DISCOVERY_HELPERS_H
10
16
17#include "pxr/pxr.h"
19#include "pxr/usd/ndr/api.h"
20#include "pxr/usd/ndr/declare.h"
21#include "pxr/usd/ndr/nodeDiscoveryResult.h"
22
23#include <functional>
24
25PXR_NAMESPACE_OPEN_SCOPE
26
28
35
37NDR_API
38extern TfEnvSetting<std::string> PXR_NDR_FS_PLUGIN_SEARCH_PATHS;
39
41NDR_API
42extern TfEnvSetting<std::string> PXR_NDR_FS_PLUGIN_ALLOWED_EXTS;
43
45NDR_API
46extern TfEnvSetting<bool> PXR_NDR_FS_PLUGIN_FOLLOW_SYMLINKS;
47
50using NdrParseIdentifierFn = std::function<
51 bool (const TfToken &identifier,
52 TfToken *family,
53 TfToken *name,
54 NdrVersion *version)>;
55
76NDR_API
77bool
79 const TfToken &identifier,
80 TfToken *family,
81 TfToken *name,
82 NdrVersion *version);
83
105NDR_API
106NdrNodeDiscoveryResultVec
108 const NdrStringVec& searchPaths,
109 const NdrStringVec& allowedExtensions,
110 bool followSymlinks = true,
111 const NdrDiscoveryPluginContext* context = nullptr,
112 const NdrParseIdentifierFn &parseIdentifierFn =
114);
115
122{
123 std::string uri;
124 std::string resolvedUri;
125};
126
128using NdrDiscoveryUriVec = std::vector<NdrDiscoveryUri>;
129
144NDR_API
147 const NdrStringVec& searchPaths,
148 const NdrStringVec& allowedExtensions,
149 bool followSymlinks = true
150);
151
152PXR_NAMESPACE_CLOSE_SCOPE
153
154#endif // PXR_USD_NDR_FILESYSTEM_DISCOVERY_HELPERS_H
A context for discovery.
NdrVersion.
Definition: declare.h:79
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Environment setting variable.
NDR_API NdrNodeDiscoveryResultVec NdrFsHelpersDiscoverNodes(const NdrStringVec &searchPaths, const NdrStringVec &allowedExtensions, bool followSymlinks=true, const NdrDiscoveryPluginContext *context=nullptr, const NdrParseIdentifierFn &parseIdentifierFn=NdrFsHelpersSplitShaderIdentifier)
Returns a vector of discovery results that have been found while walking the given search paths.
std::vector< NdrDiscoveryUri > NdrDiscoveryUriVec
A vector of URI/resolved URI structs.
NDR_API TfEnvSetting< std::string > PXR_NDR_FS_PLUGIN_ALLOWED_EXTS
std::function< bool(const TfToken &identifier, TfToken *family, TfToken *name, NdrVersion *version)> NdrParseIdentifierFn
Type of a function that can be used to parse a discovery result's identifier into its family,...
NDR_API bool NdrFsHelpersSplitShaderIdentifier(const TfToken &identifier, TfToken *family, TfToken *name, NdrVersion *version)
Given a shader's identifier token, computes the corresponding NdrNode's family name,...
NDR_API TfEnvSetting< std::string > PXR_NDR_FS_PLUGIN_SEARCH_PATHS
NDR_API NdrDiscoveryUriVec NdrFsHelpersDiscoverFiles(const NdrStringVec &searchPaths, const NdrStringVec &allowedExtensions, bool followSymlinks=true)
Returns a vector of discovered URIs (as both the unresolved URI and the resolved URI) that are found ...
NDR_API TfEnvSetting< bool > PXR_NDR_FS_PLUGIN_FOLLOW_SYMLINKS
Struct for holding a URI and its resolved URI for a file discovered by NdrFsHelpersDiscoverFiles.
Common typedefs that are used throughout the NDR library.