feat: Enhance InputWithDropDown to support disabled state

fix: Update Model component to manage animation states and transitions more effectively

feat: Implement worker action handling in useWorkerHandler for material management

feat: Add MaterialAnimator to HumanInstance for dynamic material loading

feat: Extend useTriggerHandler to support interactions between humans and various entities

feat: Create WorkerAction component for managing load capacity and actions

feat: Introduce MaterialAnimator for human instances to visualize material loads

refactor: Update asset store to manage animation completion state

fix: Ensure proper handling of human materials in useHumanStore
This commit is contained in:
2025-07-04 13:14:39 +05:30
parent 7cf82629e9
commit 02490214d9
17 changed files with 990 additions and 261 deletions

View File

@@ -22,7 +22,8 @@ interface AssetsStore {
// Animation controls
setAnimations: (modelUuid: string, animations: string[]) => void;
setCurrentAnimation: (modelUuid: string, current: string, isisPlaying: boolean, loopAnimation: boolean) => void;
setCurrentAnimation: (modelUuid: string, current: string, isPlaying: boolean, loopAnimation: boolean, isCompleted: boolean) => void;
setAnimationComplete: (modelUuid: string, isCompleted: boolean) => void;
resetAnimation: (modelUuid: string) => void;
addAnimation: (modelUuid: string, animation: string) => void;
removeAnimation: (modelUuid: string, animation: string) => void;
@@ -150,19 +151,29 @@ export const createAssetStore = () => {
if (asset) {
asset.animations = animations;
if (!asset.animationState) {
asset.animationState = { current: '', isPlaying: false, loopAnimation: true };
asset.animationState = { current: '', isPlaying: false, loopAnimation: true, isCompleted: true };
}
}
});
},
setCurrentAnimation: (modelUuid, current, isisPlaying, loopAnimation) => {
setCurrentAnimation: (modelUuid, current, isPlaying, loopAnimation, isCompleted) => {
set((state) => {
const asset = state.assets.find(a => a.modelUuid === modelUuid);
if (asset?.animationState) {
asset.animationState.current = current;
asset.animationState.isPlaying = isisPlaying;
asset.animationState.isPlaying = isPlaying;
asset.animationState.loopAnimation = loopAnimation;
asset.animationState.isCompleted = isCompleted;
}
});
},
setAnimationComplete: (modelUuid, isCompleted) => {
set((state) => {
const asset = state.assets.find(a => a.modelUuid === modelUuid);
if (asset?.animationState) {
asset.animationState.isCompleted = isCompleted;
}
});
},
@@ -171,7 +182,7 @@ export const createAssetStore = () => {
set((state) => {
const asset = state.assets.find(a => a.modelUuid === modelUuid);
if (asset?.animationState) {
asset.animationState = { current: '', isPlaying: false, loopAnimation: true };
asset.animationState = { current: '', isPlaying: false, loopAnimation: true, isCompleted: true };
}
});
},

View File

@@ -160,7 +160,7 @@ export const createHumanStore = () => {
set((state) => {
const human = state.humans.find(h => h.modelUuid === modelUuid);
if (human && human.currentMaterials.length > 0) {
removed = human.currentMaterials.pop();
removed = JSON.parse(JSON.stringify(human.currentMaterials.pop()));
}
});
return removed;