diff --git a/ios/src/AssetManager.cpp b/ios/src/AssetManager.cpp index d706c0fc..8bd61e8c 100644 --- a/ios/src/AssetManager.cpp +++ b/ios/src/AssetManager.cpp @@ -557,8 +557,6 @@ bool AssetManager::setBoneAnimationBuffer( frameData + numFrames * numBones * 7 ); - Log("%d frames for %d bones", numFrames, numBones); - animationBuffer.mFrameLengthInMs = frameLengthInMs; animationBuffer.mNumFrames = numFrames; diff --git a/lib/animations/bone_driver.dart b/lib/animations/bone_driver.dart index 3ca30f5f..7a78abf3 100644 --- a/lib/animations/bone_driver.dart +++ b/lib/animations/bone_driver.dart @@ -51,17 +51,10 @@ class BoneDriver { return rotation; }).toList(); - if (frameNum == 0) { - print(rotations); - } - var result = rotations.fold( rotations.first, (Quaternion a, Quaternion b) => a + b); result.w = 1; - print("RESULT $result"); yield result; - // .normalized(); - // todo - bone translations } } diff --git a/lib/animations/csv_animation.dart b/lib/animations/csv_animation.dart index 93b917bf..5de360a3 100644 --- a/lib/animations/csv_animation.dart +++ b/lib/animations/csv_animation.dart @@ -8,7 +8,7 @@ import 'package:polyvox_filament/animations/morph_animation_data.dart'; import 'package:vector_math/vector_math.dart'; /// -/// A class for loading animation data from a single CSV and allocating between morph/bone animation with help. +/// A class for loading animation data from a single CSV and allocating between morph/bone animation. /// class DynamicAnimation { final MorphAnimationData? morphAnimation; @@ -22,8 +22,14 @@ class DynamicAnimation { // create a MorphAnimationData instance from the given CSV var llf = _loadLiveLinkFaceCSV(csvPath); var frameLengthInMs = 1000 / (framerate ?? 60.0); - var morphNames = llf - .item1; //.where((name) => !boneDrivers.any((element) => element.blendshape == name)); + var morphNames = llf.item1; + + if (boneDrivers != null) { + morphNames = morphNames + .where((name) => + boneDrivers!.any((element) => element.bone == name) == false) + .toList(); + } var morphAnimationData = MorphAnimationData( meshName ?? "NULL", llf.item2, morphNames, frameLengthInMs); @@ -84,7 +90,9 @@ class DynamicAnimation { /// /// Load visemes fom a CSV file formatted according to the following header: /// "Timecode,BlendShapeCount,EyeBlinkLeft,EyeLookDownLeft,EyeLookInLeft,EyeLookOutLeft,EyeLookUpLeft,EyeSquintLeft,EyeWideLeft,EyeBlinkRight,EyeLookDownRight,EyeLookInRight,EyeLookOutRight,EyeLookUpRight,EyeSquintRight,EyeWideRight,JawForward,JawRight,JawLeft,JawOpen,MouthClose,MouthFunnel,MouthPucker,MouthRight,MouthLeft,MouthSmileLeft,MouthSmileRight,MouthFrownLeft,MouthFrownRight,MouthDimpleLeft,MouthDimpleRight,MouthStretchLeft,MouthStretchRight,MouthRollLower,MouthRollUpper,MouthShrugLower,MouthShrugUpper,MouthPressLeft,MouthPressRight,MouthLowerDownLeft,MouthLowerDownRight,MouthUpperUpLeft,MouthUpperUpRight,BrowDownLeft,BrowDownRight,BrowInnerUp,BrowOuterUpLeft,BrowOuterUpRight,CheekPuff,CheekSquintLeft,CheekSquintRight,NoseSneerLeft,NoseSneerRight,TongueOut,HeadYaw,HeadPitch,HeadRoll,LeftEyeYaw,LeftEyePitch,LeftEyeRoll,RightEyeYaw,RightEyePitch,RightEyeRoll" - /// Returns only those specified by [targetNames]. + /// Returns two elements: + /// - a list containing the names of each blendshape/morph key + /// - a Float32List of length TxN, where T is the number of frames and N is the number of morph keys (i.e. the length of the list in the first element of the returned tuple). /// static Tuple2, Float32List> _loadLiveLinkFaceCSV(String path) { final data = File(path) diff --git a/lib/filament_gesture_detector.dart b/lib/filament_gesture_detector.dart index 9cb182b7..3aadcbee 100644 --- a/lib/filament_gesture_detector.dart +++ b/lib/filament_gesture_detector.dart @@ -99,39 +99,37 @@ class _FilamentGestureDetectorState extends State { }); } }, - onPointerPanZoomStart: !widget.enableControls - ? null - : (pzs) { - print("PAN ZOOM START"); - }, + onPointerPanZoomStart: !widget.enableControls ? null : (pzs) {}, onPointerDown: !widget.enableControls ? null : (d) async { - // if (d.buttons == kTertiaryButton || _rotating) { - // widget.controller - // .rotateStart(d.localPosition.dx, d.localPosition.dy); - // } else { - // widget.controller.panStart(d.focalPoint.dx, d.focalPoint.dy); - // } + if (d.buttons == kTertiaryButton || _rotating) { + widget.controller + .rotateStart(d.localPosition.dx, d.localPosition.dy); + } else { + widget.controller + .panStart(d.localPosition.dx, d.localPosition.dy); + } }, onPointerMove: !widget.enableControls ? null : (PointerMoveEvent d) async { - // if (d.buttons == kTertiaryButton || _rotating) { - // widget.controller - // .rotateUpdate(d.localPosition.dx, d.localPosition.dy); - // } else { - // widget.controller.panUpdate(d.focalPoint.dx, d.focalPoint.dy); - // } + if (d.buttons == kTertiaryButton || _rotating) { + widget.controller + .rotateUpdate(d.localPosition.dx, d.localPosition.dy); + } else { + widget.controller + .panUpdate(d.localPosition.dx, d.localPosition.dy); + } }, onPointerUp: !widget.enableControls ? null : (d) async { - // if (d.buttons == kTertiaryButton || _rotating) { - // widget.controller.rotateEnd(); - // } else { - // widget.controller.panEnd(d.focalPoint.dx, d.focalPoint.dy); - // } + if (d.buttons == kTertiaryButton || _rotating) { + widget.controller.rotateEnd(); + } else { + widget.controller.panEnd(); + } }, child: widget.child); } @@ -144,7 +142,6 @@ class _FilamentGestureDetectorState extends State { behavior: HitTestBehavior.opaque, onDoubleTap: () { _rotating = !_rotating; - print("Set rotating to $_rotating"); }, onScaleStart: !widget.enableControls ? null diff --git a/linux/include/polyvox_filament/resource_loader.hpp b/linux/include/polyvox_filament/resource_loader.hpp index df37a78d..c31a3c88 100644 --- a/linux/include/polyvox_filament/resource_loader.hpp +++ b/linux/include/polyvox_filament/resource_loader.hpp @@ -58,14 +58,10 @@ ResourceBuffer loadResource(const char* name) { is.read (buffer, length); is.close(); _file_assets[id] = buffer; - std::cout << "Loaded!" << std::endl; - return ResourceBuffer(buffer, length, id); } void freeResource(ResourceBuffer rbuf) { - std::cout << "Free " << rbuf.id << std::endl; - std::cout << "Freeing resource " << rbuf.id << std::endl; auto it = _file_assets.find(rbuf.id); if (it != _file_assets.end()) { free(it->second);