HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
11 /// \file sdr/discoveryPlugin.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/sdr/api.h"
21 #include "pxr/base/tf/type.h"
22 #include "pxr/base/tf/weakBase.h"
23 #include "pxr/usd/sdr/declare.h"
26 
28 
29 /// Register a discovery plugin (`DiscoveryPluginClass`) with the plugin system.
30 /// If registered, the discovery plugin will execute its discovery process when
31 /// the registry is instantiated.
32 #define SDR_REGISTER_DISCOVERY_PLUGIN(DiscoveryPluginClass) \
33 TF_REGISTRY_FUNCTION(TfType) \
34 { \
35  TfType::Define<DiscoveryPluginClass, TfType::Bases<SdrDiscoveryPlugin>>() \
36  .SetFactory<SdrDiscoveryPluginFactory<DiscoveryPluginClass>>(); \
37 }
38 
40 
41 /// A context for discovery. Discovery plugins can use this to get
42 /// a limited set of non-local information without direct coupling
43 /// between plugins.
45 public:
46  SDR_API
47  virtual ~SdrDiscoveryPluginContext() = default;
48 };
49 
51 
53 public:
55 
56  SDR_API
58  SDR_API
59  virtual ~SdrDiscoveryPlugin();
60 
61  /// Finds and returns all nodes that the implementing plugin should be
62  /// aware of.
63  /// \deprecated
64  /// Deprecated in favor of
65  /// DiscoverShaderNodes(const SdrDiscoveryPluginContext&).
66  SDR_API
68  const NdrDiscoveryPluginContext&) override final;
69 
70  /// Finds and returns all nodes that the implementing plugin should be
71  /// aware of.
72  SDR_API
74  const Context&) = 0;
75 };
76 
77 
78 /// \cond
79 /// Factory classes should be hidden from the documentation.
80 using SdrDiscoveryPluginFactoryBase = NdrDiscoveryPluginFactoryBase;
81 
82 template <class T>
83 using SdrDiscoveryPluginFactory = NdrDiscoveryPluginFactory<T>;
84 
85 /// \endcond
86 
88 
89 #endif // PXR_USD_SDR_DISCOVERY_PLUGIN_H
std::vector< SdrShaderNodeDiscoveryResult > SdrShaderNodeDiscoveryResultVec
SDR_API NdrNodeDiscoveryResultVec DiscoverNodes(const NdrDiscoveryPluginContext &) overridefinal
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:632
SDR_API SdrDiscoveryPlugin()
std::vector< NdrNodeDiscoveryResult > NdrNodeDiscoveryResultVec
virtual SDR_API SdrShaderNodeDiscoveryResultVec DiscoverShaderNodes(const Context &)=0
TF_DECLARE_WEAK_AND_REF_PTRS(NdrDiscoveryPluginContext)
virtual SDR_API ~SdrDiscoveryPluginContext()=default
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
virtual SDR_API ~SdrDiscoveryPlugin()
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
#define SDR_API
Definition: api.h:23