auto-git:
[change] src/app/App.tsx
This commit is contained in:
162
src/app/App.tsx
162
src/app/App.tsx
@@ -7057,52 +7057,69 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
|
|
||||||
applyBoxVolumeSettings(
|
applyBoxVolumeSettings(
|
||||||
(currentVolume) => {
|
(currentVolume) => {
|
||||||
if (mode === "none") {
|
switch (mode) {
|
||||||
return {
|
case "none":
|
||||||
mode: "none"
|
return {
|
||||||
};
|
mode: "none"
|
||||||
}
|
|
||||||
|
|
||||||
if (mode === "water") {
|
|
||||||
return currentVolume.mode === "water"
|
|
||||||
? currentVolume
|
|
||||||
: {
|
|
||||||
mode: "water",
|
|
||||||
water: {
|
|
||||||
colorHex: boxVolumeWaterColorDraft,
|
|
||||||
surfaceOpacity: readNonNegativeNumberDraft(
|
|
||||||
boxVolumeWaterSurfaceOpacityDraft,
|
|
||||||
"Water surface opacity"
|
|
||||||
),
|
|
||||||
waveStrength: readNonNegativeNumberDraft(
|
|
||||||
boxVolumeWaterWaveStrengthDraft,
|
|
||||||
"Water wave strength"
|
|
||||||
),
|
|
||||||
foamContactLimit: readWaterFoamContactLimitDraft(
|
|
||||||
boxVolumeWaterFoamContactLimitDraft
|
|
||||||
),
|
|
||||||
surfaceDisplacementEnabled:
|
|
||||||
boxVolumeWaterSurfaceDisplacementEnabledDraft
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return currentVolume.mode === "fog"
|
|
||||||
? currentVolume
|
|
||||||
: {
|
|
||||||
mode: "fog",
|
|
||||||
fog: {
|
|
||||||
colorHex: boxVolumeFogColorDraft,
|
|
||||||
density: readNonNegativeNumberDraft(
|
|
||||||
boxVolumeFogDensityDraft,
|
|
||||||
"Fog density"
|
|
||||||
),
|
|
||||||
padding: readNonNegativeNumberDraft(
|
|
||||||
boxVolumeFogPaddingDraft,
|
|
||||||
"Fog padding"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
case "water":
|
||||||
|
return currentVolume.mode === "water"
|
||||||
|
? currentVolume
|
||||||
|
: {
|
||||||
|
mode: "water",
|
||||||
|
water: {
|
||||||
|
colorHex: boxVolumeWaterColorDraft,
|
||||||
|
surfaceOpacity: readNonNegativeNumberDraft(
|
||||||
|
boxVolumeWaterSurfaceOpacityDraft,
|
||||||
|
"Water surface opacity"
|
||||||
|
),
|
||||||
|
waveStrength: readNonNegativeNumberDraft(
|
||||||
|
boxVolumeWaterWaveStrengthDraft,
|
||||||
|
"Water wave strength"
|
||||||
|
),
|
||||||
|
foamContactLimit: readWaterFoamContactLimitDraft(
|
||||||
|
boxVolumeWaterFoamContactLimitDraft
|
||||||
|
),
|
||||||
|
surfaceDisplacementEnabled:
|
||||||
|
boxVolumeWaterSurfaceDisplacementEnabledDraft
|
||||||
|
}
|
||||||
|
};
|
||||||
|
case "fog":
|
||||||
|
return currentVolume.mode === "fog"
|
||||||
|
? currentVolume
|
||||||
|
: {
|
||||||
|
mode: "fog",
|
||||||
|
fog: {
|
||||||
|
colorHex: boxVolumeFogColorDraft,
|
||||||
|
density: readNonNegativeNumberDraft(
|
||||||
|
boxVolumeFogDensityDraft,
|
||||||
|
"Fog density"
|
||||||
|
),
|
||||||
|
padding: readNonNegativeNumberDraft(
|
||||||
|
boxVolumeFogPaddingDraft,
|
||||||
|
"Fog padding"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
case "light":
|
||||||
|
return currentVolume.mode === "light"
|
||||||
|
? currentVolume
|
||||||
|
: {
|
||||||
|
mode: "light",
|
||||||
|
light: {
|
||||||
|
colorHex: boxVolumeLightColorDraft,
|
||||||
|
intensity: readNonNegativeNumberDraft(
|
||||||
|
boxVolumeLightIntensityDraft,
|
||||||
|
"Light intensity"
|
||||||
|
),
|
||||||
|
padding: readNonNegativeNumberDraft(
|
||||||
|
boxVolumeLightPaddingDraft,
|
||||||
|
"Light padding"
|
||||||
|
),
|
||||||
|
falloff: boxVolumeLightFalloffDraft
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
`Set box volume mode to ${mode}`,
|
`Set box volume mode to ${mode}`,
|
||||||
`Set selected whitebox box volume mode to ${formatBoxVolumeModeLabel(mode)}.`
|
`Set selected whitebox box volume mode to ${formatBoxVolumeModeLabel(mode)}.`
|
||||||
@@ -7227,6 +7244,61 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resolveDraftBoxLightSettings = (
|
||||||
|
overrides: {
|
||||||
|
colorHex?: string;
|
||||||
|
intensity?: number;
|
||||||
|
padding?: number;
|
||||||
|
falloff?: BoxBrushLightFalloffMode;
|
||||||
|
} = {}
|
||||||
|
) => ({
|
||||||
|
colorHex: overrides.colorHex ?? boxVolumeLightColorDraft,
|
||||||
|
intensity:
|
||||||
|
overrides.intensity ??
|
||||||
|
readNonNegativeNumberDraft(boxVolumeLightIntensityDraft, "Light intensity"),
|
||||||
|
padding:
|
||||||
|
overrides.padding ??
|
||||||
|
readNonNegativeNumberDraft(boxVolumeLightPaddingDraft, "Light padding"),
|
||||||
|
falloff: overrides.falloff ?? boxVolumeLightFalloffDraft
|
||||||
|
});
|
||||||
|
|
||||||
|
const applyBoxLightSettings = (
|
||||||
|
overrides: {
|
||||||
|
colorHex?: string;
|
||||||
|
intensity?: number;
|
||||||
|
padding?: number;
|
||||||
|
falloff?: BoxBrushLightFalloffMode;
|
||||||
|
} = {}
|
||||||
|
) => {
|
||||||
|
if (selectedBrush === null || selectedBrush.volume.mode !== "light") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyBoxVolumeSettings(
|
||||||
|
() => ({
|
||||||
|
mode: "light",
|
||||||
|
light: resolveDraftBoxLightSettings(overrides)
|
||||||
|
}),
|
||||||
|
"Set box light settings",
|
||||||
|
"Updated selected whitebox light settings."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const applyBoxLightColorDraft = (colorHex: string) => {
|
||||||
|
if (selectedBrush === null || selectedBrush.volume.mode !== "light") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyBoxVolumeSettings(
|
||||||
|
() => ({
|
||||||
|
mode: "light",
|
||||||
|
light: resolveDraftBoxLightSettings({ colorHex })
|
||||||
|
}),
|
||||||
|
"Set box light color",
|
||||||
|
"Updated selected whitebox light color."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const commitEntityChange = (
|
const commitEntityChange = (
|
||||||
currentEntity: EntityInstance,
|
currentEntity: EntityInstance,
|
||||||
nextEntity: EntityInstance,
|
nextEntity: EntityInstance,
|
||||||
|
|||||||
Reference in New Issue
Block a user