Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions packages/editor/src/components/properties/CoreNodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const visibleInputGroupStyle = {
export const CoreNodeEditor = (props) => {
const { t } = useTranslation()
const editorState = useHookstate(getMutableState(EditorState))
const selectionState = useHookstate(getMutableState(SelectionState))

useOptionalComponent(props.entity, VisibleComponent)

Expand All @@ -84,7 +83,9 @@ export const CoreNodeEditor = (props) => {
>
<button
onClick={() => {
const currentEntity = selectionState.selectedEntities.value[0]
const entities = getMutableState(SelectionState).selectedEntities.value
const currentEntity = entities[0]

const currentState = editorState.lockPropertiesPanel.value
if (currentState) {
getMutableState(EditorState).lockPropertiesPanel.set('' as EntityUUID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Ethereal Engine. All Rights Reserved.
*/

import { useHookstate } from '@hookstate/core'
import React from 'react'
import React, { useEffect } from 'react'
import { useTranslation } from 'react-i18next'

import { Entity } from '@etherealengine/engine/src/ecs/classes/Entity'
import { Entity, UndefinedEntity } from '@etherealengine/engine/src/ecs/classes/Entity'
import {
ComponentJSONIDMap,
getAllComponents,
Expand Down Expand Up @@ -110,15 +110,21 @@ const EntityEditor = (props: { entity: Entity; multiEdit: boolean }) => {
export const PropertiesPanelContainer = () => {
const selectionState = useHookstate(getMutableState(SelectionState))
const editorState = useHookstate(getMutableState(EditorState))
const selectedEntities = selectionState.selectedEntities.value
const { t } = useTranslation()
const [entity, setEntity] = React.useState<Entity | null>(UndefinedEntity)
const [multiEdit, setMultiEdit] = React.useState<boolean>(false)

const lockedNode = editorState.lockPropertiesPanel.value
const multiEdit = selectedEntities.length > 1
const { t } = useTranslation()

const entity = lockedNode
? UUIDComponent.entitiesByUUID[lockedNode] ?? lockedNode
: selectedEntities[selectedEntities.length - 1]
useEffect(() => {
const selectedEntities = selectionState.selectedEntities.value
const lockedNode = editorState.lockPropertiesPanel.value
setMultiEdit(selectedEntities.length > 1)
setEntity(
lockedNode
? UUIDComponent.entitiesByUUID[lockedNode] ?? lockedNode
: selectedEntities[selectedEntities.length - 1]
)
}, [selectionState.selectedEntities])

const materialID = useHookstate(getMutableState(MaterialSelectionState)).selectedMaterial.value

Expand Down