Merge remote-tracking branch 'origin/simulation' into simulation-agv
This commit is contained in:
commit
e1ea4525d9
3
app/.env
3
app/.env
|
@ -7,9 +7,6 @@ REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:8000
|
||||||
# Base URL for the server REST API, used for HTTP requests to the backend server.
|
# Base URL for the server REST API, used for HTTP requests to the backend server.
|
||||||
REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000
|
REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000
|
||||||
|
|
||||||
REACT_APP_SERVER_REST_API_LOCAL_BASE_URL=192.168.0.102:5000
|
|
||||||
|
|
||||||
# Base URL for the server marketplace API.
|
|
||||||
# REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011
|
# REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011
|
||||||
REACT_APP_SERVER_MARKETPLACE_URL=192.168.0.111:3501
|
REACT_APP_SERVER_MARKETPLACE_URL=192.168.0.111:3501
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ const RealTimeVisulization: React.FC = () => {
|
||||||
const organization = email?.split("@")[1]?.split(".")[0];
|
const organization = email?.split("@")[1]?.split(".")[0];
|
||||||
try {
|
try {
|
||||||
const response = await getZone2dData(organization);
|
const response = await getZone2dData(organization);
|
||||||
console.log('response: ', response);
|
// console.log('response: ', response);
|
||||||
|
|
||||||
if (!Array.isArray(response)) {
|
if (!Array.isArray(response)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -60,7 +60,7 @@ async function addAssetModel(
|
||||||
if (intersectPoint.y < 0) {
|
if (intersectPoint.y < 0) {
|
||||||
intersectPoint = new THREE.Vector3(intersectPoint.x, 0, intersectPoint.z);
|
intersectPoint = new THREE.Vector3(intersectPoint.x, 0, intersectPoint.z);
|
||||||
}
|
}
|
||||||
console.log('selectedItem: ', selectedItem);
|
// console.log('selectedItem: ', selectedItem);
|
||||||
const cachedModel = THREE.Cache.get(selectedItem.id);
|
const cachedModel = THREE.Cache.get(selectedItem.id);
|
||||||
if (cachedModel) {
|
if (cachedModel) {
|
||||||
// console.log(`[Cache] Fetching ${selectedItem.name}`);
|
// console.log(`[Cache] Fetching ${selectedItem.name}`);
|
||||||
|
@ -145,7 +145,7 @@ async function handleModelLoad(
|
||||||
};
|
};
|
||||||
|
|
||||||
const email = localStorage.getItem("email");
|
const email = localStorage.getItem("email");
|
||||||
const organization = email ? email.split("@")[1].split(".")[0] : "default";
|
const organization = email ? email.split("@")[1].split(".")[0] : "";
|
||||||
|
|
||||||
getAssetEventType(selectedItem.id, organization).then(async (res) => {
|
getAssetEventType(selectedItem.id, organization).then(async (res) => {
|
||||||
console.log('res: ', res);
|
console.log('res: ', res);
|
||||||
|
@ -177,7 +177,7 @@ async function handleModelLoad(
|
||||||
speed: 'Inherit'
|
speed: 'Inherit'
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('eventData: ', eventData);
|
// console.log('eventData: ', eventData);
|
||||||
newFloorItem.eventData = eventData;
|
newFloorItem.eventData = eventData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,6 +215,8 @@ async function handleModelLoad(
|
||||||
eventData: newFloorItem.eventData,
|
eventData: newFloorItem.eventData,
|
||||||
socketId: socket.id
|
socketId: socket.id
|
||||||
};
|
};
|
||||||
|
console.log('data: ', data);
|
||||||
|
|
||||||
|
|
||||||
socket.emit("v2:model-asset:add", data);
|
socket.emit("v2:model-asset:add", data);
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ import { toast } from 'react-toastify';
|
||||||
import * as THREE from 'three';
|
import * as THREE from 'three';
|
||||||
|
|
||||||
import * as Types from "../../../../types/world/worldTypes";
|
import * as Types from "../../../../types/world/worldTypes";
|
||||||
import { getFloorItems } from '../../../../services/factoryBuilder/assest/floorAsset/getFloorItemsApi';
|
|
||||||
// import { deleteFloorItem } from '../../../../services/factoryBuilder/assest/floorAsset/deleteFloorItemApi';
|
// import { deleteFloorItem } from '../../../../services/factoryBuilder/assest/floorAsset/deleteFloorItemApi';
|
||||||
import { Socket } from 'socket.io-client';
|
import { Socket } from 'socket.io-client';
|
||||||
|
import { getFloorAssets } from '../../../../services/factoryBuilder/assest/floorAsset/getFloorItemsApi';
|
||||||
|
|
||||||
async function DeleteFloorItems(
|
async function DeleteFloorItems(
|
||||||
itemsGroup: Types.RefGroup,
|
itemsGroup: Types.RefGroup,
|
||||||
|
@ -20,7 +20,7 @@ async function DeleteFloorItems(
|
||||||
const email = localStorage.getItem('email')
|
const email = localStorage.getItem('email')
|
||||||
const organization = (email!.split("@")[1]).split(".")[0];
|
const organization = (email!.split("@")[1]).split(".")[0];
|
||||||
|
|
||||||
const items = await getFloorItems(organization);
|
const items = await getFloorAssets(organization);
|
||||||
const removedItem = items.find(
|
const removedItem = items.find(
|
||||||
(item: { modeluuid: string }) => item.modeluuid === hoveredDeletableFloorItem.current?.uuid
|
(item: { modeluuid: string }) => item.modeluuid === hoveredDeletableFloorItem.current?.uuid
|
||||||
);
|
);
|
||||||
|
@ -42,7 +42,7 @@ async function DeleteFloorItems(
|
||||||
socketId: socket.id
|
socketId: socket.id
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = socket.emit('v1:FloorItems:delete', data)
|
const response = socket.emit('v2:model-asset:delete', data)
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
const updatedItems = items.filter(
|
const updatedItems = items.filter(
|
||||||
|
|
|
@ -11,7 +11,7 @@ import DeletableHoveredFloorItems from "../geomentries/assets/deletableHoveredFl
|
||||||
import DeleteFloorItems from "../geomentries/assets/deleteFloorItems";
|
import DeleteFloorItems from "../geomentries/assets/deleteFloorItems";
|
||||||
import loadInitialFloorItems from "../../scene/IntialLoad/loadInitialFloorItems";
|
import loadInitialFloorItems from "../../scene/IntialLoad/loadInitialFloorItems";
|
||||||
import addAssetModel from "../geomentries/assets/addAssetModel";
|
import addAssetModel from "../geomentries/assets/addAssetModel";
|
||||||
import { getFloorItems } from "../../../services/factoryBuilder/assest/floorAsset/getFloorItemsApi";
|
import { getFloorAssets } from "../../../services/factoryBuilder/assest/floorAsset/getFloorItemsApi";
|
||||||
import useModuleStore from "../../../store/useModuleStore";
|
import useModuleStore from "../../../store/useModuleStore";
|
||||||
// import { retrieveGLTF } from "../../../utils/indexDB/idbUtils";
|
// import { retrieveGLTF } from "../../../utils/indexDB/idbUtils";
|
||||||
const assetManagerWorker = new Worker(new URL('../../../services/factoryBuilder/webWorkers/assetManagerWorker.js', import.meta.url));
|
const assetManagerWorker = new Worker(new URL('../../../services/factoryBuilder/webWorkers/assetManagerWorker.js', import.meta.url));
|
||||||
|
@ -59,8 +59,7 @@ const FloorItemsGroup = ({ itemsGroup, hoveredDeletableFloorItem, AttachedObject
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getFloorItems(organization).then((data) => {
|
getFloorAssets(organization).then((data) => {
|
||||||
console.log('data: ', data);
|
|
||||||
const uniqueItems = (data as Types.FloorItems).filter((item, index, self) =>
|
const uniqueItems = (data as Types.FloorItems).filter((item, index, self) =>
|
||||||
index === self.findIndex((t) => t.modelfileID === item.modelfileID)
|
index === self.findIndex((t) => t.modelfileID === item.modelfileID)
|
||||||
);
|
);
|
||||||
|
|
|
@ -32,7 +32,7 @@ const CamModelsGroup = () => {
|
||||||
if (!socket) return;
|
if (!socket) return;
|
||||||
const organization = email!.split("@")[1].split(".")[0];
|
const organization = email!.split("@")[1].split(".")[0];
|
||||||
|
|
||||||
socket.on("userConnectRespones", (data: any) => {
|
socket.on("userConnectResponse", (data: any) => {
|
||||||
if (!groupRef.current) return;
|
if (!groupRef.current) return;
|
||||||
if (data.data.userData.email === email) return;
|
if (data.data.userData.email === email) return;
|
||||||
if (socket.id === data.socketId || organization !== data.organization)
|
if (socket.id === data.socketId || organization !== data.organization)
|
||||||
|
@ -64,7 +64,11 @@ const CamModelsGroup = () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("userDisConnectRespones", (data: any) => {
|
// socket.on("users:online", (data: any) => {
|
||||||
|
// console.log('users online: ', data);
|
||||||
|
// })
|
||||||
|
|
||||||
|
socket.on("userDisConnectResponse", (data: any) => {
|
||||||
if (!groupRef.current) return;
|
if (!groupRef.current) return;
|
||||||
if (socket.id === data.socketId || organization !== data.organization)
|
if (socket.id === data.socketId || organization !== data.organization)
|
||||||
return;
|
return;
|
||||||
|
@ -109,6 +113,15 @@ const CamModelsGroup = () => {
|
||||||
};
|
};
|
||||||
}, [socket, activeUsers]);
|
}, [socket, activeUsers]);
|
||||||
|
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// console.log(activeUsers);
|
||||||
|
// }, [activeUsers])
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// console.log(models);
|
||||||
|
// }, [models])
|
||||||
|
|
||||||
useFrame(() => {
|
useFrame(() => {
|
||||||
if (!groupRef.current) return;
|
if (!groupRef.current) return;
|
||||||
Object.keys(models).forEach((uuid) => {
|
Object.keys(models).forEach((uuid) => {
|
||||||
|
@ -142,7 +155,7 @@ const CamModelsGroup = () => {
|
||||||
const filteredData = data.cameraDatas.filter(
|
const filteredData = data.cameraDatas.filter(
|
||||||
(camera: any) => camera.userData.email !== email
|
(camera: any) => camera.userData.email !== email
|
||||||
);
|
);
|
||||||
let a:any = [];
|
let a: any = [];
|
||||||
if (filteredData.length > 0) {
|
if (filteredData.length > 0) {
|
||||||
loader.load(camModel, (gltf) => {
|
loader.load(camModel, (gltf) => {
|
||||||
const newCams = filteredData.map((cam: any) => {
|
const newCams = filteredData.map((cam: any) => {
|
||||||
|
|
|
@ -82,14 +82,14 @@ export default function SocketResponses({
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('model-asset:response:updates', async (data: any) => {
|
socket.on('model-asset:response:updates', async (data: any) => {
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
if (socket.id === data.socketId) {
|
if (socket.id === data.socketId) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (organization !== data.organization) {
|
if (organization !== data.organization) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (data.message === "flooritem created") {
|
if (data.message === "Model created successfully") {
|
||||||
const loader = new GLTFLoader();
|
const loader = new GLTFLoader();
|
||||||
const dracoLoader = new DRACOLoader();
|
const dracoLoader = new DRACOLoader();
|
||||||
|
|
||||||
|
@ -101,10 +101,61 @@ export default function SocketResponses({
|
||||||
isTempLoader.current = true;
|
isTempLoader.current = true;
|
||||||
const cachedModel = THREE.Cache.get(data.data.modelname);
|
const cachedModel = THREE.Cache.get(data.data.modelname);
|
||||||
let url;
|
let url;
|
||||||
|
|
||||||
if (cachedModel) {
|
if (cachedModel) {
|
||||||
// console.log(`Getting ${data.data.modelname} from cache`);
|
// console.log(`Getting ${data.data.modelname} from cache`);
|
||||||
url = URL.createObjectURL(cachedModel);
|
const model = cachedModel.scene.clone();
|
||||||
|
model.uuid = data.data.modeluuid;
|
||||||
|
model.userData = { name: data.data.modelname, modelId: data.data.modelFileID };
|
||||||
|
model.position.set(...data.data.position as [number, number, number]);
|
||||||
|
model.rotation.set(data.data.rotation.x, data.data.rotation.y, data.data.rotation.z);
|
||||||
|
model.scale.set(...CONSTANTS.assetConfig.defaultScaleBeforeGsap);
|
||||||
|
|
||||||
|
model.traverse((child: any) => {
|
||||||
|
if (child.isMesh) {
|
||||||
|
// Clone the material to ensure changes are independent
|
||||||
|
// child.material = child.material.clone();
|
||||||
|
|
||||||
|
child.castShadow = true;
|
||||||
|
child.receiveShadow = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
itemsGroup.current.add(model);
|
||||||
|
|
||||||
|
if (tempLoader.current) {
|
||||||
|
tempLoader.current.material.dispose();
|
||||||
|
tempLoader.current.geometry.dispose();
|
||||||
|
itemsGroup.current.remove(tempLoader.current);
|
||||||
|
tempLoader.current = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newFloorItem: Types.FloorItemType = {
|
||||||
|
modeluuid: data.data.modeluuid,
|
||||||
|
modelname: data.data.modelname,
|
||||||
|
modelfileID: data.data.modelfileID,
|
||||||
|
position: [...data.data.position as [number, number, number]],
|
||||||
|
rotation: {
|
||||||
|
x: model.rotation.x,
|
||||||
|
y: model.rotation.y,
|
||||||
|
z: model.rotation.z,
|
||||||
|
},
|
||||||
|
isLocked: data.data.isLocked,
|
||||||
|
isVisible: data.data.isVisible,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (data.data.eventData) {
|
||||||
|
newFloorItem.eventData = data.data.eventData;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFloorItems((prevItems: any) => {
|
||||||
|
const updatedItems = [...(prevItems || []), newFloorItem];
|
||||||
|
localStorage.setItem("FloorItems", JSON.stringify(updatedItems));
|
||||||
|
return updatedItems;
|
||||||
|
});
|
||||||
|
|
||||||
|
gsap.to(model.position, { y: data.data.position[1], duration: 1.5, ease: 'power2.out' });
|
||||||
|
gsap.to(model.scale, { x: 1, y: 1, z: 1, duration: 1.5, ease: 'power2.out', onComplete: () => { toast.success("Model Added!") } });
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const indexedDBModel = await retrieveGLTF(data.data.modelname);
|
const indexedDBModel = await retrieveGLTF(data.data.modelname);
|
||||||
if (indexedDBModel) {
|
if (indexedDBModel) {
|
||||||
|
@ -118,7 +169,9 @@ export default function SocketResponses({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadModel(url);
|
if (url) {
|
||||||
|
loadModel(url);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching asset model:', error);
|
console.error('Error fetching asset model:', error);
|
||||||
|
@ -168,6 +221,10 @@ export default function SocketResponses({
|
||||||
isVisible: data.data.isVisible,
|
isVisible: data.data.isVisible,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (data.data.eventData) {
|
||||||
|
newFloorItem.eventData = data.data.eventData;
|
||||||
|
}
|
||||||
|
|
||||||
setFloorItems((prevItems: any) => {
|
setFloorItems((prevItems: any) => {
|
||||||
const updatedItems = [...(prevItems || []), newFloorItem];
|
const updatedItems = [...(prevItems || []), newFloorItem];
|
||||||
localStorage.setItem("FloorItems", JSON.stringify(updatedItems));
|
localStorage.setItem("FloorItems", JSON.stringify(updatedItems));
|
||||||
|
@ -183,7 +240,7 @@ export default function SocketResponses({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (data.message === "flooritems updated") {
|
} else if (data.message === "Model updated successfully") {
|
||||||
itemsGroup.current.children.forEach((item: THREE.Group) => {
|
itemsGroup.current.children.forEach((item: THREE.Group) => {
|
||||||
if (item.uuid === data.data.modeluuid) {
|
if (item.uuid === data.data.modeluuid) {
|
||||||
item.position.set(...data.data.position as [number, number, number]);
|
item.position.set(...data.data.position as [number, number, number]);
|
||||||
|
@ -212,14 +269,14 @@ export default function SocketResponses({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('FloorItemsDeleteResponse', (data: any) => {
|
socket.on('model-asset:response:updates', (data: any) => {
|
||||||
if (socket.id === data.socketId) {
|
if (socket.id === data.socketId) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (organization !== data.organization) {
|
if (organization !== data.organization) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (data.message === "flooritem deleted") {
|
if (data.message === "Model deleted successfully") {
|
||||||
const deletedUUID = data.data.modeluuid;
|
const deletedUUID = data.data.modeluuid;
|
||||||
let items = JSON.parse(localStorage.getItem("FloorItems")!);
|
let items = JSON.parse(localStorage.getItem("FloorItems")!);
|
||||||
|
|
||||||
|
@ -746,7 +803,6 @@ export default function SocketResponses({
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (data.message === "zone deleted") {
|
if (data.message === "zone deleted") {
|
||||||
console.log('data: ', data);
|
|
||||||
const updatedZones = zones.filter((zone: any) => zone.zoneId !== data.data.zoneId);
|
const updatedZones = zones.filter((zone: any) => zone.zoneId !== data.data.zoneId);
|
||||||
setZones(updatedZones);
|
setZones(updatedZones);
|
||||||
|
|
||||||
|
@ -769,7 +825,7 @@ export default function SocketResponses({
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
socket.off('zone:response:updates');
|
socket.off('zone:response:updates');
|
||||||
socket.off('zone:response:updates');
|
socket.off('zone:response:delete');
|
||||||
};
|
};
|
||||||
}, [socket, zones, zonePoints])
|
}, [socket, zones, zonePoints])
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ import * as THREE from 'three';
|
||||||
import * as CONSTANTS from '../../../types/world/worldConstants';
|
import * as CONSTANTS from '../../../types/world/worldConstants';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import * as Types from "../../../types/world/worldTypes";
|
import * as Types from "../../../types/world/worldTypes";
|
||||||
import { getFloorItems } from '../../../services/factoryBuilder/assest/floorAsset/getFloorItemsApi';
|
|
||||||
import { initializeDB, retrieveGLTF, storeGLTF } from '../../../utils/indexDB/idbUtils';
|
import { initializeDB, retrieveGLTF, storeGLTF } from '../../../utils/indexDB/idbUtils';
|
||||||
import { getCamera } from '../../../services/factoryBuilder/camera/getCameraApi';
|
import { getCamera } from '../../../services/factoryBuilder/camera/getCameraApi';
|
||||||
|
import { getFloorAssets } from '../../../services/factoryBuilder/assest/floorAsset/getFloorItemsApi';
|
||||||
|
|
||||||
async function loadInitialFloorItems(
|
async function loadInitialFloorItems(
|
||||||
itemsGroup: Types.RefGroup,
|
itemsGroup: Types.RefGroup,
|
||||||
|
@ -18,7 +18,8 @@ async function loadInitialFloorItems(
|
||||||
const email = localStorage.getItem('email');
|
const email = localStorage.getItem('email');
|
||||||
const organization = (email!.split("@")[1]).split(".")[0];
|
const organization = (email!.split("@")[1]).split(".")[0];
|
||||||
|
|
||||||
const items = await getFloorItems(organization);
|
const items = await getFloorAssets(organization);
|
||||||
|
console.log('items: ', items);
|
||||||
localStorage.setItem("FloorItems", JSON.stringify(items));
|
localStorage.setItem("FloorItems", JSON.stringify(items));
|
||||||
await initializeDB();
|
await initializeDB();
|
||||||
|
|
||||||
|
@ -121,18 +122,34 @@ async function loadInitialFloorItems(
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// console.log(`Item ${item.modelname} is not near`);
|
// console.log(`Item ${item.modelname} is not near`);
|
||||||
setFloorItems((prevItems) => [
|
if (item.eventData) {
|
||||||
...(prevItems || []),
|
setFloorItems((prevItems) => [
|
||||||
{
|
...(prevItems || []),
|
||||||
modeluuid: item.modeluuid,
|
{
|
||||||
modelname: item.modelname,
|
modeluuid: item.modeluuid,
|
||||||
position: item.position,
|
modelname: item.modelname,
|
||||||
rotation: item.rotation,
|
position: item.position,
|
||||||
modelfileID: item.modelfileID,
|
rotation: item.rotation,
|
||||||
isLocked: item.isLocked,
|
modelfileID: item.modelfileID,
|
||||||
isVisible: item.isVisible,
|
isLocked: item.isLocked,
|
||||||
},
|
isVisible: item.isVisible,
|
||||||
]);
|
eventData: item.eventData,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
setFloorItems((prevItems) => [
|
||||||
|
...(prevItems || []),
|
||||||
|
{
|
||||||
|
modeluuid: item.modeluuid,
|
||||||
|
modelname: item.modelname,
|
||||||
|
position: item.position,
|
||||||
|
rotation: item.rotation,
|
||||||
|
modelfileID: item.modelfileID,
|
||||||
|
isLocked: item.isLocked,
|
||||||
|
isVisible: item.isVisible,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
modelsLoaded++;
|
modelsLoaded++;
|
||||||
checkLoadingCompletion(modelsLoaded, modelsToLoad, dracoLoader, () => { });
|
checkLoadingCompletion(modelsLoaded, modelsToLoad, dracoLoader, () => { });
|
||||||
}
|
}
|
||||||
|
@ -169,18 +186,35 @@ function processLoadedModel(
|
||||||
|
|
||||||
|
|
||||||
itemsGroup?.current?.add(model);
|
itemsGroup?.current?.add(model);
|
||||||
setFloorItems((prevItems) => [
|
|
||||||
...(prevItems || []),
|
if (item.eventData) {
|
||||||
{
|
setFloorItems((prevItems) => [
|
||||||
modeluuid: item.modeluuid,
|
...(prevItems || []),
|
||||||
modelname: item.modelname,
|
{
|
||||||
position: item.position,
|
modeluuid: item.modeluuid,
|
||||||
rotation: item.rotation,
|
modelname: item.modelname,
|
||||||
modelfileID: item.modelfileID,
|
position: item.position,
|
||||||
isLocked: item.isLocked,
|
rotation: item.rotation,
|
||||||
isVisible: item.isVisible,
|
modelfileID: item.modelfileID,
|
||||||
},
|
isLocked: item.isLocked,
|
||||||
]);
|
isVisible: item.isVisible,
|
||||||
|
eventData: item.eventData,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
setFloorItems((prevItems) => [
|
||||||
|
...(prevItems || []),
|
||||||
|
{
|
||||||
|
modeluuid: item.modeluuid,
|
||||||
|
modelname: item.modelname,
|
||||||
|
position: item.position,
|
||||||
|
rotation: item.rotation,
|
||||||
|
modelfileID: item.modelfileID,
|
||||||
|
isLocked: item.isLocked,
|
||||||
|
isVisible: item.isVisible,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
gsap.to(model.position, { y: item.position[1], duration: 1.5, ease: 'power2.out' });
|
gsap.to(model.position, { y: item.position[1], duration: 1.5, ease: 'power2.out' });
|
||||||
gsap.to(model.scale, { x: 1, y: 1, z: 1, duration: 1.5, ease: 'power2.out' });
|
gsap.to(model.scale, { x: 1, y: 1, z: 1, duration: 1.5, ease: 'power2.out' });
|
||||||
|
|
|
@ -180,7 +180,7 @@ const CopyPasteControls = ({ itemsGroupRef, copiedObjects, setCopiedObjects, pas
|
||||||
socketId: socket.id,
|
socketId: socket.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.emit("v1:FloorItems:set", data);
|
socket.emit("v2:model-asset:add", data);
|
||||||
|
|
||||||
itemsGroupRef.current.add(obj);
|
itemsGroupRef.current.add(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ const DuplicationControls = ({ itemsGroupRef, duplicatedObjects, setDuplicatedOb
|
||||||
socketId: socket.id,
|
socketId: socket.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.emit("v1:FloorItems:set", data);
|
socket.emit("v2:model-asset:add", data);
|
||||||
|
|
||||||
itemsGroupRef.current.add(obj);
|
itemsGroupRef.current.add(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ function MoveControls({ movedObjects, setMovedObjects, itemsGroupRef, copiedObje
|
||||||
socketId: socket.id,
|
socketId: socket.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.emit("v1:FloorItems:set", data);
|
socket.emit("v2:model-asset:add", data);
|
||||||
|
|
||||||
itemsGroupRef.current.add(obj);
|
itemsGroupRef.current.add(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ function RotateControls({ rotatedObjects, setRotatedObjects, movedObjects, setMo
|
||||||
socketId: socket.id,
|
socketId: socket.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.emit("v1:FloorItems:set", data);
|
socket.emit("v2:model-asset:add", data);
|
||||||
|
|
||||||
itemsGroupRef.current.add(obj);
|
itemsGroupRef.current.add(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ const SelectionControls: React.FC = () => {
|
||||||
socketId: socket.id
|
socketId: socket.id
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.emit('v1:FloorItems:delete', data);
|
socket.emit('v2:model-asset:delete', data);
|
||||||
|
|
||||||
selectedMesh.traverse((child: THREE.Object3D) => {
|
selectedMesh.traverse((child: THREE.Object3D) => {
|
||||||
if (child instanceof THREE.Mesh) {
|
if (child instanceof THREE.Mesh) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ export default function TransformControl() {
|
||||||
socketId: socket.id
|
socketId: socket.id
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.emit('v1:FloorItems:set', data);
|
socket.emit('v2:model-asset:add', data);
|
||||||
}
|
}
|
||||||
localStorage.setItem("FloorItems", JSON.stringify(updatedItems));
|
localStorage.setItem("FloorItems", JSON.stringify(updatedItems));
|
||||||
return updatedItems;
|
return updatedItems;
|
||||||
|
|
|
@ -50,8 +50,8 @@ function Behaviour() {
|
||||||
connections: { source: { pathUUID: item.modeluuid, pointUUID: point2UUID }, targets: [] },
|
connections: { source: { pathUUID: item.modeluuid, pointUUID: point2UUID }, targets: [] },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
assetPosition: [...item.position],
|
position: [...item.position],
|
||||||
assetRotation: [item.rotation.x, item.rotation.y, item.rotation.z],
|
rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
|
||||||
speed: 'Inherit',
|
speed: 'Inherit',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ function Behaviour() {
|
||||||
connections: { source: { pathUUID: item.modeluuid, pointUUID: pointUUID }, targets: [] },
|
connections: { source: { pathUUID: item.modeluuid, pointUUID: pointUUID }, targets: [] },
|
||||||
speed: 2,
|
speed: 2,
|
||||||
},
|
},
|
||||||
assetPosition: [...item.position],
|
position: [...item.position],
|
||||||
};
|
};
|
||||||
|
|
||||||
newPaths.push(newVehiclePath);
|
newPaths.push(newVehiclePath);
|
||||||
|
|
|
@ -171,8 +171,8 @@ function PathCreation({ pathsGroupRef }: { pathsGroupRef: React.MutableRefObject
|
||||||
name={`${path.modeluuid}-event-path`}
|
name={`${path.modeluuid}-event-path`}
|
||||||
key={path.modeluuid}
|
key={path.modeluuid}
|
||||||
ref={el => (groupRefs.current[path.modeluuid] = el!)}
|
ref={el => (groupRefs.current[path.modeluuid] = el!)}
|
||||||
position={path.assetPosition}
|
position={path.position}
|
||||||
rotation={path.assetRotation}
|
rotation={path.rotation}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (isConnecting || eyeDropMode) return;
|
if (isConnecting || eyeDropMode) return;
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -237,7 +237,7 @@ function PathCreation({ pathsGroupRef }: { pathsGroupRef: React.MutableRefObject
|
||||||
name={`${path.modeluuid}-vehicle-path`}
|
name={`${path.modeluuid}-vehicle-path`}
|
||||||
key={path.modeluuid}
|
key={path.modeluuid}
|
||||||
ref={el => (groupRefs.current[path.modeluuid] = el!)}
|
ref={el => (groupRefs.current[path.modeluuid] = el!)}
|
||||||
position={path.assetPosition}
|
position={path.position}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (isConnecting || eyeDropMode) return;
|
if (isConnecting || eyeDropMode) return;
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||||
|
|
||||||
export const getFloorItems = async (organization: string) => {
|
export const getFloorAssets = async (organization: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/findfloorItems/${organization}`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v2/floorAssets/${organization}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -10,7 +10,7 @@ export const getFloorItems = async (organization: string) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("Failed to get Floor Items");
|
throw new Error("Failed to get assets");
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_TEST}`;
|
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||||
|
|
||||||
export const setFloorItemApi = async (
|
export const setFloorItemApi = async (
|
||||||
organization: string,
|
organization: string,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_TEST}`;
|
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||||
|
|
||||||
export const getAssetEventType = async (modelId: string, organization: string) => {
|
export const getAssetEventType = async (modelId: string, organization: string) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -319,8 +319,8 @@ interface ConveyorEventsSchema {
|
||||||
triggers: { uuid: string; name: string; type: string; isUsed: boolean; bufferTime: number }[] | [];
|
triggers: { uuid: string; name: string; type: string; isUsed: boolean; bufferTime: number }[] | [];
|
||||||
connections: { source: { pathUUID: string; pointUUID: string }; targets: { pathUUID: string; pointUUID: string }[] };
|
connections: { source: { pathUUID: string; pointUUID: string }; targets: { pathUUID: string; pointUUID: string }[] };
|
||||||
}[];
|
}[];
|
||||||
assetPosition: [number, number, number];
|
position: [number, number, number];
|
||||||
assetRotation: [number, number, number];
|
rotation: [number, number, number];
|
||||||
speed: number | string;
|
speed: number | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,5 +335,5 @@ interface VehicleEventsSchema {
|
||||||
connections: { source: { pathUUID: string; pointUUID: string }; targets: { pathUUID: string; pointUUID: string }[] };
|
connections: { source: { pathUUID: string; pointUUID: string }; targets: { pathUUID: string; pointUUID: string }[] };
|
||||||
speed: number;
|
speed: number;
|
||||||
};
|
};
|
||||||
assetPosition: [number, number, number];
|
position: [number, number, number];
|
||||||
}
|
}
|
Loading…
Reference in New Issue