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

IR-1791: Fix Hierarchy Panel Updating on GLTF load #10401

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Changes from all commits
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
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
Loading