Skip to content

Commit

Permalink
Added support for shapes in scene.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed May 28, 2024
1 parent 337684d commit d9fc877
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/input/Scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ export default class Scene extends StreamValue<
return StreamType.make(
UnionType.make(
new StructureType(this.evaluator.project.shares.output.Phrase),
new StructureType(this.evaluator.project.shares.output.Group),
UnionType.make(
new StructureType(
this.evaluator.project.shares.output.Group,
),
new StructureType(
this.evaluator.project.shares.output.Shape,
),
),
),
);
}
Expand All @@ -90,7 +97,8 @@ export default class Scene extends StreamValue<
val instanceof BoolValue ||
(val instanceof StructureValue &&
(val.is(this.evaluator.project.shares.output.Phrase) ||
val.is(this.evaluator.project.shares.output.Group))),
val.is(this.evaluator.project.shares.output.Group) ||
val.is(this.evaluator.project.shares.output.Shape))),
);
}

Expand Down Expand Up @@ -209,10 +217,11 @@ export function createSceneDefinition(
locale: Locales,
phrase: StructureDefinition,
group: StructureDefinition,
shape: StructureDefinition,
): StreamDefinition {
const streamOutputType = UnionType.make(
new StructureType(phrase),
new StructureType(group),
UnionType.make(new StructureType(group), new StructureType(shape)),
);
const streamInputType = UnionType.make(
streamOutputType.clone(),
Expand Down
5 changes: 3 additions & 2 deletions src/runtime/createDefaultShares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ export default function createDefaultShares(locales: Locales) {
const ReboundType = createReboundType(locales);
const PhraseType = createPhraseType(locales);
const GroupType = createGroupType(locales);
const ShapeType = createShapeType(locales);

const OutputTypes = {
Type: TypeType,
Phrase: PhraseType,
Group: GroupType,
Aura: createAuraType(locales),
Stage: createStageType(locales),
Shape: createShapeType(locales),
Shape: ShapeType,
Pose: createPoseType(locales),
Sequence: createSequenceType(locales),
Color: ColorType,
Expand Down Expand Up @@ -97,7 +98,7 @@ export default function createDefaultShares(locales: Locales) {
Chat: createChatDefinition(locales),
Collision: createCollisionDefinition(locales, ReboundType),
Reaction: createReactionDefinition(locales),
Scene: createSceneDefinition(locales, PhraseType, GroupType),
Scene: createSceneDefinition(locales, PhraseType, GroupType, ShapeType),
};

const Sequences = getDefaultSequences(locales);
Expand Down

0 comments on commit d9fc877

Please sign in to comment.