Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
06e24ef
updated aang build with builder mode support
daniele-dcl Mar 10, 2026
bdd8502
Fix boolean params parsing
RocioCM Mar 11, 2026
5310816
updated aang build with all missing features
daniele-dcl Mar 12, 2026
49ea0c4
Add missing social emotes methods to unity preview
RocioCM Mar 12, 2026
22b28b6
Add base64 prefix to unity screenshot
RocioCM Mar 12, 2026
3d7b8c5
Remove loaded message after init
RocioCM Mar 13, 2026
62955b2
Add support to uncompressed builds in dev
RocioCM Mar 13, 2026
ee24ff5
Add new spring bones controller method
RocioCM Mar 19, 2026
0c6cc9c
Update schemas library dev
RocioCM Mar 19, 2026
7f7bf79
Merge branch 'master' of github.com:decentraland/wearable-preview int…
RocioCM Mar 24, 2026
bc088e0
Merge branch 'feat/builder-mode-support' of github.com:decentraland/w…
RocioCM Mar 24, 2026
e8178bf
Fix type error
RocioCM Mar 25, 2026
04e0a6c
Add extra typing
RocioCM Mar 25, 2026
0a8952d
Update setSpringBonesParams arg type
RocioCM Mar 26, 2026
a1bf634
Update schemas lib
RocioCM Mar 26, 2026
35ad751
Update schemas
RocioCM Apr 1, 2026
8f243ae
Update aang build
RocioCM Apr 2, 2026
bd6ce96
Update build and fix playback controls
RocioCM Apr 2, 2026
9322cda
Update aang build
RocioCM Apr 2, 2026
c9c01ef
Update build and fix playback controls
RocioCM Apr 2, 2026
1c0bdaa
Merge branch 'feat/builder-mode-support' of github.com:decentraland/w…
RocioCM Apr 2, 2026
faf597b
Merge branch 'master' of github.com:decentraland/wearable-preview int…
RocioCM Apr 2, 2026
32ba868
Fix PR comments
RocioCM Apr 2, 2026
26c6d67
Merge branch 'feat/builder-mode-support' of github.com:decentraland/w…
RocioCM Apr 2, 2026
61d0184
Update schemas version
RocioCM Apr 6, 2026
d83df70
Merge branch 'master' of github.com:decentraland/wearable-preview int…
RocioCM Apr 7, 2026
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
26 changes: 15 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@babylonjs/inspector": "^4.2.2",
"@babylonjs/loaders": "^4.2.2",
"@babylonjs/materials": "^4.2.2",
"@dcl/schemas": "^20.3.3",
"@dcl/schemas": "^26.0.0",
"@dcl/ui-env": "^1.5.1",
"@sentry/browser": "^10.42.0",
"classnames": "^2.3.1",
Expand Down
6 changes: 3 additions & 3 deletions src/components/UnityPreview/UnityPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@ const useUnityRenderer = (

try {
const emoteDefinition = config?.itemDefinition && isEmote(config.itemDefinition) ? config.itemDefinition : null
const { unity, scene, emote } = await render(
const { unity, ...previewController } = await render(
refs.canvas.current,
emoteDefinition,
config?.socialEmote || undefined,
)
refs.unityInstance.current = unity
controller.current = { scene, emote }
controller.current = previewController

// Forward emote events as postMessages to the parent iframe
// Store cleanup to avoid listener leaks on re-init
if (emoteCleanupRef.current) {
emoteCleanupRef.current()
}
// Forward emote events as postMessages to the parent iframe
emoteCleanupRef.current = handleEmoteEvents(controller.current!)

// Unity instance is initialized; wait for Unity LOADED message to mark as loaded and notify parent
Expand Down
18 changes: 16 additions & 2 deletions src/lib/babylon/render.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { Color4, Mesh, TransformNode, Color3 } from '@babylonjs/core'
import { PreviewConfig, PreviewType, BodyShape, IPreviewController, IEmoteController } from '@dcl/schemas'
import {
PreviewConfig,
PreviewType,
BodyShape,
IPreviewController,
IEmoteController,
IPhysicsController,
SpringBoneParams,
} from '@dcl/schemas'
import { captureException } from '../sentry'
import { createInvalidEmoteController, isEmote } from '../emote'
import { getBodyShape } from './body'
Expand All @@ -23,8 +31,13 @@ export async function render(canvas: HTMLCanvasElement, config: PreviewConfig):
// setup the mappings for all the contents
setupMappings(config)

// emote controller
let emoteController: IEmoteController
const physicsController: IPhysicsController = {
// Noop. Spring bones are not supported in Babylon.
setSpringBonesParams(_itemHash: string, _params: Record<string, SpringBoneParams>): Promise<void> {
return Promise.resolve()
},
}

// load all the wearables into the root scene
const promises: Promise<void | Asset>[] = []
Expand Down Expand Up @@ -121,6 +134,7 @@ export async function render(canvas: HTMLCanvasElement, config: PreviewConfig):
const controller: IPreviewController = {
scene: sceneController,
emote: emoteController,
physics: physicsController,
}
return controller
} catch (error) {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/unity/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export enum UnityMethod {

// Query methods
GET_ELEMENT_BOUNDS = 'GetElementBounds',

// Physics
SET_SPRING_BONES_PARAMS = 'SetSpringBonesParams',
}

// Property mapping to Unity JSBridge methods
Expand Down
12 changes: 12 additions & 0 deletions src/lib/unity/physics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { IPhysicsController, SpringBoneParams } from '@dcl/schemas'
import { UnityMethod } from './messages'
import { UnityInstance } from './render'

export function createPhysicsController(instance: UnityInstance): IPhysicsController {
return {
setSpringBonesParams: async (itemHash: string, params: Record<string, SpringBoneParams>): Promise<void> => {
if (!instance) return
instance.SendMessage('JSBridge', UnityMethod.SET_SPRING_BONES_PARAMS, JSON.stringify({ itemHash, params }))
},
}
}
3 changes: 3 additions & 0 deletions src/lib/unity/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { loadUnityInstance } from './loader'
import { createSceneController } from './scene'
import { createEmoteController } from './emote'
import { captureException } from '../sentry'
import { createPhysicsController } from './physics'

export interface UnityInstance {
SendMessage: (objectName: string, methodName: string, value: string) => void
Expand Down Expand Up @@ -83,10 +84,12 @@ export async function render(

const sceneController = createSceneController(instance)
const emoteController = createEmoteController(instance, emote, socialEmote)
const physicsController = createPhysicsController(instance)

return {
scene: sceneController,
emote: emoteController,
physics: physicsController,
unity: instance,
}
} catch (error) {
Expand Down