getAnimationNames method

  1. @override
Future<List<String>> getAnimationNames(
  1. ThermionEntity entity
)
override

Gets the names of all glTF animations embedded in the specified entity.

Implementation

@override
Future<List<String>> getAnimationNames(ThermionEntity entity) async {
  final animationCount = await getAnimationCount(entity);
  final names = <String>[];
  for (int i = 0; i < animationCount; i++) {
    final namePtr = _module._malloc(256) as JSNumber;
    _module.ccall(
        "get_animation_name",
        "void",
        ["void*".toJS, "int".toJS, "char*".toJS, "int".toJS].toJS,
        [_sceneManager!, entity.toJS, namePtr, i.toJS].toJS,
        null);
    names.add(_module.UTF8ToString(namePtr).toDart);
    _module._free(namePtr);
  }
  return names;
}