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

Introduce Prefab System #10047

Draft
wants to merge 10 commits into
base: dev
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { EntityUUID } from '@etherealengine/ecs'
import { MaterialSelectionState } from '@etherealengine/engine/src/scene/materials/MaterialLibraryState'
import { Popover } from '@mui/material'
import { ComponentEditorsState } from '../../functions/ComponentEditors'
import { EditorHelperState } from '../../services/EditorHelperState'
import { EditorState } from '../../services/EditorServices'
import { SelectionState } from '../../services/SelectionServices'
import { PropertiesPanelButton } from '../inputs/Button'
Expand Down Expand Up @@ -62,7 +63,7 @@ const EntityEditor = (props: { entityUUID: EntityUUID; multiEdit: boolean }) =>
const entity = UUIDComponent.getEntityByUUID(entityUUID)
useHookstate(getMutableState(ComponentEditorsState).keys).value
const components = useAllComponents(entity).filter((c) => !!getState(ComponentEditorsState)[c.name])

const studioMode = useHookstate(getMutableState(EditorHelperState).studioMode)
const open = !!anchorEl.value

return (
Expand All @@ -74,13 +75,16 @@ const EntityEditor = (props: { entityUUID: EntityUUID; multiEdit: boolean }) =>
}}
>
<div style={{ display: 'flex', justifyContent: 'center', marginTop: '0.5rem' }}>
<PropertiesPanelButton onClick={(event) => anchorEl.set(event.currentTarget)}>
<PropertiesPanelButton
onClick={(event) => anchorEl.set(event.currentTarget)}
style={{ display: studioMode.value === 'Simple' ? 'none' : 'block' }}
>
{t('editor:properties.lbl-addComponent')}
</PropertiesPanelButton>
</div>
<Popover
id={open ? 'add-component-popover' : undefined}
open={open}
open={open && studioMode.value == 'Advanced'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use === instead of ==

anchorEl={anchorEl.value}
onClose={() => anchorEl.set(null)}
anchorOrigin={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function HierarchyPanelContents({ rootEntityUUID }: { rootEntityUUID: EntityUUID
const rootEntity = UUIDComponent.useEntityByUUID(rootEntityUUID)
const sceneID = useHookstate(getMutableState(EditorState).sceneID)
const index = SceneSnapshotState.useSnapshotIndex(sceneID.value!)
const studioMode = useHookstate(getMutableState(EditorHelperState).studioMode)

const MemoTreeNode = useCallback(
(props: HierarchyTreeNodeProps) => (
Expand Down Expand Up @@ -490,7 +491,7 @@ function HierarchyPanelContents({ rootEntityUUID }: { rootEntityUUID: EntityUUID
}}
onClick={(event) => {
anchorElement.set(event.currentTarget)
if (getMutableState(EditorHelperState).studioMode.value == 'Advanced') {
if (studioMode.value == 'Advanced') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use === instead of ==

EditorControlFunctions.createObjectFromSceneElement()
}
}}
Expand All @@ -507,7 +508,7 @@ function HierarchyPanelContents({ rootEntityUUID }: { rootEntityUUID: EntityUUID
>
<Popover
id={open ? 'add-component-popover' : undefined}
open={open && getMutableState(EditorHelperState).studioMode.value == 'Simple'}
open={open && studioMode.value == 'Simple'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use === instead of ==

anchorEl={anchorElement.value}
onClose={() => anchorElement.set(null)}
anchorOrigin={{
Expand Down
Loading