Add scene context and animation handling to AssetProperties and Model components
- Enhanced animation handling in Model component with animation state management. - Updated useAssetStore to support multiple animations for assets.
This commit is contained in:
@@ -21,7 +21,7 @@ interface AssetsStore {
|
||||
setOpacity: (modelUuid: string, opacity: number) => void;
|
||||
|
||||
// Animation controls
|
||||
setAnimation: (modelUuid: string, animation: string) => void;
|
||||
setAnimations: (modelUuid: string, animations: string[]) => void;
|
||||
setCurrentAnimation: (modelUuid: string, current: string, isPlaying: boolean) => void;
|
||||
addAnimation: (modelUuid: string, animation: string) => void;
|
||||
removeAnimation: (modelUuid: string, animation: string) => void;
|
||||
@@ -143,14 +143,13 @@ export const createAssetStore = () => {
|
||||
},
|
||||
|
||||
// Animation controls
|
||||
setAnimation: (modelUuid, animation) => {
|
||||
setAnimations: (modelUuid, animations) => {
|
||||
set((state) => {
|
||||
const asset = state.assets.find(a => a.modelUuid === modelUuid);
|
||||
if (asset) {
|
||||
asset.animations = animations;
|
||||
if (!asset.animationState) {
|
||||
asset.animationState = { current: animation, playing: false };
|
||||
} else {
|
||||
asset.animationState.current = animation;
|
||||
asset.animationState = { current: '', playing: false };
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user