Skip to content

Commit

Permalink
Fix presets
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Jan 3, 2024
1 parent 2513cd7 commit 735b09a
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/components/Dialogs/SceneDialogs/EditSceneDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ const EditSceneDialog = () => {
setScVirtualsToIgnore([])
setDialogOpenAddScene(false, false)
}

const sVirtuals =
scenes[data.name?.toLowerCase().replaceAll(' ', '-')]?.virtuals || {}

const handleAddSceneWithVirtuals = () => {
addScene(
name,
Expand All @@ -155,10 +159,7 @@ const EditSceneDialog = () => {
url,
payload,
midiActivate,
filterKeys(
scenes[data.name?.toLowerCase().replaceAll(' ', '-')].virtuals,
scVirtualsToIgnore
)
filterKeys(sVirtuals, scVirtualsToIgnore)
).then(() => {
getScenes()
})
Expand Down Expand Up @@ -220,13 +221,7 @@ const EditSceneDialog = () => {
Object.keys(ledfx_presets).find(
(k) =>
JSON.stringify(ordered((ledfx_presets[k] as any).config)) ===
JSON.stringify(
ordered(
scenes[data.name?.toLowerCase().replaceAll(' ', '-')].virtuals[
dev
].config
)
)
JSON.stringify(ordered(sVirtuals[dev].config))
)
const userPresets =
user_presets[effectId] &&
Expand Down Expand Up @@ -254,10 +249,8 @@ const EditSceneDialog = () => {
e.target.value &&
activatePreset(
dev,
'default_presets',
scenes[data.name?.toLowerCase().replaceAll(' ', '-')].virtuals[
dev
].type,
ledfxPreset ? 'default_presets' : 'user_presets',
sVirtuals[dev].type,
e.target.value
).then(() => getVirtuals())
}
Expand Down Expand Up @@ -741,9 +734,7 @@ const EditSceneDialog = () => {
scenes &&
data.name?.toLowerCase().replaceAll(' ', '-') &&
scenes[data.name?.toLowerCase().replaceAll(' ', '-')] &&
Object.keys(
scenes[data.name?.toLowerCase().replaceAll(' ', '-')].virtuals
)
Object.keys(sVirtuals)
.filter(
(d) =>
!!scenes[data.name?.toLowerCase().replaceAll(' ', '-')]
Expand Down

0 comments on commit 735b09a

Please sign in to comment.