feat: Remove unused GLB models and enhance asset reset functionality
This commit is contained in:
@@ -9,6 +9,7 @@ interface AssetsStore {
|
||||
removeAsset: (modelUuid: string) => void;
|
||||
updateAsset: (modelUuid: string, updates: Partial<Asset>) => void;
|
||||
clearAssets: () => void;
|
||||
resetAsset: (modelUuid: string) => void;
|
||||
setAssets: (assets: Assets) => void;
|
||||
|
||||
// Asset properties
|
||||
@@ -74,6 +75,19 @@ export const createAssetStore = () => {
|
||||
});
|
||||
},
|
||||
|
||||
resetAsset: (modelUuid) => {
|
||||
const asset = get().assets.find(a => a.modelUuid === modelUuid);
|
||||
if (asset) {
|
||||
const clonedAsset = JSON.parse(JSON.stringify(asset));
|
||||
setTimeout(() => {
|
||||
get().removeAsset(asset.modelUuid);
|
||||
setTimeout(() => {
|
||||
get().addAsset(clonedAsset);
|
||||
}, 0);
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
|
||||
setAssets: (assets) => {
|
||||
set((state) => {
|
||||
state.assets = assets;
|
||||
@@ -185,7 +199,8 @@ export const createAssetStore = () => {
|
||||
asset.animationState.current = '';
|
||||
asset.animationState.isPlaying = true;
|
||||
asset.animationState.loopAnimation = true;
|
||||
asset.animationState.isCompleted = true; }
|
||||
asset.animationState.isCompleted = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user