From dbd483db016861c1d17b509f3bde8f86105dbadf Mon Sep 17 00:00:00 2001 From: sybiote Date: Tue, 7 Nov 2023 23:25:07 +0530 Subject: [PATCH 1/2] use exportable active behave graph --- examples/behaveGraph.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/examples/behaveGraph.tsx b/examples/behaveGraph.tsx index ec3627c..0906acf 100644 --- a/examples/behaveGraph.tsx +++ b/examples/behaveGraph.tsx @@ -1,7 +1,7 @@ import React from 'react' import { GraphJSON } from '@behave-graph/core' -import { Flow } from '@etherealengine/editor/src/components/graph/ee-flow' +import { ActiveBehaveGraph } from '@etherealengine/editor/src/components/graph/BehaveFlow' import '@etherealengine/editor/src/components/graph/ee-flow/styles.css' import { BehaveGraphComponent } from '@etherealengine/engine/src/behave-graph/components/BehaveGraphComponent' import { BehaveGraphState } from '@etherealengine/engine/src/behave-graph/state/BehaveGraphState' @@ -18,8 +18,6 @@ const entity = createEntity() setComponent(entity, BehaveGraphComponent, { graph: targetJson as unknown as GraphJSON }) export default function behaveGraphTest() { - const graphComponent = useComponent(entity, BehaveGraphComponent) - const behavegraphState = useHookstate(getMutableState(BehaveGraphState)) return ( <> @@ -37,15 +35,7 @@ export default function behaveGraphTest() { {({ width, height }) => (
- { - if (!graphComponent.graph || isEqual(graphComponent.graph.get(NO_PROXY), newGraph)) return - graphComponent.graph.set(JSON.parse(JSON.stringify(newGraph))) - }} - /> +
)}
From 896108dc72d0bbfdabae84e80e30b38da624a270 Mon Sep 17 00:00:00 2001 From: sybiote Date: Wed, 8 Nov 2023 00:08:11 +0530 Subject: [PATCH 2/2] remove unused imports and modify speed --- assets/graph/simpleController.json | 2 +- examples/behaveGraph.tsx | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/assets/graph/simpleController.json b/assets/graph/simpleController.json index e1ac4e0..be8f723 100644 --- a/assets/graph/simpleController.json +++ b/assets/graph/simpleController.json @@ -25,7 +25,7 @@ "value": "speed" }, "value": { - "value": "2" + "value": ".8" } } }, diff --git a/examples/behaveGraph.tsx b/examples/behaveGraph.tsx index 0906acf..5290d88 100644 --- a/examples/behaveGraph.tsx +++ b/examples/behaveGraph.tsx @@ -4,11 +4,8 @@ import { GraphJSON } from '@behave-graph/core' import { ActiveBehaveGraph } from '@etherealengine/editor/src/components/graph/BehaveFlow' import '@etherealengine/editor/src/components/graph/ee-flow/styles.css' import { BehaveGraphComponent } from '@etherealengine/engine/src/behave-graph/components/BehaveGraphComponent' -import { BehaveGraphState } from '@etherealengine/engine/src/behave-graph/state/BehaveGraphState' -import { setComponent, useComponent } from '@etherealengine/engine/src/ecs/functions/ComponentFunctions' +import { setComponent } from '@etherealengine/engine/src/ecs/functions/ComponentFunctions' import { createEntity } from '@etherealengine/engine/src/ecs/functions/EntityFunctions' -import { NO_PROXY, getMutableState, useHookstate } from '@etherealengine/hyperflux' -import isEqual from 'lodash/isEqual' import AutoSizer from 'react-virtualized-auto-sizer' import 'reactflow/dist/style.css' import targetJson from '../assets/graph/simpleController.json'