expose addAnimationComponent and dont add by default on loadGlb
This commit is contained in:
@@ -610,12 +610,18 @@ abstract class FilamentController {
|
||||
///
|
||||
Future setRecordingOutputDirectory(String outputDirectory);
|
||||
|
||||
// Stream get keyboardFocusRequested;
|
||||
// void requestKeyboardFocus();
|
||||
|
||||
///
|
||||
/// Attach the keyboard/mouse to [entity].
|
||||
///
|
||||
Future<EntityTransformController> control(FilamentEntity entity,
|
||||
{double? translationSpeed, String? forwardAnimation});
|
||||
|
||||
///
|
||||
/// An [entity] will only be animatable after an animation component is attached.
|
||||
/// Any calls to [playAnimation]/[setBoneAnimation]/[setMorphAnimation] will have no visual effect until [addAnimationComponent] has been called on the instance.
|
||||
///
|
||||
Future addAnimationComponent(FilamentEntity entity);
|
||||
|
||||
///
|
||||
/// Makes [collidableEntity] collidable with
|
||||
/// (a) any entity whose transform is being controlled (via [control]) or
|
||||
|
||||
@@ -1269,7 +1269,8 @@ class FilamentControllerFFI extends FilamentController {
|
||||
final outPtr = allocator<EntityId>(1);
|
||||
outPtr.value = 0;
|
||||
|
||||
pick_ffi(_viewer!, x, textureDetails.value!.height - y, outPtr);
|
||||
pick_ffi(_viewer!, (x * _pixelRatio).toInt(),
|
||||
textureDetails.value!.height - (y * _pixelRatio).toInt(), outPtr);
|
||||
int wait = 0;
|
||||
while (outPtr.value == 0) {
|
||||
await Future.delayed(const Duration(milliseconds: 32));
|
||||
@@ -1497,6 +1498,11 @@ class FilamentControllerFFI extends FilamentController {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future addAnimationComponent(FilamentEntity entity) async {
|
||||
add_animation_component(_sceneManager!, entity);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<FilamentEntity> createGeometry(
|
||||
List<double> vertices, List<int> indices, String? materialPath) async {
|
||||
|
||||
@@ -225,10 +225,10 @@ external int get_instance_count(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Int Function(
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, EntityId, ffi.Pointer<EntityId>)>(
|
||||
symbol: 'get_instances', assetId: 'flutter_filament_plugin')
|
||||
external int get_instances(
|
||||
external void get_instances(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
int entityId,
|
||||
ffi.Pointer<EntityId> out,
|
||||
@@ -931,6 +931,13 @@ external void add_collision_component(
|
||||
bool affectsCollidingTransform,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(
|
||||
symbol: 'add_animation_component', assetId: 'flutter_filament_plugin')
|
||||
external void add_animation_component(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
int entityId,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
EntityId Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Float>,
|
||||
ffi.Int, ffi.Pointer<ffi.Uint16>, ffi.Int, ffi.Pointer<ffi.Char>)>(
|
||||
|
||||
Reference in New Issue
Block a user