Skip to content

Commit

Permalink
fix bug with scene types not being registered properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhouston committed Jul 22, 2023
1 parent 98d1e2c commit 2e34081
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ Here is a test of 10,000,000 iteration for loop:

[/graphs/core/flow/PerformanceTest.json](/graphs/core/flow/PerformanceTest.json)

Here is the command running with profiling (-p):
Here is the command running with verbose logging, e.g. "-l 0":

```sh
npx exec-graph ./graphs/core/flow/PerformanceTest.json -p
npx exec-graph ./graphs/core/flow/PerformanceTest.json -l 0
```

Console output:
Expand Down
22 changes: 8 additions & 14 deletions apps/exec-graph/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type ProgramOptions = {
upgrade?: boolean;
logLevel?: number;
dryRun?: boolean;
profile?: boolean;
iterations: string;
};

Expand Down Expand Up @@ -105,7 +104,6 @@ async function execGraph({

Logger.verbose('executing all (async)');
await engine.executeAllAsync(5);
Logger.verbose(' completed');
}

if (lifecycleEventEmitter.tickEvent.listenerCount > 0) {
Expand All @@ -117,7 +115,6 @@ async function execGraph({
Logger.verbose('executing all (async)');
// eslint-disable-next-line no-await-in-loop
await engine.executeAllAsync(5);
Logger.verbose(' completed');
}
}

Expand All @@ -127,19 +124,16 @@ async function execGraph({

Logger.verbose('executing all (async)');
await engine.executeAllAsync(5);
Logger.verbose(' completed');
}

if (programOptions.profile) {
const deltaTime = Date.now() - startTime;
Logger.info(
`\n Profile Results: ${engine.executionSteps} nodes executed in ${
deltaTime / 1000
} seconds, at a rate of ${Math.round(
(engine.executionSteps * 1000) / deltaTime
)} steps/second`
);
}
const deltaTime = Date.now() - startTime;
Logger.verbose(
`profile results: ${engine.executionSteps} nodes executed in ${
deltaTime / 1000
} seconds, at a rate of ${Math.round(
(engine.executionSteps * 1000) / deltaTime
)} steps/second`
);

engine.dispose();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Diagnostics/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Logger {
public static readonly onError = new EventEmitter<string>();

static {
const prefix = () => {
const prefix = (): string => {
switch (Logger.prefixStyle) {
case PrefixStyle.None:
return '';
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/Graphs/Graph.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CustomEvent } from '../Events/CustomEvent.js';
import { Logger } from '../index.js';
import { Metadata } from '../Metadata.js';
import { NodeConfiguration } from '../Nodes/Node.js';
import { Dependencies } from '../Nodes/NodeDefinitions.js';
Expand Down Expand Up @@ -46,6 +47,7 @@ export const createNode = ({
nodeDefinition = registry.nodes[nodeTypeName];
}
if (nodeDefinition === undefined) {
Logger.verbose('known nodes: ' + Object.keys(registry.nodes).join(', '));
throw new Error(
`no registered node descriptions with the typeName ${nodeTypeName}`
);
Expand Down
6 changes: 4 additions & 2 deletions packages/scene/src/registerSceneProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ export const getSceneValuesMap = memo<ValueTypeMap>(() => {
Mat3Value,
Mat4Value
];
return Object.fromEntries(
const temp = Object.fromEntries(
valueTypes.map((valueType) => [valueType.name, valueType])
);
return temp;
});

export const getSceneStringConversions = (
values: Record<string, ValueType>
): NodeDefinition[] =>
Object.keys(getCoreValuesMap()).flatMap((valueTypeName) =>
Object.keys(values).flatMap((valueTypeName) =>
getStringConversionsForValueType({ values, valueTypeName })
);

Expand All @@ -58,6 +59,7 @@ export const getSceneNodesMap = memo<Record<string, NodeDefinition>>(() => {
...getCoreValuesMap(),
...getSceneValuesMap()
});

const nodeDefinitions = [
// pull in value type nodes
...getNodeDescriptions(Vec2Nodes),
Expand Down

0 comments on commit 2e34081

Please sign in to comment.