From 9aec83fd70be18df372e10ea6632ad410ce8b544 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Tue, 24 Jun 2025 10:22:40 +0800 Subject: [PATCH] throw Exception if createInstance is called on an instance and pass through isInstance/keepData flags --- .../lib/src/filament/src/implementation/ffi_asset.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/thermion_dart/lib/src/filament/src/implementation/ffi_asset.dart b/thermion_dart/lib/src/filament/src/implementation/ffi_asset.dart index 99c48e8e..5d1ed541 100644 --- a/thermion_dart/lib/src/filament/src/implementation/ffi_asset.dart +++ b/thermion_dart/lib/src/filament/src/implementation/ffi_asset.dart @@ -134,6 +134,10 @@ class FFIAsset extends ThermionAsset { @override Future createInstance( {covariant List? materialInstances = null}) async { + if(!isInstance) { + throw Exception( + "createInstance cannot be called on an instance. Make sure you are all calling the method on the original asset"); + } if (!keepData) { throw Exception( "keepData must have been specified as true when this asset was created"); @@ -167,7 +171,7 @@ class FFIAsset extends ThermionAsset { if (created == nullptr) { throw Exception("Failed to create instance"); } - return FFIAsset(created, app, animationManager); + return FFIAsset(created, app, animationManager, isInstance: true, keepData: keepData); } ///