Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

[SDK] Remove ForwardPromise from actor creation calls #381

Merged
merged 1 commit into from
Jul 10, 2019
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
6 changes: 5 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
{
"type": "npm",
"script": "build",
"problemMatcher": []
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

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

22 changes: 11 additions & 11 deletions packages/functional-tests/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class App {
name: 'testRoot',
exclusiveToUser: this.exclusiveUser && this.exclusiveUser.id || undefined
}
}).value;
});

if (wasRunning) {
this.runTest(user);
Expand All @@ -234,7 +234,7 @@ export class App {
}
}
}
}).value;
});
const label = MRE.Actor.CreateEmpty(this.context, {
actor: {
parentId: this.exclusiveUserToggle.id,
Expand All @@ -249,7 +249,7 @@ export class App {
anchor: MRE.TextAnchorLocation.MiddleLeft
}
}
}).value;
});
this.exclusiveUserLabel = label.text;

this.exclusiveUserToggle.setBehavior(MRE.ButtonBehavior)
Expand All @@ -270,7 +270,7 @@ export class App {
}
},
}
}).value;
});

const wall = MRE.Actor.CreatePrimitive(this.context, {
definition: {
Expand All @@ -287,7 +287,7 @@ export class App {
}
}
}
}).value;
});

this.sharedActors = [this.exclusiveUserToggle, label, wall, floor];
}
Expand All @@ -310,14 +310,14 @@ export class App {
}
}
}
}).value;
});

this.testRoot = MRE.Actor.CreateEmpty(this.context, {
actor: {
name: 'testRoot',
exclusiveToUser: this.exclusiveUser && this.exclusiveUser.id || undefined
}
}).value;
});

if (this.params.nomenu === 'true') {
this.runnerActors = [this.contextLabel];
Expand All @@ -344,7 +344,7 @@ export class App {
}
}
}
}).value;
});

this.playPauseText = MRE.Actor.CreateEmpty(this.context, {
actor: {
Expand All @@ -362,7 +362,7 @@ export class App {
color: NeutralColor
}
}
}).value;
});

this.playPauseButton.setBehavior(MRE.ButtonBehavior)
.onButton("released", user => {
Expand All @@ -387,7 +387,7 @@ export class App {
}
}
}
}).value;
});

const menuText = MRE.Actor.CreateEmpty(this.context, {
actor: {
Expand All @@ -405,7 +405,7 @@ export class App {
color: MRE.Color3.Black()
}
}
}).value;
});

menuButton.setBehavior(MRE.ButtonBehavior)
.onButton("released", async () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/functional-tests/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default class Menu {
}
}
}
}).value;
});
this.behaviors.push(control.setBehavior(MRE.ButtonBehavior));
this.buttons.push(control);

Expand All @@ -151,7 +151,7 @@ export default class Menu {
anchor: MRE.TextAnchorLocation.MiddleLeft
}
}
}).value;
});
this.labels.push(label);
}

Expand All @@ -169,7 +169,7 @@ export default class Menu {
}
}
}
}).value;
});

const backLabel = MRE.Actor.CreateEmpty(this.context, {
actor: {
Expand All @@ -186,7 +186,7 @@ export default class Menu {
anchor: MRE.TextAnchorLocation.MiddleLeft
}
}
}).value;
});

backButton.setBehavior(MRE.ButtonBehavior)
.onButton('released', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class AltspaceVRLibraryTest extends Test {

public async run(root: MRE.Actor): Promise<boolean> {
// AltspaceVR resource IDs from https://account.altvr.com/kits/
const libraryActors: Array<MRE.ForwardPromise<MRE.Actor>> = [];
const libraryActors: MRE.Actor[] = [];
libraryActors.push(MRE.Actor.CreateFromLibrary(this.app.context, {
resourceId: "artifact:993646440251130011",
actor: {
Expand Down Expand Up @@ -92,12 +92,12 @@ export default class AltspaceVRLibraryTest extends Test {
}));

// Show the item name when hovering on each item
libraryActors.forEach((actor: MRE.ForwardPromise<MRE.Actor>) => {
libraryActors.forEach((actor: MRE.Actor) => {
if (actor) {
const buttonBehavior = actor.value.setBehavior(MRE.ButtonBehavior);
const buttonBehavior = actor.setBehavior(MRE.ButtonBehavior);
// Trigger the grow/shrink animations on hover.
buttonBehavior.onHover('enter', () => {
this.app.setOverrideText(actor.value.name);
this.app.setOverrideText(actor.name);
});
buttonBehavior.onHover('exit', () => {
this.app.setOverrideText(null);
Expand Down
6 changes: 3 additions & 3 deletions packages/functional-tests/src/tests/altspacevr-video-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class AltspaceVRVideoTest extends Test {
private _state = 0;

public async run(root: MRE.Actor): Promise<boolean> {
const video = await MRE.Actor.CreateEmpty(this.app.context, {
const video = MRE.Actor.CreateEmpty(this.app.context, {
actor: {
parentId: root.id,
name: 'video',
Expand Down Expand Up @@ -62,7 +62,7 @@ export default class AltspaceVRVideoTest extends Test {
};
cycleState();

const buttonPromise = MRE.Actor.CreatePrimitive(this.app.context, {
const button = MRE.Actor.CreatePrimitive(this.app.context, {
definition: {
shape: MRE.PrimitiveShape.Sphere,
radius: 0.2,
Expand All @@ -82,7 +82,7 @@ export default class AltspaceVRVideoTest extends Test {
}
});

const buttonBehavior = buttonPromise.value.setBehavior(MRE.ButtonBehavior);
const buttonBehavior = button.setBehavior(MRE.ButtonBehavior);
buttonBehavior.onButton('released', cycleState);

await this.stoppedAsync();
Expand Down
4 changes: 2 additions & 2 deletions packages/functional-tests/src/tests/asset-preload-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class AssetPreloadTest extends Test {

private async setup() {
this.uvgridMat.mainTexture = this.uvgridTex;
this.head = await MRE.Actor.CreateFromPrefab(this.app.context, {
this.head = MRE.Actor.CreateFromPrefab(this.app.context, {
prefabId: this.monkeyPrefab.id,
actor: {
parentId: this.root.id,
Expand All @@ -106,7 +106,7 @@ export default class AssetPreloadTest extends Test {
}
}
});
this.sphere = await MRE.Actor.CreatePrimitive(this.app.context, {
this.sphere = MRE.Actor.CreatePrimitive(this.app.context, {
definition: {
shape: MRE.PrimitiveShape.Sphere,
radius: 0.5
Expand Down
Loading