Merge remote-tracking branch 'origin/dev-simulation/human' into main-demo

This commit is contained in:
2025-07-10 11:08:30 +05:30
10 changed files with 270 additions and 149 deletions

View File

@@ -16,7 +16,7 @@ import { getUserData } from '../../../../../functions/getUserData';
import { useSceneContext } from '../../../../scene/sceneContext';
import { useVersionContext } from '../../../version/versionContext';
import { SkeletonUtils } from 'three-stdlib';
import { useAnimationPlaySpeed } from '../../../../../store/usePlayButtonStore';
import { useAnimationPlaySpeed, usePauseButtonStore } from '../../../../../store/usePlayButtonStore';
import { upsertProductOrEventApi } from '../../../../../services/simulation/products/UpsertProductOrEventApi';
import { getAssetIksApi } from '../../../../../services/simulation/ik/getAssetIKs';
@@ -29,6 +29,7 @@ function Model({ asset }: { readonly asset: Asset }) {
const { subModule } = useSubModuleStore();
const { activeModule } = useModuleStore();
const { speed } = useAnimationPlaySpeed();
const { isPaused } = usePauseButtonStore();
const { assetStore, eventStore, productStore } = useSceneContext();
const { removeAsset, setAnimations, resetAnimation, setAnimationComplete } = assetStore();
const { setTop } = useTopData();
@@ -81,7 +82,8 @@ function Model({ asset }: { readonly asset: Asset }) {
if (!ikData && asset.eventData && asset.eventData.type === 'ArmBot') {
getAssetIksApi(asset.assetId).then((data) => {
if (data.iks) {
setIkData(data.iks);
const iks: IK[] = data.iks;
setIkData(iks);
}
})
}
@@ -385,7 +387,7 @@ function Model({ asset }: { readonly asset: Asset }) {
const currentAction = actions.current[current];
const previousAction = previousAnimation ? actions.current[previousAnimation] : null;
if (isPlaying && currentAction) {
if (isPlaying && currentAction && activeModule === 'simulation' && !isPaused) {
blendFactor.current = 0;
currentAction.reset();
@@ -408,7 +410,7 @@ function Model({ asset }: { readonly asset: Asset }) {
mixerRef.current.removeEventListener('finished', handleAnimationComplete);
}
};
}, [asset.animationState?.current, asset.animationState?.isPlaying]);
}, [asset.animationState?.current, asset.animationState?.isPlaying, isPaused, activeModule]);
useEffect(() => {
const canvasElement = gl.domElement;
@@ -463,7 +465,7 @@ function Model({ asset }: { readonly asset: Asset }) {
position={asset.position}
rotation={asset.rotation}
visible={asset.isVisible}
userData={asset}
userData={{ ...asset, iks: ikData }}
onDoubleClick={(e) => {
e.stopPropagation();
if (!toggleView) {