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

Commit

Permalink
Fix Image Compression Settings (#10283)
Browse files Browse the repository at this point in the history
* Fix Image Compression Settings

* access state from within the component
  • Loading branch information
CITIZENDOT authored Jun 6, 2024
1 parent 5384341 commit e74b0af
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/editor/src/components/assets/ImportSettingsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ const UASTCFlagOptions = [
{ label: 'Disable Flip and Individual', value: 256 }
]

const ImageCompressionBox = ({ compressProperties }) => {
const ImageCompressionBox = () => {
const compressProperties = useMutableState(ImportSettingsState).imageSettings

return (
<>
<InputGroup name="fileType" label={'File'}>
Expand Down Expand Up @@ -194,7 +196,7 @@ const ImageCompressionBox = ({ compressProperties }) => {

export default function ImportSettingsPanel() {
const importSettingsState = useMutableState(ImportSettingsState)
const compressProperties = useMutableState(ImportSettingsState).imageSettings.get(NO_PROXY)
const compressProperties = useMutableState(ImportSettingsState).imageSettings

const [defaultImportFolder, setDefaultImportFolder] = useState<string>(importSettingsState.importFolder.value)
const [LODImportFolder, setLODImportFolder] = useState<string>(importSettingsState.LODFolder.value)
Expand Down Expand Up @@ -225,7 +227,7 @@ export default function ImportSettingsPanel() {
importSettingsState.LODFolder.set(LODImportFolder)
importSettingsState.LODsEnabled.set(LODGenEnabled)
importSettingsState.imageCompression.set(KTXEnabled)
importSettingsState.imageSettings.set(compressProperties)
importSettingsState.imageSettings.set(compressProperties.get(NO_PROXY))
importSettingsState.selectedLODS.set(selectedLODS)
handleCancel()
}
Expand Down Expand Up @@ -290,7 +292,7 @@ export default function ImportSettingsPanel() {
control={<Checkbox checked={KTXEnabled} onChange={() => setKTXEnabled(!KTXEnabled)} />}
label={'Compress to KTX2'}
/>
{KTXEnabled && <ImageCompressionBox compressProperties={compressProperties} />}
{KTXEnabled && <ImageCompressionBox />}
</Box>
</Box>
<Box>
Expand Down

0 comments on commit e74b0af

Please sign in to comment.