mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Add the auto-generated node catalog to the website's user manual (#3662)
* Generate the MVP node catalog in the manual (with some placeholders) * Implement nearly the rest of everything * Move to the tools directory and make it generate nicer default values * Add category descriptions * Organize file structure and improve type naming * Improve book table of contents code * Add collapsing chapter navigation to the book template * Add to build workflow * Clean up site structure
This commit is contained in:
@@ -113,6 +113,20 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
impl ContextFeatures {
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
ContextFeatures::FOOTPRINT => "Footprint",
|
||||
ContextFeatures::REAL_TIME => "RealTime",
|
||||
ContextFeatures::ANIMATION_TIME => "AnimationTime",
|
||||
ContextFeatures::POINTER => "Pointer",
|
||||
ContextFeatures::INDEX => "Index",
|
||||
ContextFeatures::VARARGS => "VarArgs",
|
||||
_ => "Multiple Features",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, dyn_any::DynAny, serde::Serialize, serde::Deserialize, Default)]
|
||||
pub struct ContextDependencies {
|
||||
pub extract: ContextFeatures,
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::sync::{LazyLock, Mutex};
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct NodeMetadata {
|
||||
pub display_name: &'static str,
|
||||
pub category: Option<&'static str>,
|
||||
pub category: &'static str,
|
||||
pub fields: Vec<FieldMetadata>,
|
||||
pub description: &'static str,
|
||||
pub properties: Option<&'static str>,
|
||||
@@ -23,6 +23,7 @@ pub struct NodeMetadata {
|
||||
pub struct FieldMetadata {
|
||||
pub name: &'static str,
|
||||
pub description: &'static str,
|
||||
pub hidden: bool,
|
||||
pub exposed: bool,
|
||||
pub widget_override: RegistryWidgetOverride,
|
||||
pub value_source: RegistryValueSource,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::transform::Footprint;
|
||||
use std::any::TypeId;
|
||||
pub use std::borrow::Cow;
|
||||
use std::fmt::{Display, Formatter};
|
||||
@@ -75,6 +76,7 @@ macro_rules! fn_type_fut {
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: Rename to NodeSignatureMonomorphization
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize)]
|
||||
pub struct NodeIOTypes {
|
||||
pub call_argument: Type,
|
||||
@@ -351,7 +353,10 @@ pub fn format_type(ty: &str) -> String {
|
||||
}
|
||||
|
||||
pub fn make_type_user_readable(ty: &str) -> String {
|
||||
ty.replace("Option<Arc<OwnedContextImpl>>", "Context").replace("Vector<Option<Table<Graphic>>>", "Vector")
|
||||
ty.replace("Option<Arc<OwnedContextImpl>>", "Context")
|
||||
.replace("Vector<Option<Table<Graphic>>>", "Vector")
|
||||
.replace("Raster<CPU>", "Raster")
|
||||
.replace("Raster<GPU>", "Raster")
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Type {
|
||||
@@ -372,6 +377,19 @@ impl std::fmt::Debug for Type {
|
||||
|
||||
impl std::fmt::Display for Type {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
if self == &concrete!(glam::DVec2) {
|
||||
return write!(f, "vec2");
|
||||
}
|
||||
if self == &concrete!(glam::DAffine2) {
|
||||
return write!(f, "transform");
|
||||
}
|
||||
if self == &concrete!(Footprint) {
|
||||
return write!(f, "footprint");
|
||||
}
|
||||
if self == &concrete!(&str) || self == &concrete!(String) {
|
||||
return write!(f, "string");
|
||||
}
|
||||
|
||||
let text = match self {
|
||||
Type::Generic(name) => name.to_string(),
|
||||
Type::Concrete(ty) => format_type(&ty.name),
|
||||
|
||||
Reference in New Issue
Block a user