@@ -20,8 +20,6 @@ import io.github.axisangles.ktmath.Vector3
2020import org.apache.commons.lang3.tuple.Pair
2121import java.io.File
2222import java.util.*
23- import java.util.function.Consumer
24- import java.util.function.Function
2523import kotlin.math.*
2624
2725class AutoBone (private val server : VRServer ) {
@@ -74,17 +72,14 @@ class AutoBone(private val server: VRServer) {
7472 // Get current or default skeleton configs
7573 val skeleton = server.humanPoseManager
7674 // Still compensate for a null skeleton, as it may not be initialized yet
77- val getOffset: Function <SkeletonConfigOffsets , Float > =
78- if (skeleton != null ) {
79- Function { key: SkeletonConfigOffsets -> skeleton.getOffset(key) }
80- } else {
81- val defaultConfig = SkeletonConfigManager (false )
82- Function { config: SkeletonConfigOffsets ->
83- defaultConfig.getOffset(config)
84- }
85- }
75+ val defaultConfig = SkeletonConfigManager (false )
76+ val getOffset: (SkeletonConfigOffsets ) -> Float = if (skeleton != null ) {
77+ { key: SkeletonConfigOffsets -> skeleton.getOffset(key) }
78+ } else {
79+ { config: SkeletonConfigOffsets -> defaultConfig.getOffset(config) }
80+ }
8681 for (bone in adjustOffsets) {
87- val offset = getOffset. apply (bone)
82+ val offset = getOffset(bone)
8883 if (offset > 0f ) {
8984 offsets[bone] = offset
9085 }
@@ -216,7 +211,7 @@ class AutoBone(private val server: VRServer) {
216211 frames : PoseFrames ,
217212 config : AutoBoneConfig = globalConfig,
218213 skeletonConfig : SkeletonConfig = globalSkeletonConfig,
219- epochCallback : Consumer < Epoch > ? = null,
214+ epochCallback : (( Epoch ) -> Unit ) ? = null,
220215 ): AutoBoneResults {
221216 check(frames.frameHolders.isNotEmpty()) { " Recording has no trackers." }
222217 check(frames.maxFrameCount > 0 ) { " Recording has no frames." }
@@ -296,7 +291,7 @@ class AutoBone(private val server: VRServer) {
296291
297292 private fun epoch (
298293 step : PoseFrameStep <AutoBoneStep >,
299- epochCallback : Consumer < Epoch > ? = null,
294+ epochCallback : (( Epoch ) -> Unit ) ? = null,
300295 ) {
301296 val config = step.config
302297 val epoch = step.epoch
@@ -319,7 +314,7 @@ class AutoBone(private val server: VRServer) {
319314 for (entry in scaledOffsets.entries) {
320315 entry.setValue(entry.value * estimatedHeight)
321316 }
322- epochCallback.accept (Epoch (epoch + 1 , config.numEpochs, step.data.errorStats, scaledOffsets))
317+ epochCallback(Epoch (epoch + 1 , config.numEpochs, step.data.errorStats, scaledOffsets))
323318 }
324319 }
325320
0 commit comments