Refactor asset management components to enhance structure and improve data handling; update styles for better UI consistency

This commit is contained in:
2025-05-13 15:18:15 +05:30
parent 4c13d31931
commit 4939c19c12
8 changed files with 102 additions and 83 deletions

View File

@@ -3,7 +3,6 @@ import { useFrame } from "@react-three/fiber";
import { Stage, useGLTF } from "@react-three/drei";
import { AnimationMixer, AnimationAction, Object3D } from "three";
import * as THREE from "three";
import { fetchGltfUrl } from "../../services/marketplace/fetchGltfUrl";
interface GltfLoaderProps {
glbdata?: boolean;
@@ -13,7 +12,6 @@ interface GltfLoaderProps {
setSelectedAnimation?: (animation: string) => void;
}
// const getGLTFUrl = (url: string) => url; // Placeholder for your actual function
const GltfLoader: React.FC<GltfLoaderProps> = ({
glbdata,
@@ -21,12 +19,10 @@ const GltfLoader: React.FC<GltfLoaderProps> = ({
setAnimations,
selectedAnimation,
}) => {
const modelUrl: any = fromServer ? fetchGltfUrl(fromServer) : glbdata;
const { scene, animations } = useGLTF(modelUrl ?? "") as {
const { scene, animations } = useGLTF(fromServer ?? "") as {
scene: Object3D;
animations: THREE.AnimationClip[];
};
const mixer = useRef<AnimationMixer | null>(
scene ? new AnimationMixer(scene) : null
);