Add node macro support for injecting nodes into global scope (#4221)

* Macro support

* Preprocessor support

* Allow Cow str as scope name

* Use Passthrough node to work around compiler auto wrapping the producer node and invalidating the node id

* Stable NodeIds

* Less hacky but with bad performace

* Remove Cow from RegistryValueSource::Scope

* Connect scope injections to the inner network export

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
Timon
2026-06-11 18:14:58 +00:00
committed by GitHub
parent 05d3d66587
commit e524dff1a7
13 changed files with 272 additions and 165 deletions

View File

@@ -34,3 +34,13 @@ fn unwrap_option<T: Default>(_: impl Ctx, #[implementations(Option<f64>, Option<
fn clone<'i, T: Clone + 'i>(_: impl Ctx, #[implementations(&List<Raster<CPU>>)] value: &'i T) -> T {
value.clone()
}
#[node_macro::node(category("Debug"), inject_scope)]
fn inject_scope_test_producer(_: impl Ctx) -> bool {
true
}
#[node_macro::node(category("Debug"))]
fn inject_scope_test_consumer(_: impl Ctx, _primary: (), #[scope(inject_scope_test_producer::IDENTIFIER)] injected: bool) -> bool {
injected
}