feat: testing on how to flatten tree structures

This commit is contained in:
2024-04-05 16:45:57 +02:00
parent 473f696626
commit 68d1bac572
23 changed files with 348 additions and 307 deletions

View File

@@ -45,7 +45,24 @@ export type Socket = {
export interface NodeRegistry {
/**
* Load the nodes with the given ids
* @param nodeIds - The ids of the nodes to load
* @returns A promise that resolves when the nodes are loaded
* @throws An error if the nodes could not be loaded
* @remarks This method should be called before calling getNode or getAllNodes
*/
load: (nodeIds: string[]) => Promise<void>;
/**
* Get a node by id
* @param id - The id of the node to get
* @returns The node with the given id, or undefined if no such node exists
*/
getNode: (id: string) => NodeType | undefined;
/**
* Get all nodes
* @returns An array of all nodes
*/
getAllNodes: () => NodeType[];
}

View File

@@ -26,6 +26,7 @@ type NodeInputSelect = {
type DefaultOptions = {
internal?: boolean;
title?: string;
}
export type NodeInput = (NodeInputBoolean | NodeInputFloat | NodeInputInteger | NodeInputSelect) & DefaultOptions;

View File

@@ -0,0 +1,26 @@
type RandomParameter = {
type: "random";
min: Parameter;
max: Parameter;
seed: number;
}
type MathParameter = {
type: "math";
op_type: number;
a: Parameter;
b: Parameter;
}
type NoiseParameter = {
type: "noise";
frequency: Parameter;
amplitude: Parameter;
seed: number;
}
type Parameter = number | RandomParameter | MathParameter | NoiseParameter;