Merge branch 'main' into rtViz
This commit is contained in:
@@ -30,6 +30,11 @@ export const useSocketStore = create<any>((set: any, get: any) => ({
|
||||
},
|
||||
}));
|
||||
|
||||
export const useLoadingProgress = create<{ loadingProgress: number; setLoadingProgress: (x: number) => void }>((set) => ({
|
||||
loadingProgress: 1,
|
||||
setLoadingProgress: (x: number) => set({ loadingProgress: x }),
|
||||
}));
|
||||
|
||||
export const useOrganization = create<any>((set: any) => ({
|
||||
organization: "",
|
||||
setOrganization: (x: any) => set(() => ({ organization: x })),
|
||||
@@ -307,27 +312,19 @@ export const useSelectedPath = create<any>((set: any) => ({
|
||||
}));
|
||||
|
||||
interface Path {
|
||||
modeluuid: string;
|
||||
modelName: string;
|
||||
points: {
|
||||
uuid: string;
|
||||
position: [number, number, number];
|
||||
rotation: [number, number, number];
|
||||
actions:
|
||||
| {
|
||||
uuid: string;
|
||||
type: string;
|
||||
material: string;
|
||||
delay: number | string;
|
||||
spawnInterval: number | string;
|
||||
isUsed: boolean;
|
||||
}[]
|
||||
| [];
|
||||
triggers: { uuid: string; type: string; isUsed: boolean }[] | [];
|
||||
}[];
|
||||
pathPosition: [number, number, number];
|
||||
pathRotation: [number, number, number];
|
||||
speed: number;
|
||||
modeluuid: string;
|
||||
modelName: string;
|
||||
points: {
|
||||
uuid: string;
|
||||
position: [number, number, number];
|
||||
rotation: [number, number, number];
|
||||
actions: { uuid: string; name: string; type: string; material: string; delay: number | string; spawnInterval: number | string; isUsed: boolean }[] | [];
|
||||
triggers: { uuid: string; name: string; type: string; isUsed: boolean }[] | [];
|
||||
connections: { source: { pathUUID: string; pointUUID: string }; targets: { pathUUID: string; pointUUID: string }[] };
|
||||
}[];
|
||||
pathPosition: [number, number, number];
|
||||
pathRotation: [number, number, number];
|
||||
speed: number;
|
||||
}
|
||||
|
||||
interface SimulationPathsStore {
|
||||
@@ -336,79 +333,8 @@ interface SimulationPathsStore {
|
||||
}
|
||||
|
||||
export const useSimulationPaths = create<SimulationPathsStore>((set) => ({
|
||||
simulationPaths: [],
|
||||
setSimulationPaths: (paths) => set({ simulationPaths: paths }),
|
||||
}));
|
||||
|
||||
// interface Point {
|
||||
// uuid: string;
|
||||
// position: [number, number, number];
|
||||
// rotation: [number, number, number];
|
||||
// event: {
|
||||
// uuid: string;
|
||||
// type: string;
|
||||
// material: string;
|
||||
// delay: number | string;
|
||||
// spawnInterval: number | string;
|
||||
// isUsed: boolean;
|
||||
// };
|
||||
// trigger: {
|
||||
// uuid: string;
|
||||
// type: string;
|
||||
// isUsed: boolean;
|
||||
// };
|
||||
// }
|
||||
|
||||
// interface Process {
|
||||
// processId: string;
|
||||
// processName: string;
|
||||
// points: Point[];
|
||||
// pathPosition: [number, number, number];
|
||||
// pathRotation: [number, number, number];
|
||||
// speed: number;
|
||||
// isUsed: boolean;
|
||||
// }
|
||||
|
||||
// interface Path {
|
||||
// modeluuid: string;
|
||||
// processes: Process[];
|
||||
// }
|
||||
|
||||
// interface SimulationPathsStore {
|
||||
// simulationPaths: Path[];
|
||||
// setSimulationPaths: (paths: Path[]) => void;
|
||||
// }
|
||||
|
||||
// export const useSimulationPaths = create<SimulationPathsStore>((set) => ({
|
||||
// simulationPaths: [],
|
||||
// setSimulationPaths: (paths) => set({ simulationPaths: paths }),
|
||||
// }));
|
||||
|
||||
export const useConnections = create<Types.ConnectionStore>((set) => ({
|
||||
connections: [],
|
||||
|
||||
setConnections: (connections) => set({ connections }),
|
||||
|
||||
addConnection: (newConnection) =>
|
||||
set((state) => ({
|
||||
connections: [...state.connections, newConnection],
|
||||
})),
|
||||
|
||||
removeConnection: (fromUUID, toUUID) =>
|
||||
set((state) => ({
|
||||
connections: state.connections
|
||||
.map((connection) =>
|
||||
connection.fromUUID === fromUUID
|
||||
? {
|
||||
...connection,
|
||||
toConnections: connection.toConnections.filter(
|
||||
(to) => to.toUUID !== toUUID
|
||||
),
|
||||
}
|
||||
: connection
|
||||
)
|
||||
.filter((connection) => connection.toConnections.length > 0),
|
||||
})),
|
||||
simulationPaths: [],
|
||||
setSimulationPaths: (paths: Path[]) => set({ simulationPaths: paths }),
|
||||
}));
|
||||
|
||||
export const useIsConnecting = create<any>((set: any) => ({
|
||||
|
||||
Reference in New Issue
Block a user