Loading...
Searching...
No Matches
discoveryPlugin.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_DISCOVERY_PLUGIN_H
9#define PXR_USD_SDR_DISCOVERY_PLUGIN_H
10
12
13#include "pxr/pxr.h"
14#include "pxr/usd/sdr/api.h"
16#include "pxr/base/tf/type.h"
18#include "pxr/usd/sdr/declare.h"
20
21PXR_NAMESPACE_OPEN_SCOPE
22
26#define SDR_REGISTER_DISCOVERY_PLUGIN(DiscoveryPluginClass) \
27TF_REGISTRY_FUNCTION(TfType) \
28{ \
29 TfType::Define<DiscoveryPluginClass, TfType::Bases<SdrDiscoveryPlugin>>() \
30 .SetFactory<SdrDiscoveryPluginFactory<DiscoveryPluginClass>>(); \
31}
32
34
39public:
40 SDR_API
41 virtual ~SdrDiscoveryPluginContext() = default;
42
43 SDR_API
44 virtual TfToken GetSourceType(const TfToken& discoveryType) const = 0;
45};
46
48
125public:
127
128 SDR_API
130 SDR_API
131 virtual ~SdrDiscoveryPlugin();
132
135 SDR_API
136 virtual SdrShaderNodeDiscoveryResultVec DiscoverShaderNodes(
137 const Context&) = 0;
138
140 SDR_API
141 virtual const SdrStringVec& GetSearchURIs() const = 0;
142};
143
144
147class SdrDiscoveryPluginFactoryBase : public TfType::FactoryBase
148{
149public:
150 SDR_API
151 virtual SdrDiscoveryPluginRefPtr New() const = 0;
152};
153
154template <class T>
155class SdrDiscoveryPluginFactory : public SdrDiscoveryPluginFactoryBase
156{
157public:
158 SdrDiscoveryPluginRefPtr New() const override
159 {
160 return TfCreateRefPtr(new T);
161 }
162};
163
165
166PXR_NAMESPACE_CLOSE_SCOPE
167
168#endif // PXR_USD_SDR_DISCOVERY_PLUGIN_H
A context for discovery.
Interface for discovery plugins for finding shader nodes.
virtual SDR_API SdrShaderNodeDiscoveryResultVec DiscoverShaderNodes(const Context &)=0
Finds and returns all nodes that the implementing plugin should be aware of.
virtual SDR_API const SdrStringVec & GetSearchURIs() const =0
Gets the URIs that this plugin is searching for nodes in.
Enable a concrete base class for use with TfRefPtr.
Definition: refBase.h:56
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Base class of all factory types.
Definition: type.h:56
Enable a concrete base class for use with TfWeakPtr.
Definition: weakBase.h:124
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:72