From 02ff5bb1537085acd9caf03d96c3a845be72bc88 Mon Sep 17 00:00:00 2001 From: internetcharles Date: Fri, 31 May 2024 13:44:51 -0700 Subject: [PATCH] recommit changes (#10271) Co-authored-by: David Gordon --- .../components/assets/ImportSettingsPanel.tsx | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/packages/editor/src/components/assets/ImportSettingsPanel.tsx b/packages/editor/src/components/assets/ImportSettingsPanel.tsx index 34c687c40c..d531de5cf9 100644 --- a/packages/editor/src/components/assets/ImportSettingsPanel.tsx +++ b/packages/editor/src/components/assets/ImportSettingsPanel.tsx @@ -30,7 +30,6 @@ import { FormControl, FormControlLabel, FormHelperText, - MenuItem, TextField, Typography } from '@mui/material' @@ -201,11 +200,9 @@ export default function ImportSettingsPanel() { const [LODImportFolder, setLODImportFolder] = useState(importSettingsState.LODFolder.value) const [LODGenEnabled, setLODGenEnabled] = useState(importSettingsState.LODsEnabled.value) const [selectedLODS, setSelectedLods] = useState( - importSettingsState.selectedLODS.get(NO_PROXY) as LODVariantDescriptor[] - ) - const [currentLOD, setCurrentLOD] = useState( - importSettingsState.selectedLODS[0].get(NO_PROXY) as LODVariantDescriptor + LODList.slice(0, 3) as LODVariantDescriptor[] ) + const [currentLOD, setCurrentLOD] = useState(null) const [currentIndex, setCurrentIndex] = useState(0) const [KTXEnabled, setKTXEnabled] = useState(importSettingsState.imageCompression.value) @@ -216,9 +213,11 @@ export default function ImportSettingsPanel() { }, [currentLOD, currentIndex]) const handleLODChange = () => { - const newLODS = [...selectedLODS] - newLODS.splice(currentIndex, 1, currentLOD) - setSelectedLods(newLODS) + if (currentLOD !== null) { + const newLODS = [...selectedLODS] + newLODS.splice(currentIndex, 1, currentLOD) + setSelectedLods(newLODS) + } } const handleSaveChanges = () => { @@ -265,18 +264,17 @@ export default function ImportSettingsPanel() { {selectedLODS.slice(0, 3).map((LOD, idx) => ( - - {LODList.map((sLOD) => ( - { - setCurrentLOD(sLOD) - setCurrentIndex(idx) - }} - > - {sLOD.params.dst} - - ))} - + ({ + label: sLOD.params.dst, + value: idx + }))} + value={LODList.findIndex((sLOD) => sLOD.params.dst === LOD.params.dst)} + onChange={(val) => { + setCurrentLOD(LODList[val]) + setCurrentIndex(idx) + }} + /> {presetLabels[idx]} ))}