Add the "memoize" attribute to the node macro (#4065)

* Add memoization attribute to node macro

* Fix memoization insertion for networks without conversion nodes
This commit is contained in:
Dennis Kobert
2026-04-28 13:55:38 +02:00
committed by GitHub
parent 3eba762135
commit e0368435b9
6 changed files with 47 additions and 6 deletions

View File

@@ -401,6 +401,7 @@ pub(crate) fn generate_node_code(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
let import_name = format_ident!("_IMPORT_STUB_{}", mod_name.to_string().to_case(Case::UpperSnake));
let properties = &attributes.properties_string.as_ref().map(|value| quote!(Some(#value))).unwrap_or(quote!(None));
let memoize_flag = attributes.memoize;
let cfg = crate::shader_nodes::modify_cfg(attributes);
let node_input_accessor = generate_node_input_references(parsed, fn_generics, &field_idents, core_types, &identifier, &cfg);
@@ -498,6 +499,7 @@ pub(crate) fn generate_node_code(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
description: #description,
properties: #properties,
context_features: vec![#(ContextFeature::#context_features,)*],
memoize: #memoize_flag,
fields: vec![
#(
FieldMetadata {