Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix core engine package cross-imports #872

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move entity tree to ecs package
  • Loading branch information
HexaField committed Dec 24, 2024
commit 248e479ff602af40c80b984329b9fc1e501ee4c4
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ import Text from '@ir-engine/client-core/src/common/components/Text'
import { useRender3DPanelSystem } from '@ir-engine/client-core/src/user/components/Panel3D/useRender3DPanelSystem'
import {
createEntity,
EntityTreeComponent,
generateEntityUUID,
getChildrenWithComponents,
getOptionalComponent,
removeComponent,
removeEntity,
Expand All @@ -47,7 +49,6 @@ import { AmbientLightComponent, TransformComponent } from '@ir-engine/spatial'
import { AssetPreviewCameraComponent } from '@ir-engine/spatial/src/camera/components/AssetPreviewCameraComponent'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { EntityTreeComponent, getChildrenWithComponents } from '@ir-engine/spatial/src/transform/components/EntityTree'
import Box from '@ir-engine/ui/src/primitives/mui/Box'
import Icon from '@ir-engine/ui/src/primitives/mui/Icon'
import Tooltip from '@ir-engine/ui/src/primitives/mui/Tooltip'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { Color, Euler, Material, Mesh, Quaternion, SphereGeometry } from 'three'

import { useFind } from '@ir-engine/common'
import config from '@ir-engine/common/src/config'
import { getChildrenWithComponents, useChildWithComponents } from '@ir-engine/ecs'
import { useGLTFComponent, useTexture } from '@ir-engine/engine/src/assets/functions/resourceLoaderHooks'
import { GLTFComponent } from '@ir-engine/engine/src/gltf/GLTFComponent'
import { ErrorComponent } from '@ir-engine/engine/src/scene/components/ErrorComponent'
Expand All @@ -68,10 +69,6 @@ import { setCameraFocusOnBox } from '@ir-engine/spatial/src/camera/functions/Cam
import { addObjectToGroup } from '@ir-engine/spatial/src/renderer/components/GroupComponent'
import { MeshComponent } from '@ir-engine/spatial/src/renderer/components/MeshComponent'
import { BackgroundComponent, SceneComponent } from '@ir-engine/spatial/src/renderer/components/SceneComponents'
import {
getChildrenWithComponents,
useChildWithComponents
} from '@ir-engine/spatial/src/transform/components/EntityTree'
import { uploadToFeathersService } from '../../util/upload'
import { getCanvasBlob } from '../utils'

Expand Down
3 changes: 1 addition & 2 deletions packages/client-core/src/components/Debug/EntityDebug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import React from 'react'
import { useTranslation } from 'react-i18next'
import { JSONTree } from 'react-json-tree'

import { UUIDComponent } from '@ir-engine/ecs'
import { EntityTreeComponent, UUIDComponent } from '@ir-engine/ecs'
import {
Component,
ComponentMap,
Expand All @@ -53,7 +53,6 @@ import {
useMutableState
} from '@ir-engine/hyperflux'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { Input } from '@ir-engine/ui'
import Text from '@ir-engine/ui/src/primitives/tailwind/Text'

Expand Down
3 changes: 1 addition & 2 deletions packages/client-core/src/media/webcam/WebcamInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Comlink from 'comlink'

import { isDev } from '@ir-engine/common/src/config'
import logger from '@ir-engine/common/src/logger'
import { UUIDComponent } from '@ir-engine/ecs'
import { UUIDComponent, iterateEntityNode } from '@ir-engine/ecs'
import { getOptionalComponent, hasComponent, setComponent } from '@ir-engine/ecs/src/ComponentFunctions'
import { Entity } from '@ir-engine/ecs/src/Entity'
import { defineQuery } from '@ir-engine/ecs/src/QueryFunctions'
Expand All @@ -13,7 +13,6 @@ import { defineActionQueue, getMutableState } from '@ir-engine/hyperflux'
import { createWorkerFromCrossOriginURL } from '@ir-engine/spatial/src/common/functions/createWorkerFromCrossOriginURL'
import { GroupComponent } from '@ir-engine/spatial/src/renderer/components/GroupComponent'
import { SkinnedMeshComponent } from '@ir-engine/spatial/src/renderer/components/SkinnedMeshComponent'
import { iterateEntityNode } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { MediaStreamState } from '../MediaStreamState'
import { WebcamInputComponent } from './WebcamInputComponent'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
Engine,
EngineState,
Entity,
EntityTreeComponent,
SystemDefinitions,
UUIDComponent,
createEntity,
Expand All @@ -53,7 +54,6 @@ import {
import { NetworkActions, NetworkState, NetworkTopics } from '@ir-engine/network'
import { createMockNetwork } from '@ir-engine/network/tests/createMockNetwork'
import { SpectateActions } from '@ir-engine/spatial/src/camera/systems/SpectateSystem'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { act, render } from '@testing-library/react'
import React from 'react'
import { Cache } from 'three'
Expand Down
3 changes: 1 addition & 2 deletions packages/client-core/src/networking/AvatarSpawnSystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ import { SpectateActions } from '@ir-engine/spatial/src/camera/systems/SpectateS

import { useFind, useMutation } from '@ir-engine/common'
import { avatarPath, userAvatarPath } from '@ir-engine/common/src/schema.type.module'
import { EngineState } from '@ir-engine/ecs'
import { EngineState, useChildrenWithComponents } from '@ir-engine/ecs'
import { AvatarNetworkAction } from '@ir-engine/engine/src/avatar/state/AvatarNetworkActions'
import { ErrorComponent } from '@ir-engine/engine/src/scene/components/ErrorComponent'
import { SceneSettingsComponent } from '@ir-engine/engine/src/scene/components/SceneSettingsComponent'
import { useChildrenWithComponents } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { SearchParamState } from '../common/services/RouterService'
import { useLoadedSceneEntity } from '../hooks/useLoadedSceneEntity'
import { LocationState } from '../social/services/LocationService'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
defineComponent,
ECSState,
Entity,
EntityTreeComponent,
getComponent,
getMutableComponent,
getOptionalComponent,
Expand All @@ -52,7 +53,6 @@ import { smootheLerpAlpha } from '@ir-engine/spatial/src/common/functions/MathLe
import { RigidBodyComponent } from '@ir-engine/spatial/src/physics/components/RigidBodyComponent'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { ComputedTransformComponent } from '@ir-engine/spatial/src/transform/components/ComputedTransformComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { XRUIComponent } from '@ir-engine/spatial/src/xrui/components/XRUIComponent'
import { WebLayer3D } from '@ir-engine/xrui'
import { useEffect } from 'react'
Expand Down
3 changes: 1 addition & 2 deletions packages/client-core/src/systems/LoadingUISystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Infinite Reality Engine. All Rights Reserved.
import React, { useEffect } from 'react'
import { BackSide, Color, Mesh, MeshBasicMaterial, SphereGeometry, Vector2 } from 'three'

import { Entity, UndefinedEntity } from '@ir-engine/ecs'
import { Entity, EntityTreeComponent, UndefinedEntity, useChildWithComponents } from '@ir-engine/ecs'
import {
getComponent,
getMutableComponent,
Expand Down Expand Up @@ -54,7 +54,6 @@ import { setObjectLayers } from '@ir-engine/spatial/src/renderer/components/Obje
import { VisibleComponent, setVisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { ObjectLayers } from '@ir-engine/spatial/src/renderer/constants/ObjectLayers'
import { ComputedTransformComponent } from '@ir-engine/spatial/src/transform/components/ComputedTransformComponent'
import { EntityTreeComponent, useChildWithComponents } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { TransformComponent } from '@ir-engine/spatial/src/transform/components/TransformComponent'
import { ObjectFitFunctions } from '@ir-engine/spatial/src/transform/functions/ObjectFitFunctions'
import { TransformDirtyUpdateSystem } from '@ir-engine/spatial/src/transform/systems/TransformSystem'
Expand Down
10 changes: 8 additions & 2 deletions packages/client-core/src/systems/MediaControlSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ Infinite Reality Engine. All Rights Reserved.
import { Vector3 } from 'three'

import { isClient } from '@ir-engine/common/src/utils/getEnvironment'
import { Engine, EngineState, getMutableComponent, InputSystemGroup, UndefinedEntity } from '@ir-engine/ecs'
import {
Engine,
EngineState,
EntityTreeComponent,
getMutableComponent,
InputSystemGroup,
UndefinedEntity
} from '@ir-engine/ecs'
import { getComponent, getOptionalComponent, setComponent } from '@ir-engine/ecs/src/ComponentFunctions'
import { ECSState } from '@ir-engine/ecs/src/ECSState'
import { Entity } from '@ir-engine/ecs/src/Entity'
Expand All @@ -39,7 +46,6 @@ import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { InputComponent } from '@ir-engine/spatial/src/input/components/InputComponent'
import { InputSourceComponent } from '@ir-engine/spatial/src/input/components/InputSourceComponent'
import { InputState } from '@ir-engine/spatial/src/input/state/InputState'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { TransformComponent } from '@ir-engine/spatial/src/transform/components/TransformComponent'
import { XRUIComponent } from '@ir-engine/spatial/src/xrui/components/XRUIComponent'
import { WebLayer3D } from '@ir-engine/xrui'
Expand Down
2 changes: 1 addition & 1 deletion packages/client-core/src/systems/WidgetUISystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ import {
} from '@ir-engine/hyperflux'
// import { createHeightAdjustmentWidget } from './createHeightAdjustmentWidget'
// import { createMediaWidget } from './createMediaWidget'
import { EntityTreeComponent } from '@ir-engine/ecs'
import { CameraComponent } from '@ir-engine/spatial/src/camera/components/CameraComponent'
import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { Vector3_Back, Vector3_Up } from '@ir-engine/spatial/src/common/constants/MathConstants'
import { InputSourceComponent } from '@ir-engine/spatial/src/input/components/InputSourceComponent'
import { XRStandardGamepadButton } from '@ir-engine/spatial/src/input/state/ButtonState'
import { VisibleComponent, setVisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import { ComputedTransformComponent } from '@ir-engine/spatial/src/transform/components/ComputedTransformComponent'
import { EntityTreeComponent } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { TransformComponent } from '@ir-engine/spatial/src/transform/components/TransformComponent'
import { ObjectFitFunctions } from '@ir-engine/spatial/src/transform/functions/ObjectFitFunctions'
import { TransformSystem } from '@ir-engine/spatial/src/transform/systems/TransformSystem'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/Vis
import { XRState } from '@ir-engine/spatial/src/xr/XRState'
import { WidgetAppActions } from './WidgetAppService'

import { Engine, EntityUUID, UUIDComponent } from '@ir-engine/ecs'
import { Engine, EntityTreeComponent, EntityUUID, UUIDComponent, iterateEntityNode } from '@ir-engine/ecs'
import { AvatarComponent } from '@ir-engine/engine/src/avatar/components/AvatarComponent'
import { translateAndRotateAvatar, updateLocalAvatarPosition } from '@ir-engine/engine/src/avatar/functions/moveAvatar'
import { respawnAvatar } from '@ir-engine/engine/src/avatar/functions/respawnAvatar'
import { EntityNetworkState } from '@ir-engine/network'
import { ReferenceSpaceState, TransformComponent } from '@ir-engine/spatial'
import { RigidBodyComponent } from '@ir-engine/spatial/src/physics/components/RigidBodyComponent'
import { EntityTreeComponent, iterateEntityNode } from '@ir-engine/spatial/src/transform/components/EntityTree'
import { computeTransformMatrix } from '@ir-engine/spatial/src/transform/systems/TransformSystem'
import { Quaternion, Vector3 } from 'three'
import { Widget, Widgets } from './Widgets'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ Infinite Reality Engine. All Rights Reserved.
import React, { useEffect } from 'react'

import {
EntityTreeComponent,
EntityUUID,
UUIDComponent,
UndefinedEntity,
createEntity,
generateEntityUUID,
hasComponent,
removeEntityNodeRecursively,
setComponent
} from '@ir-engine/ecs'
import { useHookstate } from '@ir-engine/hyperflux'
Expand All @@ -42,10 +44,6 @@ import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
import { InputComponent } from '@ir-engine/spatial/src/input/components/InputComponent'
import { RendererComponent } from '@ir-engine/spatial/src/renderer/WebGLRendererSystem'
import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
import {
EntityTreeComponent,
removeEntityNodeRecursively
} from '@ir-engine/spatial/src/transform/components/EntityTree'

export function useRender3DPanelSystem(canvas: React.MutableRefObject<HTMLCanvasElement>) {
const canvasRef = useHookstate(canvas.current)
Expand Down
5 changes: 5 additions & 0 deletions packages/ecs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
import { executeFixedSystem, executeSystems, getDAG } from './src/EngineFunctions'
import { UndefinedEntity } from './src/Entity'
import { createEntity, entityExists, removeEntity, useEntityContext } from './src/EntityFunctions'
import { EntityTreeComponent } from './src/EntityTree'
import { defineQuery, QueryReactor, removeQuery, useQuery } from './src/QueryFunctions'
import { defineSystem, destroySystem, executeSystem, useExecute } from './src/SystemFunctions'
import { UUIDComponent } from './src/UUIDComponent'
Expand Down Expand Up @@ -76,6 +77,8 @@ const ECS = {
entityExists,
useEntityContext,
UndefinedEntity,
/** Hierarchy */
EntityTreeComponent,
/** System API */
executeSystem,
defineSystem,
Expand Down Expand Up @@ -105,8 +108,10 @@ export * from './src/ComponentFunctions'
export * from './src/ECSState'
export * from './src/Engine'
export * from './src/EngineFunctions'
export * from './src/EngineState'
export * from './src/Entity'
export * from './src/EntityFunctions'
export * from './src/EntityTree'
export * from './src/QueryFunctions'
export * from './src/schemas/ECSSchemas'
export * from './src/schemas/JSONSchemas'
Expand Down
Loading
Loading