Skip to content

Commit

Permalink
modify: Fix typo in FaceTracking abstract class.
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Action committed May 31, 2024
1 parent 22d9ffb commit fccf3ef
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Update native library to Cubism 5 SDK for Native R1.

- Update JavaOpenGL binding to jogl 2.5.0.

- Fix variable name typo in FaceTracking abstract class. Rename `trackingNoes` to `trackingNodes`.
- Refine CI pipeline.
- Use GitHub shared actions for building test environment / run unit test...etc.
- Use Debian as a building environment in GitHub Actions CI pipeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ object FaceTracking {

abstract class FaceTracking(protected val trackingTaps: TrackingTaps) extends Effect {

protected[impl] var trackingNoes: List[TrackingNode] = Nil
protected[impl] var trackingNodes: List[TrackingNode] = Nil

override def calculateOperations(model: Live2DModel, totalElapsedTimeInSeconds: Float, deltaTimeInSeconds: Float): List[UpdateOperation] = {
trackingNoes match {
trackingNodes match {
case Nil => Nil
case _ => calculateOperations()
}
Expand All @@ -43,15 +43,15 @@ abstract class FaceTracking(protected val trackingTaps: TrackingTaps) extends Ef
private var isFirst = true

private def calculateOperations(): List[UpdateOperation] = {
val faceXAngle = average(trackingNoes.take(trackingTaps.faceXAngle).map(_.faceXAngle))
val faceYAngle = average(trackingNoes.take(trackingTaps.faceYAngle).map(_.faceYAngle))
val faceZAngle = average(trackingNoes.take(trackingTaps.faceZAngle).map(_.faceZAngle))
val leftEyeOpenness = average(trackingNoes.take(trackingTaps.leftEyeOpenness).map(_.leftEyeOpenness))
val rightEyeOpenness = average(trackingNoes.take(trackingTaps.rightEyeOpenness).map(_.rightEyeOpenness))
val mouthOpenness = average(trackingNoes.take(trackingTaps.mouthOpenness).map(_.mouthOpenness))
val mouthForm = average(trackingNoes.take(trackingTaps.mouthForm).map(_.mouthForm))
val leftEyeSmile = average(trackingNoes.take(trackingTaps.leftEyeSmile).map(_.leftEyeSmile))
val rightEyeSmile = average(trackingNoes.take(trackingTaps.rightEyeSmile).map(_.rightEyeSmile))
val faceXAngle = average(trackingNodes.take(trackingTaps.faceXAngle).map(_.faceXAngle))
val faceYAngle = average(trackingNodes.take(trackingTaps.faceYAngle).map(_.faceYAngle))
val faceZAngle = average(trackingNodes.take(trackingTaps.faceZAngle).map(_.faceZAngle))
val leftEyeOpenness = average(trackingNodes.take(trackingTaps.leftEyeOpenness).map(_.leftEyeOpenness))
val rightEyeOpenness = average(trackingNodes.take(trackingTaps.rightEyeOpenness).map(_.rightEyeOpenness))
val mouthOpenness = average(trackingNodes.take(trackingTaps.mouthOpenness).map(_.mouthOpenness))
val mouthForm = average(trackingNodes.take(trackingTaps.mouthForm).map(_.mouthForm))
val leftEyeSmile = average(trackingNodes.take(trackingTaps.leftEyeSmile).map(_.leftEyeSmile))
val rightEyeSmile = average(trackingNodes.take(trackingTaps.rightEyeSmile).map(_.rightEyeSmile))

if (isFirst) {
this.lastFaceXAngle = faceXAngle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ class OpenSeeFaceTracking(dataReader: OpenSeeFaceDataReader,
val trackingNodeHolder = reader
.readData()
.map { data =>
val leftEyePreviousNodes = trackingNoes.take(trackingTaps.leftEyeOpenness)
val rightEyePreviousNodes = trackingNoes.take(trackingTaps.rightEyeOpenness)
val leftEyePreviousNodes = trackingNodes.take(trackingTaps.leftEyeOpenness)
val rightEyePreviousNodes = trackingNodes.take(trackingTaps.rightEyeOpenness)

dataConverter.convert(data, leftEyePreviousNodes, rightEyePreviousNodes)
}

trackingNodeHolder.foreach { node =>
trackingNoes = (node :: trackingNoes).take(trackingTaps.maxTaps)
trackingNodes = (node :: trackingNodes).take(trackingTaps.maxTaps)
lastUpdateTime = System.currentTimeMillis
}

if (System.currentTimeMillis - lastUpdateTime > idleTimeoutInMs) {
trackingNoes = Nil
trackingNodes = Nil
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class FaceTrackingFeature extends AnyFeatureSpec with GivenWhenThen with Matcher
private val DefaultFaceTrackingTaps = TrackingTaps(3, 4, 5, 6, 7, 8, 9, 10, 11, 11)

class FixedFaceTracking(currentTrackingNoes: List[TrackingNode]) extends FaceTracking(DefaultFaceTrackingTaps) {
this.trackingNoes = currentTrackingNoes
this.trackingNodes = currentTrackingNoes

override def start(): Unit = {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class OpenSeeFaceTrackingFeature extends AnyFeatureSpec with GivenWhenThen with
tracking.stop()

Then("the trackingNodes should contain all the nodes")
tracking.trackingNoes should contain theSameElementsInOrderAs List(stubbedTrackingNode3, stubbedTrackingNode2, stubbedTrackingNode1)
tracking.trackingNodes should contain theSameElementsInOrderAs List(stubbedTrackingNode3, stubbedTrackingNode2, stubbedTrackingNode1)
}

Scenario("Add more nodes than maxTapping") {
Expand Down Expand Up @@ -124,7 +124,7 @@ class OpenSeeFaceTrackingFeature extends AnyFeatureSpec with GivenWhenThen with
tracking.stop()

Then("the trackingNodes should contain only last 3 nodes")
tracking.trackingNoes should contain theSameElementsInOrderAs List(stubbedTrackingNode5, stubbedTrackingNode4, stubbedTrackingNode3)
tracking.trackingNodes should contain theSameElementsInOrderAs List(stubbedTrackingNode5, stubbedTrackingNode4, stubbedTrackingNode3)
}

Scenario("Idle longer than expected") {
Expand Down Expand Up @@ -156,7 +156,7 @@ class OpenSeeFaceTrackingFeature extends AnyFeatureSpec with GivenWhenThen with
tracking.stop()

Then("the trackingNodes should clear to Nil")
tracking.trackingNoes shouldBe Nil
tracking.trackingNodes shouldBe Nil

}

Expand Down

0 comments on commit fccf3ef

Please sign in to comment.