Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
recommit changes (#10271)
Browse files Browse the repository at this point in the history
Co-authored-by: David Gordon <[email protected]>
  • Loading branch information
internetcharles and dinomut1 authored May 31, 2024
1 parent b42fa36 commit 02ff5bb
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions packages/editor/src/components/assets/ImportSettingsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
FormControl,
FormControlLabel,
FormHelperText,
MenuItem,
TextField,
Typography
} from '@mui/material'
Expand Down Expand Up @@ -201,11 +200,9 @@ export default function ImportSettingsPanel() {
const [LODImportFolder, setLODImportFolder] = useState<string>(importSettingsState.LODFolder.value)
const [LODGenEnabled, setLODGenEnabled] = useState<boolean>(importSettingsState.LODsEnabled.value)
const [selectedLODS, setSelectedLods] = useState<LODVariantDescriptor[]>(
importSettingsState.selectedLODS.get(NO_PROXY) as LODVariantDescriptor[]
)
const [currentLOD, setCurrentLOD] = useState<LODVariantDescriptor>(
importSettingsState.selectedLODS[0].get(NO_PROXY) as LODVariantDescriptor
LODList.slice(0, 3) as LODVariantDescriptor[]
)
const [currentLOD, setCurrentLOD] = useState<LODVariantDescriptor | null>(null)
const [currentIndex, setCurrentIndex] = useState<number>(0)
const [KTXEnabled, setKTXEnabled] = useState<boolean>(importSettingsState.imageCompression.value)

Expand All @@ -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 = () => {
Expand Down Expand Up @@ -265,18 +264,17 @@ export default function ImportSettingsPanel() {
<List>
{selectedLODS.slice(0, 3).map((LOD, idx) => (
<FormControl>
<TextField select label={LOD.params.dst} value={LOD.params.dst}>
{LODList.map((sLOD) => (
<MenuItem
onClick={() => {
setCurrentLOD(sLOD)
setCurrentIndex(idx)
}}
>
{sLOD.params.dst}
</MenuItem>
))}
</TextField>
<SelectInput
options={LODList.map((sLOD, idx) => ({
label: sLOD.params.dst,
value: idx
}))}
value={LODList.findIndex((sLOD) => sLOD.params.dst === LOD.params.dst)}
onChange={(val) => {
setCurrentLOD(LODList[val])
setCurrentIndex(idx)
}}
/>
<FormHelperText>{presetLabels[idx]}</FormHelperText>
</FormControl>
))}
Expand Down

0 comments on commit 02ff5bb

Please sign in to comment.