mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
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:
@@ -17,6 +17,7 @@ pub struct NodeMetadata {
|
||||
pub properties: Option<&'static str>,
|
||||
pub context_features: Vec<ContextFeature>,
|
||||
pub memoize: bool,
|
||||
pub inject_scope: bool,
|
||||
}
|
||||
|
||||
// Translation struct between macro and definition
|
||||
|
||||
@@ -154,6 +154,13 @@ impl ProtoNodeIdentifier {
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.name.as_ref()
|
||||
}
|
||||
|
||||
pub const fn as_static_str(&self) -> &'static str {
|
||||
match self.name {
|
||||
Cow::Borrowed(name) => name,
|
||||
Cow::Owned(_) => panic!("`as_static_str` called on a `ProtoNodeIdentifier` backed by an owned string"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for ProtoNodeIdentifier {
|
||||
|
||||
Reference in New Issue
Block a user