fix: tilt Memento shy state left
This commit is contained in:
parent
271a0dfa2f
commit
89083bd0a1
@ -320,6 +320,7 @@ const fixedSkinColorBehavior = (behavior?: AvatarBehaviorLibrary): AvatarBehavio
|
|||||||
|
|
||||||
const mementoHeadsetWorkingExpressionId = 'memento-headset-working-joyful-eyes'
|
const mementoHeadsetWorkingExpressionId = 'memento-headset-working-joyful-eyes'
|
||||||
const mementoHeadsetShyExpressionId = 'memento-headset-shy-left'
|
const mementoHeadsetShyExpressionId = 'memento-headset-shy-left'
|
||||||
|
const mementoHeadsetShyTiltExpressionId = 'memento-headset-shy-left-tilt'
|
||||||
|
|
||||||
const copyExpressionEyes = (target: Expression, source: Expression): Expression => ({
|
const copyExpressionEyes = (target: Expression, source: Expression): Expression => ({
|
||||||
...target,
|
...target,
|
||||||
@ -348,7 +349,8 @@ const mementoBehavior = (
|
|||||||
expression.semanticKey !== 'onboarding-listening' &&
|
expression.semanticKey !== 'onboarding-listening' &&
|
||||||
expression.semanticKey !== 'onboarding-curious' &&
|
expression.semanticKey !== 'onboarding-curious' &&
|
||||||
expression.semanticKey !== mementoHeadsetWorkingExpressionId &&
|
expression.semanticKey !== mementoHeadsetWorkingExpressionId &&
|
||||||
expression.semanticKey !== mementoHeadsetShyExpressionId
|
expression.semanticKey !== mementoHeadsetShyExpressionId &&
|
||||||
|
expression.semanticKey !== mementoHeadsetShyTiltExpressionId
|
||||||
)
|
)
|
||||||
const expressions = sourceExpressions.map(expression => {
|
const expressions = sourceExpressions.map(expression => {
|
||||||
const fixedColorExpression = { ...expression }
|
const fixedColorExpression = { ...expression }
|
||||||
@ -415,12 +417,34 @@ const mementoBehavior = (
|
|||||||
positionYRight: shySource.positionYRight + 10,
|
positionYRight: shySource.positionYRight + 10,
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
|
const shyTiltSource = expressions.find(expression => expression.semanticKey === 'shy-downward')
|
||||||
|
const headsetShyTiltExpression =
|
||||||
|
customizeHeadsetExpressions && shyTiltSource
|
||||||
|
? {
|
||||||
|
...shyTiltSource,
|
||||||
|
id: mementoHeadsetShyTiltExpressionId,
|
||||||
|
semanticKey: mementoHeadsetShyTiltExpressionId,
|
||||||
|
headZ: -Math.abs(shyTiltSource.headZ),
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
const sequenceFirstExpression = new Map<string, string>([
|
const sequenceFirstExpression = new Map<string, string>([
|
||||||
...(headsetWorkingExpression ? [['working', headsetWorkingExpression.id] as const] : []),
|
...(headsetWorkingExpression ? [['working', headsetWorkingExpression.id] as const] : []),
|
||||||
...(headsetShyExpression ? [['shy', headsetShyExpression.id] as const] : []),
|
...(headsetShyExpression ? [['shy', headsetShyExpression.id] as const] : []),
|
||||||
])
|
])
|
||||||
const resolvedSequences = sequences.map(sequence => {
|
const resolvedSequences = sequences.map(sequence => {
|
||||||
const expressionId = sequenceFirstExpression.get(sequence.semanticKey ?? '')
|
const expressionId = sequenceFirstExpression.get(sequence.semanticKey ?? '')
|
||||||
|
if (sequence.semanticKey === 'shy' && headsetShyTiltExpression) {
|
||||||
|
return {
|
||||||
|
...sequence,
|
||||||
|
steps: sequence.steps.map((step, index) =>
|
||||||
|
index === 0 && expressionId
|
||||||
|
? { ...step, expressionId }
|
||||||
|
: index === 1
|
||||||
|
? { ...step, expressionId: headsetShyTiltExpression.id }
|
||||||
|
: step
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
return expressionId
|
return expressionId
|
||||||
? {
|
? {
|
||||||
...sequence,
|
...sequence,
|
||||||
@ -435,6 +459,7 @@ const mementoBehavior = (
|
|||||||
...expressions,
|
...expressions,
|
||||||
...(headsetWorkingExpression ? [headsetWorkingExpression] : []),
|
...(headsetWorkingExpression ? [headsetWorkingExpression] : []),
|
||||||
...(headsetShyExpression ? [headsetShyExpression] : []),
|
...(headsetShyExpression ? [headsetShyExpression] : []),
|
||||||
|
...(headsetShyTiltExpression ? [headsetShyTiltExpression] : []),
|
||||||
...onboardingExpressions,
|
...onboardingExpressions,
|
||||||
],
|
],
|
||||||
sequences: [
|
sequences: [
|
||||||
|
|||||||
@ -230,6 +230,9 @@ describe('Studio document', () => {
|
|||||||
const headsetShyFirst = headsetMemento?.behavior?.sequences.find(
|
const headsetShyFirst = headsetMemento?.behavior?.sequences.find(
|
||||||
sequence => sequence.semanticKey === 'shy'
|
sequence => sequence.semanticKey === 'shy'
|
||||||
)?.steps[0]
|
)?.steps[0]
|
||||||
|
const headsetShySecond = headsetMemento?.behavior?.sequences.find(
|
||||||
|
sequence => sequence.semanticKey === 'shy'
|
||||||
|
)?.steps[1]
|
||||||
const headsetWorkingExpression = headsetMemento?.behavior?.expressions.find(
|
const headsetWorkingExpression = headsetMemento?.behavior?.expressions.find(
|
||||||
expression => expression.id === headsetWorkingFirst?.expressionId
|
expression => expression.id === headsetWorkingFirst?.expressionId
|
||||||
)
|
)
|
||||||
@ -239,6 +242,9 @@ describe('Studio document', () => {
|
|||||||
const headsetShyExpression = headsetMemento?.behavior?.expressions.find(
|
const headsetShyExpression = headsetMemento?.behavior?.expressions.find(
|
||||||
expression => expression.id === headsetShyFirst?.expressionId
|
expression => expression.id === headsetShyFirst?.expressionId
|
||||||
)
|
)
|
||||||
|
const headsetShyTiltExpression = headsetMemento?.behavior?.expressions.find(
|
||||||
|
expression => expression.id === headsetShySecond?.expressionId
|
||||||
|
)
|
||||||
expect(headsetWorkingExpression).toMatchObject({
|
expect(headsetWorkingExpression).toMatchObject({
|
||||||
widthLeft: headsetJoyfulExpression?.widthLeft,
|
widthLeft: headsetJoyfulExpression?.widthLeft,
|
||||||
widthRight: headsetJoyfulExpression?.widthRight,
|
widthRight: headsetJoyfulExpression?.widthRight,
|
||||||
@ -260,6 +266,11 @@ describe('Studio document', () => {
|
|||||||
positionYLeft: initialExpressions[0].positionYLeft + 10,
|
positionYLeft: initialExpressions[0].positionYLeft + 10,
|
||||||
positionYRight: initialExpressions[0].positionYRight + 10,
|
positionYRight: initialExpressions[0].positionYRight + 10,
|
||||||
})
|
})
|
||||||
|
expect(headsetShyTiltExpression).toMatchObject({
|
||||||
|
headX: initialExpressions[24].headX,
|
||||||
|
headY: initialExpressions[24].headY,
|
||||||
|
headZ: -Math.abs(initialExpressions[24].headZ),
|
||||||
|
})
|
||||||
expect(
|
expect(
|
||||||
memento?.behavior?.sequences.find(sequence => sequence.semanticKey === 'joyful')?.steps[0]
|
memento?.behavior?.sequences.find(sequence => sequence.semanticKey === 'joyful')?.steps[0]
|
||||||
.expressionId
|
.expressionId
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user