Skip to content
This repository was archived by the owner on Jun 10, 2022. 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
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,20 @@ export class ClientSync extends Protocol {
* Driver for the `create-animations` synchronization stage.
*/
public 'stage:create-animations' = () => {
// send all managed create-animation messages
// Send all create-animation calls. The other animation creators were sent in create-actors.
for (const message of this.client.session.animationCreators) {
if (message.payload.type === 'create-animation-2') {
super.sendMessage(message);
const createMessage = message as Message<Payloads.CreateAnimation2>;
const updateMessage = this.client.session.animationSet.get(createMessage.payload.animation.id).update;

// merge lastest state into initial state for create
super.sendMessage({ ...createMessage,
payload: { ...createMessage.payload,
animation: { ...createMessage.payload.animation,
...updateMessage?.payload.animation
}
}
} as Message<Payloads.CreateAnimation2>);
}
}
};
Expand All @@ -225,7 +235,9 @@ export class ClientSync extends Protocol {
public 'stage:sync-animations' = () => {
// sync new-style animations
for (const anim of this.client.session.animations) {
if (anim.update) {
const createMessage = this.client.session.animationCreatorSet.get(anim.id);
// direct animation updates are merged into the create call, skip here
if (anim.update && createMessage.payload.type !== 'create-animation-2') {
super.sendMessage(anim.update);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/internal/adapters/multipeer/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class Session extends EventEmitter {
public get animationSet() { return this._animationSet; }
public get animations() { return this._animationSet.values(); }
public get animationCreators() { return this._animationCreatorSet.values(); }
public get animationCreatorSet() { return this._animationCreatorSet; }
public get actorSet() { return this._actorSet; }
public get assetSet() { return this._assetSet; }
public get assetCreatorSet() { return this._assetCreatorSet; }
Expand Down