Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
add dependency to hierarchy generation that updates with every source…
Browse files Browse the repository at this point in the history
…d entity created (#10401)
  • Loading branch information
dinomut1 authored Jun 17, 2024
1 parent 99bf284 commit 282861d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import AutoSizer from 'react-virtualized-auto-sizer'
import { FixedSizeList } from 'react-window'

import { NotificationService } from '@etherealengine/client-core/src/common/services/NotificationService'
import { Engine, EntityUUID, UUIDComponent, entityExists } from '@etherealengine/ecs'
import { Engine, EntityUUID, UUIDComponent, entityExists, useQuery } from '@etherealengine/ecs'
import { CameraOrbitComponent } from '@etherealengine/spatial/src/camera/components/CameraOrbitComponent'

import useUpload from '@etherealengine/editor/src/components/assets/useUpload'
Expand All @@ -56,6 +56,7 @@ import { cmdOrCtrlString } from '@etherealengine/editor/src/functions/utils'
import { EditorState } from '@etherealengine/editor/src/services/EditorServices'
import { SelectionState } from '@etherealengine/editor/src/services/SelectionServices'
import { GLTFAssetState, GLTFSnapshotState } from '@etherealengine/engine/src/gltf/GLTFState'
import { SourceComponent } from '@etherealengine/engine/src/scene/components/SourceComponent'
import { PopoverPosition } from '@mui/material'
import { HiMagnifyingGlass, HiOutlinePlusCircle } from 'react-icons/hi2'
import { HierarchyPanelTab } from '..'
Expand Down Expand Up @@ -90,7 +91,7 @@ function HierarchyPanelContents(props: { sceneURL: string; rootEntityUUID: Entit
const [selectedNode, _setSelectedNode] = useState<HeirarchyTreeNodeType | null>(null)
const lockPropertiesPanel = useHookstate(getMutableState(EditorState).lockPropertiesPanel)
const searchHierarchy = useHookstate('')

const sourcedEntities = useQuery([SourceComponent])
const rootEntity = UUIDComponent.useEntityByUUID(rootEntityUUID)
const rootEntityTree = useComponent(rootEntity, EntityTreeComponent)

Expand Down Expand Up @@ -122,7 +123,7 @@ function HierarchyPanelContents(props: { sceneURL: string; rootEntityUUID: Entit

useEffect(() => {
entityHierarchy.set(Array.from(heirarchyTreeWalker(sceneURL, rootEntity)))
}, [expandedNodes, index, rootEntityTree.children])
}, [expandedNodes, index, rootEntityTree.children, sourcedEntities.length])

const setSelectedNode = (selection) => !lockPropertiesPanel.value && _setSelectedNode(selection)

Expand Down

0 comments on commit 282861d

Please sign in to comment.