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

dev to int: Fix scene loading #10910

Merged
merged 23 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
42b5150
Revert "Physics reactivity for collider component updates and order d…
HexaField Aug 5, 2024
737d20b
fix collider reactivity (#10877)
HexaField Aug 5, 2024
efda564
fix duplicate new scene (#10880)
HexaField Aug 5, 2024
981d0e3
rigidbody initialization quick fix (#10883)
HexaField Aug 6, 2024
1b3f726
Upload drag drop files MT fix (#10881)
MichaelEstes Aug 6, 2024
609b136
LerpTransform from rigid body uses rigid body instead of scene entity…
DanielBelmes Aug 6, 2024
bafb02f
Merge branch 'int' into dev
HexaField Aug 6, 2024
3c49106
remove old workflows (#10886)
lucas3900 Aug 6, 2024
3e509e0
fix rigidbody crash server (#10891)
HexaField Aug 6, 2024
2f18910
Merge branch 'int' into dev
barankyle Aug 6, 2024
c0b4c25
IR-3561: Magic Link template support for mobile and desktop (#10889)
jose-galvan Aug 6, 2024
50aa284
Fixed bugs in instanceserver connections (#10887)
barankyle Aug 6, 2024
98c0b1f
ignore hash when checking cache validity (#10900)
dinomut1 Aug 6, 2024
25251c6
Merge branch 'int' into dev
dinomut1 Aug 6, 2024
1195e47
apply proper offsets to select (#10799)
aditya-mitra Aug 7, 2024
4cbb8be
match tooltip with figma design (#10690)
aditya-mitra Aug 7, 2024
1cf3ed6
center and elipse long text (#10895)
achen5671 Aug 7, 2024
06f9e9b
remove fixed height (#10899)
achen5671 Aug 7, 2024
ebe790c
replace studio assets pagination with infinite scroll (#10756)
achen5671 Aug 7, 2024
c9da46b
studio: swap lit unlit title (#10818)
achen5671 Aug 7, 2024
798312b
studio: update asset tree to new design (#10817)
achen5671 Aug 7, 2024
853a7f9
Restrict file name length to 64 characters (#10752)
SYBIOTE Aug 7, 2024
56c3946
ensure all models have loaded in the scene before marking scene as fu…
dinomut1 Aug 7, 2024
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
2 changes: 1 addition & 1 deletion packages/client-core/src/admin/adminRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const AdminTopBar = () => {
<HiMiniSun className="text-theme-primary" size="1.5rem" />
)}
</Button>
<Tooltip title={tooltip}>
<Tooltip content={tooltip}>
<Button className="pointer-events-auto" size="small" onClick={() => AuthService.logoutUser()}>
{t('admin:components.common.logOut')}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ export default function ProjectTable(props: { search: string }) {
{row.name}
</a>
{!!row.needsRebuild && (
<Tooltip title={t('admin:components.project.outdatedBuild')} position="right center">
<Tooltip content={t('admin:components.project.outdatedBuild')} position="right center">
<HiOutlineExclamationCircle className="text-orange-400" size={22} />
</Tooltip>
)}
{!!row.hasLocalChanges && (
<Tooltip title={t('admin:components.project.hasLocalChanges')} position="right center">
<Tooltip content={t('admin:components.project.hasLocalChanges')} position="right center">
<HiOutlineExclamationCircle className="text-yellow-400" size={22} />
</Tooltip>
)}
Expand All @@ -243,7 +243,7 @@ export default function ProjectTable(props: { search: string }) {
visibility: <Toggle value={row.visibility === 'public'} onChange={() => handleVisibilityChange(row)} />,
commitSHA: (
<span className="flex items-center justify-between">
<Tooltip title={row.commitSHA || ''}>
<Tooltip content={row.commitSHA || ''}>
<>{row.commitSHA?.slice(0, 8)}</>
</Tooltip>{' '}
<CopyText text={row.commitSHA || ''} className="ml-1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function ServerStatus({ serverPodInfo }: { serverPodInfo: ServerPodInfoType }) {
)}
<div className="flex gap-1">
{serverPodInfo.containers.map((container) => (
<Tooltip key={container.name} title={`${t('admin:components.server.name')}: ${container.name}`}>
<Tooltip key={container.name} content={`${t('admin:components.server.name')}: ${container.name}`}>
<div className={`${containerColor[container.status]} h-3.5 w-3.5 rounded-full`} />
</Tooltip>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const FeatureItem = ({ feature }: { feature: FeatureFlagSettingType }) => {
/>
{feature.userId && (
<Tooltip
title={t('admin:components.common.lastUpdatedBy', {
content={t('admin:components.common.lastUpdatedBy', {
userId: feature.userId,
updatedAt: toDisplayDateTime(feature.updatedAt)
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ const ProjectTab = forwardRef(({ open }: { open: boolean }, ref: React.MutableRe
endComponent={
setting.userId && (
<Tooltip
title={t('admin:components.common.lastUpdatedBy', {
position="left center"
content={t('admin:components.common.lastUpdatedBy', {
userId: setting.userId,
updatedAt: toDisplayDateTime(setting.updatedAt)
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,47 @@ export default function AccountIdentifiers({ user }: { user: UserType }) {
return (
<div className="flex items-center gap-2">
{appleIp ? (
<Tooltip title={appleIp.accountIdentifier!}>
<Tooltip content={appleIp.accountIdentifier!}>
<RiAppleFill className="h-6 w-6" />
</Tooltip>
) : null}
{discordIp ? (
<Tooltip title={discordIp.accountIdentifier!}>
<Tooltip content={discordIp.accountIdentifier!}>
<RiDiscordFill className="h-6 w-6" />
</Tooltip>
) : null}
{googleIp ? (
<Tooltip title={googleIp.accountIdentifier!}>
<Tooltip content={googleIp.accountIdentifier!}>
<RiGoogleFill className="h-6 w-6" />
</Tooltip>
) : null}
{facebookIp ? (
<Tooltip title={facebookIp.accountIdentifier!}>
<Tooltip content={facebookIp.accountIdentifier!}>
<RiMetaFill className="h-6 w-6" />
</Tooltip>
) : null}
{twitterIp ? (
<Tooltip title={twitterIp.accountIdentifier!}>
<Tooltip content={twitterIp.accountIdentifier!}>
<RiTwitterXFill className="h-6 w-6" />
</Tooltip>
) : null}
{linkedinIp ? (
<Tooltip title={linkedinIp.accountIdentifier!}>
<Tooltip content={linkedinIp.accountIdentifier!}>
<RiLinkedinFill className="h-6 w-6" />
</Tooltip>
) : null}
{githubIp ? (
<Tooltip title={githubIp.accountIdentifier!}>
<Tooltip content={githubIp.accountIdentifier!}>
<RiGithubFill className="h-6 w-6" />
</Tooltip>
) : null}
{smsIp ? (
<Tooltip title={smsIp.accountIdentifier!}>
<Tooltip content={smsIp.accountIdentifier!}>
<RiMessage2Line className="h-6 w-6" />
</Tooltip>
) : null}
{emailIp ? (
<Tooltip title={emailIp.accountIdentifier!}>
<Tooltip content={emailIp.accountIdentifier!}>
<MdEmail className="h-6 w-6" />
</Tooltip>
) : null}
Expand Down
5 changes: 2 additions & 3 deletions packages/common/src/regex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ Ethereal Engine. All Rights Reserved.
// Add unit tests for new patterns in packages/common/tests/regex.test.ts

// eslint-disable-next-line no-control-regex
export const INVALID_FILENAME_REGEX = /[_<>:"/\\|?*\u0000-\u001F]/
export const VALID_FILENAME_REGEX = /^(?!.*[\s_<>:"/\\|?*\u0000-\u001F].*)[^\s_<>:"/\\|?*\u0000-\u001F]{1,64}$/
// eslint-disable-next-line no-control-regex
export const INVALID_FILENAME_WHITESPACE_REGEX = /[\s_<>:"/\\|?*\u0000-\u001F]/
export const WINDOWS_RESERVED_NAME_REGEX = /^(con|prn|aux|nul|com\d|lpt\d)$/i
export const VALID_SCENE_NAME_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9-]{2,62}[a-zA-Z0-9_\-]$/
export const VALID_HEIRACHY_SEARCH_REGEX = /[.*+?^${}()|[\]\\]/g
export const VALID_HEIRARCHY_SEARCH_REGEX = /[.*+?^${}()|[\]\\]/g

/**
* Matches CSS imports & URLS.
Expand Down
33 changes: 18 additions & 15 deletions .../src/components/editor/layout/Tooltip.tsx → packages/common/src/utils/offsets.ts
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,22 @@ All portions of the code written by the Ethereal Engine team are Copyright © 20
Ethereal Engine. All Rights Reserved.
*/

import React from 'react'
import Tooltip, { TooltipProps } from '../../../primitives/tailwind/Tooltip'

export function InfoTooltip({ title, info, ...props }: TooltipProps & { info?: string }) {
const tooltipTitle = info ? (
<p>
{title}
<hr className="my-0.5" />
{info}
</p>
) : (
title
)

return <Tooltip title={tooltipTitle} {...props} />
import { Bounds, getBounds, getViewportBounds } from '@etherealengine/xrui'

export const calculateAndApplyYOffset = (element: HTMLElement | null, additionalOffset = 0) => {
if (!element) {
return
}
const popupBounds = getBounds(element)
const viewportBounds = getViewportBounds(new Bounds())

const overflowBottom =
(popupBounds?.top ?? 0) + (popupBounds?.height ?? 0) - (viewportBounds.top + viewportBounds.height)
let offsetY = 0

if (overflowBottom > 0) {
offsetY = -(popupBounds?.height ?? 0) + additionalOffset
}

element.style.transform = `translateY(${offsetY}px)`
}
8 changes: 2 additions & 6 deletions packages/common/src/utils/validateFileName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ All portions of the code written by the Ethereal Engine team are Copyright © 20
Ethereal Engine. All Rights Reserved.
*/

import { INVALID_FILENAME_WHITESPACE_REGEX, WINDOWS_RESERVED_NAME_REGEX } from '@etherealengine/common/src/regex'
import { VALID_FILENAME_REGEX, WINDOWS_RESERVED_NAME_REGEX } from '@etherealengine/common/src/regex'

export function isValidFileName(fileName: string) {
return (
!INVALID_FILENAME_WHITESPACE_REGEX.test(fileName) &&
!WINDOWS_RESERVED_NAME_REGEX.test(fileName) &&
fileName.length > 0
)
return VALID_FILENAME_REGEX.test(fileName) && !WINDOWS_RESERVED_NAME_REGEX.test(fileName)
}
63 changes: 17 additions & 46 deletions packages/common/tests/regex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import {
EMAIL_REGEX,
GITHUB_URL_REGEX,
INSTALLATION_SIGNED_REGEX,
INVALID_FILENAME_REGEX,
INVALID_FILENAME_WHITESPACE_REGEX,
INVITE_CODE_REGEX,
MAIN_CHART_REGEX,
PHONE_REGEX,
Expand All @@ -42,15 +40,16 @@ import {
PUBLIC_SIGNED_REGEX,
STATIC_ASSET_REGEX,
USER_ID_REGEX,
VALID_HEIRACHY_SEARCH_REGEX,
VALID_FILENAME_REGEX,
VALID_HEIRARCHY_SEARCH_REGEX,
VALID_PROJECT_NAME,
VALID_SCENE_NAME_REGEX,
WINDOWS_RESERVED_NAME_REGEX
} from '../src/regex'

describe('regex.test', () => {
describe('INVALID_FILENAME_REGEX', () => {
it('should match invalid filenames', () => {
it('should not match invalid filenames', () => {
const invalidFilenames = [
'hello_world',
'file<name',
Expand All @@ -61,14 +60,23 @@ describe('regex.test', () => {
'question?mark',
'asterisk*char',
'control\0char',
'another\ncontrol'
'another\ncontrol',
'file name',
'< tag >',
'key : value',
'quote " example',
'path / to / file',
'C:\\ path \\ to \\ file',
'pipe | character',
'question ? mark',
'star * char'
]
invalidFilenames.forEach((filename) => {
assert.ok(INVALID_FILENAME_REGEX.test(filename), `Expected '${filename}' to be invalid`)
assert.ok(!VALID_FILENAME_REGEX.test(filename), `Expected '${filename}' to be invalid`)
})
})

it('should not match valid filenames', () => {
it('should match valid filenames', () => {
const validFilenames = [
'helloworld',
'filename',
Expand All @@ -82,15 +90,15 @@ describe('regex.test', () => {
'anothercontrol'
]
validFilenames.forEach((filename) => {
assert.ok(!INVALID_FILENAME_REGEX.test(filename), `Expected '${filename}' to be valid`)
assert.ok(VALID_FILENAME_REGEX.test(filename), `Expected '${filename}' to be valid`)
})
})
})

describe('HEIRARCHY_SEARCH_REPLACE_REGEX', () => {
it('should replace special characters in search', () => {
const escapeSpecialChars = (input) => {
return input.replace(VALID_HEIRACHY_SEARCH_REGEX, '\\$&')
return input.replace(VALID_HEIRARCHY_SEARCH_REGEX, '\\$&')
}

const testCases = [
Expand All @@ -117,43 +125,6 @@ describe('regex.test', () => {
})
})

describe('INVALID_FILENAME_WHITESPACE_REGEX', () => {
it('should match invalid filenames', () => {
const invalidFilenames = [
'file name', // (a space and an underscore)
'< tag >', // (spaces and less-than < and greater-than > characters)
'key : value', // (a space and a colon :)
'quote " example', // (a space and a double quote ")
'path / to / file', // (spaces and forward slashes /)
'C:\\ path \\ to \\ file', // (spaces and backslashes \)
'pipe | character', // (a space and a pipe |)
'question ? mark', // (a space and a question mark ?)
'star * char' // (a space and an asterisk *)
]
invalidFilenames.forEach((filename) => {
assert.ok(INVALID_FILENAME_WHITESPACE_REGEX.test(filename), `Expected '${filename}' to be invalid`)
})
})

it('should not match valid filenames', () => {
const validFilenames = [
'helloworld',
'filename',
'emailexample.com',
'pathtofile',
'backslash',
'pipesymbol',
'questionmark',
'asteriskchar',
'controlchar',
'anothercontrol'
]
validFilenames.forEach((filename) => {
assert.ok(!INVALID_FILENAME_WHITESPACE_REGEX.test(filename), `Expected '${filename}' to be valid`)
})
})
})

describe('WINDOWS_RESERVED_NAME_REGEX', () => {
it('should match windows reserved names', () => {
const reservedNames = ['CON', 'PrN', 'auX', 'NUL', 'COM0', 'com1', 'Com9', 'LPT0', 'LpT4', 'lPt9']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const ImageCompressionBox = ({ compressProperties }: { compressProperties: State
onChange={compressProperties.flipY.set}
label={t('editor:properties.model.transform.flipY')}
/>
<Tooltip title={t('editor:properties.model.transform.flipYTooltip')}>
<Tooltip content={t('editor:properties.model.transform.flipYTooltip')}>
<HiOutlineInformationCircle />
</Tooltip>
</div>
Expand All @@ -88,7 +88,7 @@ const ImageCompressionBox = ({ compressProperties }: { compressProperties: State
onChange={compressProperties.srgb.set}
label={t('editor:properties.model.transform.srgb')}
/>
<Tooltip title={t('editor:properties.model.transform.srgbTooltip')}>
<Tooltip content={t('editor:properties.model.transform.srgbTooltip')}>
<HiOutlineInformationCircle />
</Tooltip>
</div>
Expand All @@ -98,7 +98,7 @@ const ImageCompressionBox = ({ compressProperties }: { compressProperties: State
onChange={compressProperties.mipmaps.set}
label={t('editor:properties.model.transform.mipmaps')}
/>
<Tooltip title={t('editor:properties.model.transform.mipmapsTooltip')}>
<Tooltip content={t('editor:properties.model.transform.mipmapsTooltip')}>
<HiOutlineInformationCircle />
</Tooltip>
</div>
Expand All @@ -108,7 +108,7 @@ const ImageCompressionBox = ({ compressProperties }: { compressProperties: State
onChange={compressProperties.normalMap.set}
label={t('editor:properties.model.transform.normalMap')}
/>
<Tooltip title={t('editor:properties.model.transform.normalMapTooltip')}>
<Tooltip content={t('editor:properties.model.transform.normalMapTooltip')}>
<HiOutlineInformationCircle />
</Tooltip>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class CachedImageLoadExtension extends ImporterExtension implements GLTFLoaderPl

loadTexture(textureIndex) {
const options = this.parser.options
if (!options.url?.endsWith('.gltf')) {
const baseURL = new URL(options.url)

if (!baseURL.pathname.endsWith('.gltf')) {
return this.parser.loadTexture(textureIndex)
}
const json = this.parser.json
Expand Down
19 changes: 17 additions & 2 deletions packages/engine/src/gltf/GLTFComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,21 @@ import { parseStorageProviderURLs } from '@etherealengine/common/src/utils/parse
import {
defineComponent,
Entity,
EntityUUID,
getComponent,
getMutableComponent,
getOptionalComponent,
hasComponent,
useComponent,
useEntityContext,
useQuery
useQuery,
UUIDComponent
} from '@etherealengine/ecs'
import { dispatchAction, getState, useHookstate } from '@etherealengine/hyperflux'

import { FileLoader } from '../assets/loaders/base/FileLoader'
import { BINARY_EXTENSION_HEADER_MAGIC, EXTENSIONS, GLTFBinaryExtension } from '../assets/loaders/gltf/GLTFExtensions'
import { ModelComponent } from '../scene/components/ModelComponent'
import { SourceComponent } from '../scene/components/SourceComponent'
import { SceneJsonType } from '../scene/types/SceneTypes'
import { migrateSceneJSONToGLTF } from './convertJsonToGLTF'
Expand Down Expand Up @@ -83,7 +86,19 @@ const ResourceReactor = (props: { documentID: string; entity: Entity }) => {
useEffect(() => {
if (getComponent(props.entity, GLTFComponent).progress === 100) return
if (!getState(GLTFDocumentState)[props.documentID]) return

const document = getState(GLTFDocumentState)[props.documentID]
const modelNodes = document.nodes?.filter((node) => !!node.extensions?.[ModelComponent.jsonID])
if (modelNodes) {
for (const node of modelNodes) {
//check if an entity exists for this node, and has a model component
const uuid = node.extensions![UUIDComponent.jsonID] as EntityUUID
if (!UUIDComponent.entitiesByUUIDState[uuid]) return
const entity = UUIDComponent.entitiesByUUIDState[uuid].value
const model = getOptionalComponent(entity, ModelComponent)
//ensure that model contents have been loaded into the scene
if (!model?.scene) return
}
}
const entities = resourceQuery.filter((e) => getComponent(e, SourceComponent) === props.documentID)
if (!entities.length) {
getMutableComponent(props.entity, GLTFComponent).progress.set(100)
Expand Down
Loading
Loading