remove asset from internal list when destroyAsset is called
This commit is contained in:
@@ -272,7 +272,7 @@ class ThermionViewerFFI extends ThermionViewer {
|
|||||||
///
|
///
|
||||||
@override
|
@override
|
||||||
Future removeSkybox() async {
|
Future removeSkybox() async {
|
||||||
if(_disposed) {
|
if (_disposed) {
|
||||||
throw ViewerDisposedException();
|
throw ViewerDisposedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,16 +407,12 @@ class ThermionViewerFFI extends ThermionViewer {
|
|||||||
@override
|
@override
|
||||||
Future destroyAsset(covariant FFIAsset asset) async {
|
Future destroyAsset(covariant FFIAsset asset) async {
|
||||||
await scene.remove(asset);
|
await scene.remove(asset);
|
||||||
|
if (asset.boundingBoxAsset != null) {
|
||||||
|
await scene.remove(asset.boundingBoxAsset! as FFIAsset);
|
||||||
|
await FilamentApp.instance!.destroyAsset(asset.boundingBoxAsset!);
|
||||||
|
}
|
||||||
await FilamentApp.instance!.destroyAsset(asset);
|
await FilamentApp.instance!.destroyAsset(asset);
|
||||||
|
_assets.remove(asset);
|
||||||
// if (asset.boundingBoxAsset != null) {
|
|
||||||
// await asset.setBoundingBoxVisibility(false);
|
|
||||||
// await withVoidCallback((callback) =>
|
|
||||||
// SceneManager_destroyAssetRenderThread(
|
|
||||||
// _sceneManager!, asset.boundingBoxAsset!.pointer, callback));
|
|
||||||
// }
|
|
||||||
// await withVoidCallback((callback) => SceneManager_destroyAssetRenderThread(
|
|
||||||
// _sceneManager!, asset.asset, callback));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -424,9 +420,16 @@ class ThermionViewerFFI extends ThermionViewer {
|
|||||||
///
|
///
|
||||||
@override
|
@override
|
||||||
Future destroyAssets() async {
|
Future destroyAssets() async {
|
||||||
|
_logger.info("Destroying ${_assets.length} assets");
|
||||||
for (final asset in _assets) {
|
for (final asset in _assets) {
|
||||||
await destroyAsset(asset);
|
await scene.remove(asset);
|
||||||
|
if (asset.boundingBoxAsset != null) {
|
||||||
|
await scene.remove(asset.boundingBoxAsset! as FFIAsset);
|
||||||
|
await FilamentApp.instance!.destroyAsset(asset.boundingBoxAsset!);
|
||||||
|
}
|
||||||
|
await FilamentApp.instance!.destroyAsset(asset);
|
||||||
}
|
}
|
||||||
|
_assets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -564,9 +567,9 @@ class ThermionViewerFFI extends ThermionViewer {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
Future setLayerVisibility(VisibilityLayers layer, bool visible) async {
|
Future setLayerVisibility(VisibilityLayers layer, bool visible) async {
|
||||||
await view.setLayerVisibility(layer, visible);
|
await view.setLayerVisibility(layer, visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user