add loop option to playAnimation

This commit is contained in:
Nick Fisher
2022-03-29 15:50:23 +08:00
parent c258b0ebce
commit 6d271e2de3

View File

@@ -17,7 +17,7 @@ abstract class FilamentController {
Future<List<String>> getTargetNames(String meshName); Future<List<String>> getTargetNames(String meshName);
Future<List<String>> getAnimationNames(); Future<List<String>> getAnimationNames();
Future releaseSourceAssets(); Future releaseSourceAssets();
Future playAnimation(int index); Future playAnimation(int index, {bool loop=false});
Future setCamera(String name); Future setCamera(String name);
/// ///
@@ -44,6 +44,7 @@ class PolyvoxFilamentController extends FilamentController {
_id = id; _id = id;
_channel = MethodChannel("app.polyvox.filament/filament_view_$id"); _channel = MethodChannel("app.polyvox.filament/filament_view_$id");
_channel.setMethodCallHandler((call) async { _channel.setMethodCallHandler((call) async {
print("Received Filament method channel call : ${call.method}");
if(call.method == "ready") { if(call.method == "ready") {
onFilamentViewCreatedHandler?.call(_id); onFilamentViewCreatedHandler?.call(_id);
return Future.value(true); return Future.value(true);
@@ -126,8 +127,8 @@ class PolyvoxFilamentController extends FilamentController {
await _channel.invokeMethod("createMorpher", [meshName, primitives]); await _channel.invokeMethod("createMorpher", [meshName, primitives]);
} }
Future playAnimation(int index) async { Future playAnimation(int index, {bool loop=false}) async {
await _channel.invokeMethod("playAnimation", index); await _channel.invokeMethod("playAnimation", [index,loop]);
} }
Future setCamera(String name) async { Future setCamera(String name) async {