feat: add clearMorphAnimationData function
This commit is contained in:
@@ -368,6 +368,12 @@ external bool set_morph_animation(
|
||||
double frameLengthInMs,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>()
|
||||
external void clear_morph_animation(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
int entity,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>()
|
||||
external void reset_to_rest_pose(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
|
||||
@@ -226,6 +226,11 @@ class ThermionViewerJSDartBridge {
|
||||
.then((v) => v.toJS)
|
||||
.toJS;
|
||||
|
||||
@JSExport()
|
||||
void clearMorphAnimationData(ThermionEntity entity) {
|
||||
viewer.clearMorphAnimationData(entity);
|
||||
}
|
||||
|
||||
@JSExport()
|
||||
JSPromise setMorphAnimationData(
|
||||
ThermionEntity entity,
|
||||
|
||||
@@ -263,6 +263,11 @@ class ThermionViewerJS implements ThermionViewer {
|
||||
.toDartDouble;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> clearMorphAnimationData(ThermionEntity entity) async {
|
||||
_shim.clearMorphAnimationData(entity);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setMorphAnimationData(
|
||||
ThermionEntity entity, MorphAnimationData animation,
|
||||
|
||||
@@ -6,11 +6,10 @@ import 'dart:js_interop';
|
||||
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
|
||||
|
||||
///
|
||||
/// An extension type on [JSObject] that represents a
|
||||
/// An extension type on [JSObject] that represents a
|
||||
/// Javascript shim implementation of the [ThermionViewer] interface.
|
||||
///
|
||||
///
|
||||
extension type ThermionViewerJSShim(JSObject _) implements JSObject {
|
||||
|
||||
@JS('initialized')
|
||||
external JSPromise<JSBoolean> get initialized;
|
||||
|
||||
@@ -136,6 +135,9 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject {
|
||||
external JSPromise<JSNumber> getAnimationDuration(
|
||||
ThermionEntity entity, int animationIndex);
|
||||
|
||||
@JS('clearMorphAnimationData')
|
||||
external void clearMorphAnimationData(ThermionEntity entity);
|
||||
|
||||
@JS('setMorphAnimationData')
|
||||
external JSPromise setMorphAnimationData(
|
||||
ThermionEntity entity,
|
||||
@@ -403,19 +405,16 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject {
|
||||
ThermionEntity entity, JSArray<JSNumber> transform);
|
||||
|
||||
@JS('setBoneTransform')
|
||||
external JSPromise setBoneTransform(
|
||||
ThermionEntity entity, int boneIndex, JSArray<JSNumber> transform, int skinIndex);
|
||||
|
||||
external JSPromise setBoneTransform(ThermionEntity entity, int boneIndex,
|
||||
JSArray<JSNumber> transform, int skinIndex);
|
||||
|
||||
@JS('setShadowsEnabled')
|
||||
external JSPromise setShadowsEnabled(
|
||||
bool enabled);
|
||||
external JSPromise setShadowsEnabled(bool enabled);
|
||||
|
||||
@JS('setShadowType')
|
||||
external JSPromise setShadowType(
|
||||
int shadowType);
|
||||
external JSPromise setShadowType(int shadowType);
|
||||
|
||||
@JS('setSoftShadowOptions')
|
||||
external JSPromise setSoftShadowOptions(
|
||||
double penumbraScale, double penumbraRatioScale);
|
||||
}
|
||||
|
||||
|
||||
@@ -788,6 +788,27 @@ class ThermionViewerWasm implements ThermionViewer {
|
||||
null);
|
||||
}
|
||||
|
||||
@override
|
||||
Future clearMorphAnimationData(
|
||||
ThermionEntity entity) async {
|
||||
var meshEntities = await getChildEntities(entity, false);
|
||||
for(final childEntity in meshEntities) {
|
||||
_module.ccall(
|
||||
"clear_morph_animation",
|
||||
"void",
|
||||
[
|
||||
"void*".toJS,
|
||||
"int".toJS,
|
||||
].toJS,
|
||||
[
|
||||
_sceneManager!,
|
||||
childEntity.toJS,
|
||||
].toJS,
|
||||
null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Future setMorphAnimationData(
|
||||
ThermionEntity entity, MorphAnimationData animation,
|
||||
|
||||
Reference in New Issue
Block a user