feat: some shit
This commit is contained in:
@@ -217,11 +217,22 @@ export type Pointer = {
|
||||
(a, b) => (b.state?.depth || 0) - (a.state?.depth || 0)
|
||||
);
|
||||
|
||||
console.log({ settings });
|
||||
|
||||
this.printMemory();
|
||||
const seedPtr = this.writeToMemory(this.seed, 'seed');
|
||||
|
||||
const settingPtrs = new Map<string, Pointer>(
|
||||
Object.entries(settings).map((
|
||||
[key, value]
|
||||
) => [key as string, this.writeToMemory(value as number, `setting.${key}`)])
|
||||
);
|
||||
|
||||
for (const node of sortedNodes) {
|
||||
const node_type = this.nodes.get(node.type)!;
|
||||
|
||||
console.log('---------------');
|
||||
console.log('STARTING NODE EXECUTION', node_type.definition.id);
|
||||
console.log('STARTING NODE EXECUTION', node_type.definition.id + '/' + node.id);
|
||||
this.printMemory();
|
||||
|
||||
// console.log(node_type.definition.inputs);
|
||||
@@ -229,23 +240,24 @@ export type Pointer = {
|
||||
([key, input]) => {
|
||||
// We should probably initially write this to memory
|
||||
if (input.type === 'seed') {
|
||||
return this.writeToMemory(this.seed);
|
||||
return seedPtr;
|
||||
}
|
||||
|
||||
const title = `${node.id}.${key}`;
|
||||
|
||||
// We should probably initially write this to memory
|
||||
// If the input is linked to a setting, we use that value
|
||||
// if (input.setting) {
|
||||
// return getValue(input, settings[input.setting]);
|
||||
// }
|
||||
// TODO: handle nodes which reference undefined settings
|
||||
if (input.setting) {
|
||||
return settingPtrs.get(input.setting)!;
|
||||
}
|
||||
|
||||
// check if the input is connected to another node
|
||||
const inputNode = node.state.inputNodes[key];
|
||||
if (inputNode) {
|
||||
if (this.results[inputNode.id] === undefined) {
|
||||
throw new Error(
|
||||
`Node ${node.type} is missing input from node ${inputNode.type}`
|
||||
`Node ${node.type}/${node.id} is missing input from node ${inputNode.type}/${inputNode.id}`
|
||||
);
|
||||
}
|
||||
return this.results[inputNode.id];
|
||||
|
||||
@@ -71,7 +71,11 @@
|
||||
<Grid.Cell>
|
||||
{#if visibleRows?.length}
|
||||
<table
|
||||
class="min-w-full select-none overflow-hidden text-left text-sm flex-1"
|
||||
class="min-w-full select-none overflow-auto text-left text-sm flex-1"
|
||||
onscroll={(e) => {
|
||||
const scrollTop = e.currentTarget.scrollTop;
|
||||
start.value = Math.floor(scrollTop / rowHeight);
|
||||
}}
|
||||
>
|
||||
<thead class="">
|
||||
<tr>
|
||||
@@ -84,9 +88,14 @@
|
||||
<th class="px-4 py-2 border-b border-[var(--outline)]">Float</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody
|
||||
onscroll={(e) => {
|
||||
const scrollTop = e.currentTarget.scrollTop;
|
||||
start.value = Math.floor(scrollTop / rowHeight);
|
||||
}}
|
||||
>
|
||||
{#each visibleRows as r, i}
|
||||
{@const index = i + start}
|
||||
{@const index = i + start.value}
|
||||
{@const ptr = ptrs[i]}
|
||||
<tr class="h-[40px] odd:bg-[var(--layer-1)]">
|
||||
<td class="px-4 border-b border-[var(--outline)] w-8">{index}</td>
|
||||
@@ -119,7 +128,7 @@
|
||||
</table>
|
||||
<input
|
||||
class="absolute bottom-4 left-4 bg-white"
|
||||
bind:value={start}
|
||||
bind:value={start.value}
|
||||
min="0"
|
||||
type="number"
|
||||
step="1"
|
||||
@@ -133,6 +142,13 @@
|
||||
</Grid.Row>
|
||||
|
||||
<Sidebar>
|
||||
<Panel id="general" title="General" icon="i-[tabler--settings]">
|
||||
<NestedSettings
|
||||
id="general"
|
||||
bind:value={appSettings.value}
|
||||
type={AppSettingTypes}
|
||||
/>
|
||||
</Panel>
|
||||
<Panel
|
||||
id="node-store"
|
||||
classes="text-green-400"
|
||||
|
||||
@@ -7,47 +7,68 @@
|
||||
{
|
||||
"id": 9,
|
||||
"position": [
|
||||
220,
|
||||
80
|
||||
225,
|
||||
65
|
||||
],
|
||||
"type": "max/plantarium/output",
|
||||
"props": {}
|
||||
"props": {
|
||||
"out": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"position": [
|
||||
195,
|
||||
80
|
||||
200,
|
||||
60
|
||||
],
|
||||
"type": "max/plantarium/math",
|
||||
"props": {
|
||||
"op_type": 0,
|
||||
"op_type": 3,
|
||||
"a": 2,
|
||||
"b": 2
|
||||
"b": 0.38
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"position": [
|
||||
170,
|
||||
80
|
||||
175,
|
||||
60
|
||||
],
|
||||
"type": "max/plantarium/float",
|
||||
"props": {
|
||||
"value": 0.1
|
||||
"value": 0.66
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"position": [
|
||||
170,
|
||||
100
|
||||
175,
|
||||
80
|
||||
],
|
||||
"type": "max/plantarium/float",
|
||||
"props": {
|
||||
"value": 0.1
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": []
|
||||
"edges": [
|
||||
[
|
||||
11,
|
||||
0,
|
||||
10,
|
||||
"a"
|
||||
],
|
||||
[
|
||||
12,
|
||||
0,
|
||||
10,
|
||||
"b"
|
||||
],
|
||||
[
|
||||
10,
|
||||
0,
|
||||
9,
|
||||
"out"
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user