Skip to content

Commit 9ef869d

Browse files
authored
Merge pull request #1149 from decentraland/chore/sync-main
chore: sync main into experimental
2 parents c8238a2 + af65f85 commit 9ef869d

86 files changed

Lines changed: 2741 additions & 447 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ coverage:
33
project:
44
default:
55
threshold: 1%
6-
patch:
6+
patch: off
77
default:
88
threshold: 1%

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
77
"dependencies": {
88
"@actions/core": "^1.10.0",
9-
"@dcl/protocol": "1.0.0-15561894653.commit-9a42a0f",
9+
"@dcl/protocol": "1.0.0-16079712278.commit-7b0267f",
1010
"@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1",
1111
"@dcl/ts-proto": "1.153.0",
1212
"@types/fs-extra": "^9.0.12",

packages/@dcl/ecs/src/systems/crdt/index.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ import {
2222
import { INetowrkEntityType } from '../../components/types'
2323
import * as networkUtils from '../../serialization/crdt/network/utils'
2424

25+
// NetworkMessages can only have a MAX_SIZE of 12kb. So we need to send it in chunks.
26+
export const LIVEKIT_MAX_SIZE = 12
27+
2528
/**
2629
* @public
2730
*/
@@ -245,8 +248,6 @@ export function crdtSceneSystem(engine: PreEngine, onProcessEntityComponentChang
245248
// Send CRDT messages to transports
246249
const transportBuffer = new ReadWriteByteBuffer()
247250
for (const index in transports) {
248-
// NetworkMessages can only have a MAX_SIZE of 13kb. So we need to send it in chunks.
249-
const LIVEKIT_MAX_SIZE = 13
250251
const __NetworkMessagesBuffer: Uint8Array[] = []
251252

252253
const transportIndex = Number(index)
@@ -260,10 +261,25 @@ export function crdtSceneSystem(engine: PreEngine, onProcessEntityComponentChang
260261

261262
// Then we send all the new crdtMessages that the transport needs to process
262263
for (const message of crdtMessages) {
263-
if (isNetworkTransport && transportBuffer.toBinary().byteLength / 1024 > LIVEKIT_MAX_SIZE) {
264-
__NetworkMessagesBuffer.push(transportBuffer.toBinary())
265-
transportBuffer.resetBuffer()
264+
// Check if adding this message would exceed the size limit
265+
const currentBufferSize = transportBuffer.toBinary().byteLength
266+
const messageSize = message.messageBuffer.byteLength
267+
268+
if (isNetworkTransport && (currentBufferSize + messageSize) / 1024 > LIVEKIT_MAX_SIZE) {
269+
// If the current buffer has content, save it as a chunk
270+
if (currentBufferSize > 0) {
271+
__NetworkMessagesBuffer.push(transportBuffer.toCopiedBinary())
272+
transportBuffer.resetBuffer()
273+
}
274+
275+
// If the message itself is larger than the limit, we need to handle it specially
276+
// For now, we'll skip it to prevent infinite loops
277+
if (messageSize / 1024 > LIVEKIT_MAX_SIZE) {
278+
console.error(`Message too large (${messageSize} bytes), skipping message for entity ${message.entityId}`)
279+
continue
280+
}
266281
}
282+
267283
// Avoid echo messages
268284
if (message.transportId === transportIndex) continue
269285

packages/@dcl/inspector/package-lock.json

Lines changed: 47 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@dcl/inspector/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@dcl/inspector",
33
"version": "0.1.0",
44
"dependencies": {
5-
"@dcl/asset-packs": "2.4.3",
5+
"@dcl/asset-packs": "2.5.1",
66
"ts-deepmerge": "^7.0.0"
77
},
88
"devDependencies": {

packages/@dcl/inspector/src/components/AssetPreview/AssetPreview.tsx

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AiFillSound } from 'react-icons/ai'
66
import { IoVideocamOutline } from 'react-icons/io5'
77
import { FaFile } from 'react-icons/fa'
88

9-
import { toWearableWithBlobs } from './utils'
9+
import { toEmoteWithBlobs, toWearableWithBlobs } from './utils'
1010
import { Props } from './types'
1111

1212
import './AssetPreview.css'
@@ -15,13 +15,21 @@ import { useRef } from 'react'
1515
const WIDTH = 300
1616
const HEIGHT = 300
1717

18-
export function AssetPreview({ value, resources, onScreenshot, onLoad }: Props) {
18+
export function AssetPreview({ value, resources, onScreenshot, onLoad, isEmote }: Props) {
1919
const preview = useMemo(() => {
2020
const ext = value.name.split('.').pop()
2121
switch (ext) {
2222
case 'gltf':
2323
case 'glb':
24-
return <GltfPreview value={value} resources={resources} onScreenshot={onScreenshot} onLoad={onLoad} />
24+
return (
25+
<GltfPreview
26+
value={value}
27+
resources={resources}
28+
onScreenshot={onScreenshot}
29+
onLoad={onLoad}
30+
isEmote={isEmote}
31+
/>
32+
)
2533
case 'png':
2634
case 'jpg':
2735
case 'jpeg':
@@ -40,27 +48,52 @@ export function AssetPreview({ value, resources, onScreenshot, onLoad }: Props)
4048
return <div className="AssetPreview">{preview}</div>
4149
}
4250

43-
function GltfPreview({ value, resources, onScreenshot, onLoad }: Props) {
51+
function GltfPreview({ value, resources, onScreenshot, onLoad, isEmote }: Props) {
4452
const [loading, setLoading] = useState(true)
45-
const handleLoad = useCallback(() => {
46-
onLoad?.()
47-
const wp = WearablePreview.createController(value.name)
48-
void wp.scene.getScreenshot(WIDTH, HEIGHT).then(($) => {
53+
54+
const handleScreenshot = useCallback(
55+
(screenshot: string) => {
4956
setTimeout(() => {
50-
onScreenshot($)
57+
onScreenshot(screenshot)
5158
setLoading(false)
52-
}, 1000) // ugly hack to avoid iframe flickering...
53-
})
54-
}, [onLoad])
59+
}, 1000)
60+
},
61+
[onScreenshot]
62+
)
63+
64+
const handleLoad = useCallback(async () => {
65+
onLoad?.()
66+
const wp = WearablePreview.createController(value.name)
67+
if (isEmote) {
68+
const length = await wp.emote.getLength()
69+
//takes a screenshot at the middle of the emote
70+
void wp.emote.goTo(length * 0.5).then(() => {
71+
void wp.scene.getScreenshot(WIDTH, HEIGHT).then(handleScreenshot)
72+
})
73+
} else {
74+
void wp.scene.getScreenshot(WIDTH, HEIGHT).then(handleScreenshot)
75+
}
76+
}, [onLoad, value, isEmote, handleScreenshot])
77+
78+
const wearablePreviewExtraOptions = isEmote
79+
? {
80+
profile: 'default',
81+
disableFace: true,
82+
disableDefaultWearables: true,
83+
skin: '000000',
84+
wheelZoom: 2
85+
}
86+
: {}
5587

5688
return (
5789
<>
5890
<div className={cx('GltfPreview', { hidden: loading })}>
5991
<WearablePreview
6092
id={value.name}
61-
blob={toWearableWithBlobs(value, resources)}
93+
blob={isEmote ? toEmoteWithBlobs(value, resources) : toWearableWithBlobs(value, resources)}
6294
disableAutoRotate
6395
disableBackground
96+
{...wearablePreviewExtraOptions}
6497
projection={PreviewProjection.ORTHOGRAPHIC}
6598
camera={PreviewCamera.STATIC}
6699
onLoad={handleLoad}

packages/@dcl/inspector/src/components/AssetPreview/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export interface Props {
33
resources?: File[]
44
onScreenshot: (value: string) => void
55
onLoad?: () => void
6+
isEmote?: boolean
67
}

0 commit comments

Comments
 (0)