remove morph animation FFI-specific methods (regular methods are OK to use outside the engine thread)

This commit is contained in:
Nick Fisher
2023-11-19 18:12:38 +08:00
parent ad9e4689b1
commit f0683b0b24
5 changed files with 8 additions and 58 deletions

View File

@@ -247,6 +247,8 @@ abstract class FilamentController {
///
/// Set the weights for all morph targets under node [meshName] in [entity] to [weights].
/// Note that [weights] must contain values for ALL morph targets, but no exception will be thrown if you don't do so (you'll just get incorrect results).
/// If you only want to set one value, set all others to zero (check [getMorphTargetNames] if you need the get a list of all morph targets.)
///
Future setMorphTargetWeights(
FilamentEntity entity, String meshName, List<double> weights);

View File

@@ -595,9 +595,11 @@ class FilamentControllerFFI extends FilamentController {
for (int i = 0; i < weights.length; i++) {
weightsPtr.elementAt(i).value = weights[i];
}
set_morph_target_weights_ffi(_assetManager!, entity,
meshName.toNativeUtf8().cast<Char>(), weightsPtr, weights.length);
var meshNamePtr = meshName.toNativeUtf8(allocator: calloc).cast<Char>();
set_morph_target_weights(
_assetManager!, entity, meshNamePtr, weightsPtr, weights.length);
calloc.free(weightsPtr);
calloc.free(meshNamePtr);
}
@override

View File

@@ -1019,40 +1019,6 @@ external void apply_weights_ffi(
int count,
);
@ffi.Native<
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId,
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Float>, ffi.Int)>(
symbol: 'set_morph_target_weights_ffi', assetId: 'flutter_filament_plugin')
external void set_morph_target_weights_ffi(
ffi.Pointer<ffi.Void> assetManager,
int asset,
ffi.Pointer<ffi.Char> entityName,
ffi.Pointer<ffi.Float> morphData,
int numWeights,
);
@ffi.Native<
ffi.Bool Function(
ffi.Pointer<ffi.Void>,
EntityId,
ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Float>,
ffi.Pointer<ffi.Int>,
ffi.Int,
ffi.Int,
ffi.Float)>(
symbol: 'set_morph_animation_ffi', assetId: 'flutter_filament_plugin')
external bool set_morph_animation_ffi(
ffi.Pointer<ffi.Void> assetManager,
int asset,
ffi.Pointer<ffi.Char> entityName,
ffi.Pointer<ffi.Float> morphData,
ffi.Pointer<ffi.Int> morphIndices,
int numMorphTargets,
int numFrames,
double frameLengthInMs,
);
@ffi.Native<
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, ffi.Int, ffi.Bool,
ffi.Bool, ffi.Bool, ffi.Float)>(