HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
filesystemDiscovery.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_H
9
#define PXR_USD_SDR_FILESYSTEM_DISCOVERY_H
10
11
/// \file sdr/filesystemDiscovery.h
12
///
13
/// \note
14
/// All Ndr objects are deprecated in favor of the corresponding Sdr objects
15
/// in this file. All existing pxr/usd/ndr implementations will be moved to
16
/// pxr/usd/sdr.
17
18
#include "
pxr/pxr.h
"
19
#include "
pxr/usd/ndr/filesystemDiscoveryHelpers.h
"
20
#include "
pxr/usd/sdr/api.h
"
21
#include "
pxr/usd/sdr/discoveryPlugin.h
"
22
#include <functional>
23
24
PXR_NAMESPACE_OPEN_SCOPE
25
26
TF_DECLARE_WEAK_AND_REF_PTRS
(
_SdrFilesystemDiscoveryPlugin
);
27
28
/// \class _SdrFilesystemDiscoveryPlugin
29
///
30
/// Discovers shader nodes on the filesystem. The provided search paths are
31
/// walked to find files that have certain extensions. If a file with a
32
/// matching extension is found, it is turned into a
33
/// `SdrShaderNodeDiscoveryResult` and will be parsed into a node when its
34
/// information is accessed.
35
///
36
/// Parameters for this plugin are specified via environment variables (which
37
/// must be set before the library is loaded):
38
///
39
/// PXR_SDR_FS_PLUGIN_SEARCH_PATHS - The paths that should be searched,
40
/// recursively, for files that represent nodes. Paths should be separated by
41
/// either a ':' or a ';' depending on your platform (it should mimic the PATH
42
/// env var on your platform). See ARCH_PATH_LIST_SEP.
43
///
44
/// PXR_SDR_FS_PLUGIN_ALLOWED_EXTS - The extensions on files that define nodes.
45
/// Do not include the leading ".". Extensions should be separated by a colon.
46
///
47
/// PXR_SDR_FS_PLUGIN_FOLLOW_SYMLINKS - Whether symlinks should be followed
48
/// while walking the search paths. Set to "true" (case sensitive) if they
49
/// should be followed.
50
class
_SdrFilesystemDiscoveryPlugin
final :
public
SdrDiscoveryPlugin
{
51
public
:
52
/// A filter for discovered nodes. If the function returns false
53
/// then the discovered node is discarded. Otherwise the function
54
/// can modify the discovery result.
55
using
Filter
= std::function<bool(SdrShaderNodeDiscoveryResult&)>;
56
57
/// Constructor.
58
SDR_API
59
_SdrFilesystemDiscoveryPlugin
();
60
61
/// DiscoverNodes() will pass each result to the given function for
62
/// modification. If the function returns false then the result is
63
/// discarded.
64
SDR_API
65
_SdrFilesystemDiscoveryPlugin
(
Filter
filter
);
66
67
/// Destructor
68
SDR_API
69
~_SdrFilesystemDiscoveryPlugin
() {}
70
71
/// Discover all of the nodes that appear within the the search paths
72
/// provided and match the extensions provided.
73
SDR_API
74
SdrShaderNodeDiscoveryResultVec
DiscoverShaderNodes
(
75
const
Context
&)
override
;
76
77
/// Gets the paths that this plugin is searching for nodes in.
78
SDR_API
79
const
SdrStringVec
&
GetSearchURIs
()
const override
{
return
_searchPaths; }
80
81
private
:
82
/// The paths (abs) indicating where the plugin should search for nodes.
83
SdrStringVec
_searchPaths;
84
85
/// The extensions (excluding leading '.') that signify a valid node file.
86
/// The extension will be used as the `type` member in the resulting
87
/// `SdrShaderNodeDiscoveryResult` instance.
88
SdrStringVec
_allowedExtensions;
89
90
/// Whether or not to follow symlinks while scanning directories for files.
91
bool
_followSymlinks;
92
93
// The filter to run on the results.
94
Filter
_filter;
95
};
96
97
PXR_NAMESPACE_CLOSE_SCOPE
98
99
#endif // PXR_USD_SDR_FILESYSTEM_DISCOVERY_H
SdrShaderNodeDiscoveryResultVec
std::vector< SdrShaderNodeDiscoveryResult > SdrShaderNodeDiscoveryResultVec
Definition:
shaderNodeDiscoveryResult.h:188
SdrStringVec
std::vector< std::string > SdrStringVec
Definition:
declare.h:67
SdrDiscoveryPlugin
Definition:
discoveryPlugin.h:52
discoveryPlugin.h
_SdrFilesystemDiscoveryPlugin::DiscoverShaderNodes
SDR_API SdrShaderNodeDiscoveryResultVec DiscoverShaderNodes(const Context &) override
pxr.h
_SdrFilesystemDiscoveryPlugin::GetSearchURIs
SDR_API const SdrStringVec & GetSearchURIs() const override
Gets the paths that this plugin is searching for nodes in.
Definition:
filesystemDiscovery.h:79
filesystemDiscoveryHelpers.h
_SdrFilesystemDiscoveryPlugin::_SdrFilesystemDiscoveryPlugin
SDR_API _SdrFilesystemDiscoveryPlugin()
Constructor.
PXR_NAMESPACE_OPEN_SCOPE
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition:
path.h:1425
_SdrFilesystemDiscoveryPlugin
Definition:
filesystemDiscovery.h:50
api.h
_SdrFilesystemDiscoveryPlugin::~_SdrFilesystemDiscoveryPlugin
SDR_API ~_SdrFilesystemDiscoveryPlugin()
Destructor.
Definition:
filesystemDiscovery.h:69
PXR_NAMESPACE_CLOSE_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition:
pxr.h:74
Context
Context provides a wrapper around the Core library context object.
Definition:
ImfContext.h:30
TF_DECLARE_WEAK_AND_REF_PTRS
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(_NdrFilesystemDiscoveryPlugin)
_SdrFilesystemDiscoveryPlugin::Filter
std::function< bool(SdrShaderNodeDiscoveryResult &)> Filter
Definition:
filesystemDiscovery.h:55
SDR_API
#define SDR_API
Definition:
api.h:23
filter
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition:
glcorearb.h:1297
pxr
usd
sdr
filesystemDiscovery.h
Generated on Wed Sep 3 2025 02:34:52 for HDK by
1.8.6