+ ),
+ }),
+ },
/**
* Stream resource saving behavior toggle
*/
- streamIdleMode: new Setting({
+ stream_idle_mode: new Setting({
defaultValue: false,
description: 'Toggle stream idling, saving bandwidth and battery',
validate: (v) => typeof v === 'boolean',
@@ -190,7 +185,7 @@ export function createSettings() {
inputType: 'boolean',
},
}),
- onboardingStatus: new Setting({
+ onboarding_status: new Setting({
defaultValue: '',
// TODO: this could be better but we don't have a TS side real enum
// for this yet
@@ -198,62 +193,13 @@ export function createSettings() {
hideOnPlatform: 'both',
}),
/** Permanently dismiss the banner warning to download the desktop app. */
- dismissWebBanner: new Setting({
+ dismiss_web_banner: new Setting({
defaultValue: false,
description:
'Permanently dismiss the banner warning to download the desktop app.',
validate: (v) => typeof v === 'boolean',
hideOnPlatform: 'desktop',
}),
- projectDirectory: new Setting({
- defaultValue: '',
- description: 'The directory to save and load projects from',
- hideOnLevel: 'project',
- hideOnPlatform: 'web',
- validate: (v) =>
- typeof v === 'string' && (v.length > 0 || !isDesktop()),
- Component: ({ value, updateValue }) => {
- const inputRef = useRef(null)
- return (
-
-
-
-
- )
- },
- }),
},
/**
* Settings that affect the behavior while modeling.
@@ -262,7 +208,7 @@ export function createSettings() {
/**
* The default unit to use in modeling dimensions
*/
- defaultUnit: new Setting({
+ base_unit: new Setting({
defaultValue: 'mm',
description: 'The default unit to use in modeling dimensions',
validate: (v) => baseUnitsUnion.includes(v as BaseUnit),
@@ -285,7 +231,7 @@ export function createSettings() {
/**
* The controls for how to navigate the 3D view
*/
- mouseControls: new Setting({
+ mouse_controls: new Setting({
defaultValue: 'Zoo',
description: 'The controls for how to navigate the 3D view',
validate: (v) => cameraSystems.includes(v as CameraSystem),
@@ -345,7 +291,7 @@ export function createSettings() {
/**
* Projection method applied to the 3D view, perspective or orthographic
*/
- cameraProjection: new Setting({
+ camera_projection: new Setting({
defaultValue: 'orthographic',
hideOnLevel: 'project',
description:
@@ -372,10 +318,17 @@ export function createSettings() {
})),
},
}),
+ enable_ssao: new Setting({
+ defaultValue: true,
+ description:
+ 'Whether or not Screen Space Ambient Occlusion (SSAO) is enabled',
+ validate: (v) => typeof v === 'boolean',
+ hideOnPlatform: 'both', //for now
+ }),
/**
* Whether to highlight edges of 3D objects
*/
- highlightEdges: new Setting({
+ highlight_edges: new Setting({
defaultValue: true,
description: 'Whether to highlight edges of 3D objects',
validate: (v) => typeof v === 'boolean',
@@ -387,7 +340,7 @@ export function createSettings() {
/**
* Whether to show a scale grid in the 3D modeling view
*/
- showScaleGrid: new Setting({
+ show_scale_grid: new Setting({
defaultValue: false,
description: 'Whether to show a scale grid in the 3D modeling view',
validate: (v) => typeof v === 'boolean',
@@ -400,7 +353,7 @@ export function createSettings() {
* Whether to show the debug panel, which lets you see
* various states of the app to aid in development
*/
- showDebugPanel: new Setting({
+ show_debug_panel: new Setting({
defaultValue: false,
description: 'Whether to show the debug panel, a development tool',
validate: (v) => typeof v === 'boolean',
@@ -438,11 +391,11 @@ export function createSettings() {
/**
* Settings that affect the behavior of the KCL text editor.
*/
- textEditor: {
+ text_editor: {
/**
* Whether to wrap text in the editor or overflow with scroll
*/
- textWrapping: new Setting({
+ text_wrapping: new Setting({
defaultValue: true,
description:
'Whether to wrap text in the editor or overflow with scroll',
@@ -454,7 +407,7 @@ export function createSettings() {
/**
* Whether to make the cursor blink in the editor
*/
- blinkingCursor: new Setting({
+ blinking_cursor: new Setting({
defaultValue: true,
description: 'Whether to make the cursor blink in the editor',
validate: (v) => typeof v === 'boolean',
@@ -466,11 +419,60 @@ export function createSettings() {
/**
* Settings that affect the behavior of project management.
*/
- projects: {
+ project: {
+ directory: new Setting({
+ defaultValue: '',
+ description: 'The directory to save and load projects from',
+ hideOnLevel: 'project',
+ hideOnPlatform: 'web',
+ validate: (v) =>
+ typeof v === 'string' && (v.length > 0 || !isDesktop()),
+ Component: ({ value, updateValue }) => {
+ const inputRef = useRef(null)
+ return (
+
+
+
+
+ )
+ },
+ }),
/**
* The default project name to use when creating a new project
*/
- defaultProjectName: new Setting({
+ default_project_name: new Setting({
defaultValue: DEFAULT_PROJECT_NAME,
description:
'The default project name to use when creating a new project',
@@ -504,11 +506,11 @@ export function createSettings() {
/**
* Settings that affect the behavior of the command bar.
*/
- commandBar: {
+ command_bar: {
/**
* Whether to include settings in the command bar
*/
- includeSettings: new Setting({
+ include_settings: new Setting({
defaultValue: true,
description: 'Whether to include settings in the command bar',
validate: (v) => typeof v === 'boolean',
diff --git a/src/lib/settings/settingsUtils.test.ts b/src/lib/settings/settingsUtils.test.ts
index 20a65a18b..62fb84881 100644
--- a/src/lib/settings/settingsUtils.test.ts
+++ b/src/lib/settings/settingsUtils.test.ts
@@ -26,8 +26,8 @@ describe(`testing settings initialization`, () => {
setSettingsAtLevel(settings, 'user', appSettingsPayload)
- expect(settings.app.theme.current).toBe('dark')
- expect(settings.app.themeColor.current).toBe('190')
+ expect(settings.app.appearance.theme.current).toBe('dark')
+ expect(settings.app.appearance.color.current).toBe('190')
})
it(`doesn't read theme from project settings`, () => {
@@ -61,9 +61,9 @@ describe(`testing settings initialization`, () => {
setSettingsAtLevel(settings, 'project', projectSettingsPayload)
// The 'project'-level for `theme` setting should be ignored completely
- expect(settings.app.theme.current).toBe('dark')
+ expect(settings.app.appearance.theme.current).toBe('dark')
// But the 'project'-level for `themeColor` setting should be applied
- expect(settings.app.themeColor.current).toBe('200')
+ expect(settings.app.appearance.color.current).toBe('200')
})
})
@@ -106,8 +106,8 @@ describe(`testing getAllCurrentSettings`, () => {
const allCurrentSettings = getAllCurrentSettings(settings)
// This one gets the 'user'-level theme because it's ignored at the project level
// (see the test "doesn't read theme from project settings")
- expect(allCurrentSettings.app.theme).toBe('dark')
- expect(allCurrentSettings.app.themeColor).toBe('200')
- expect(allCurrentSettings.modeling.defaultUnit).toBe('ft')
+ expect(allCurrentSettings.app.appearance?.theme).toBe('dark')
+ expect(allCurrentSettings.app.appearance?.color).toBe('200')
+ expect(allCurrentSettings.modeling.base_unit).toBe('ft')
})
})
diff --git a/src/lib/settings/settingsUtils.ts b/src/lib/settings/settingsUtils.ts
index 36c9bef22..dbfa399b7 100644
--- a/src/lib/settings/settingsUtils.ts
+++ b/src/lib/settings/settingsUtils.ts
@@ -34,36 +34,38 @@ export function configurationToSettingsPayload(
): DeepPartial {
return {
app: {
- theme: appThemeToTheme(configuration?.settings?.app?.appearance?.theme),
- themeColor: configuration?.settings?.app?.appearance?.color
- ? configuration?.settings?.app?.appearance?.color.toString()
- : undefined,
- onboardingStatus: configuration?.settings?.app?.onboarding_status,
- dismissWebBanner: configuration?.settings?.app?.dismiss_web_banner,
- streamIdleMode: configuration?.settings?.app?.stream_idle_mode,
- projectDirectory: configuration?.settings?.project?.directory,
- enableSSAO: configuration?.settings?.modeling?.enable_ssao,
+ appearance: {
+ theme: appThemeToTheme(configuration?.settings?.app?.appearance?.theme),
+ color: configuration?.settings?.app?.appearance?.color
+ ? configuration?.settings?.app?.appearance?.color.toString()
+ : undefined,
+ },
+ onboarding_status: configuration?.settings?.app?.onboarding_status,
+ dismiss_web_banner: configuration?.settings?.app?.dismiss_web_banner,
+ stream_idle_mode: configuration?.settings?.app?.stream_idle_mode,
},
modeling: {
- defaultUnit: configuration?.settings?.modeling?.base_unit,
- cameraProjection: configuration?.settings?.modeling?.camera_projection,
- mouseControls: mouseControlsToCameraSystem(
+ base_unit: configuration?.settings?.modeling?.base_unit,
+ camera_projection: configuration?.settings?.modeling?.camera_projection,
+ mouse_controls: mouseControlsToCameraSystem(
configuration?.settings?.modeling?.mouse_controls
),
- highlightEdges: configuration?.settings?.modeling?.highlight_edges,
- showDebugPanel: configuration?.settings?.modeling?.show_debug_panel,
- showScaleGrid: configuration?.settings?.modeling?.show_scale_grid,
+ highlight_edges: configuration?.settings?.modeling?.highlight_edges,
+ show_debug_panel: configuration?.settings?.modeling?.show_debug_panel,
+ show_scale_grid: configuration?.settings?.modeling?.show_scale_grid,
+ enable_ssao: configuration?.settings?.modeling?.enable_ssao,
},
- textEditor: {
- textWrapping: configuration?.settings?.text_editor?.text_wrapping,
- blinkingCursor: configuration?.settings?.text_editor?.blinking_cursor,
+ text_editor: {
+ text_wrapping: configuration?.settings?.text_editor?.text_wrapping,
+ blinking_cursor: configuration?.settings?.text_editor?.blinking_cursor,
},
- projects: {
- defaultProjectName:
+ project: {
+ default_project_name:
configuration?.settings?.project?.default_project_name,
+ directory: configuration?.settings?.project?.directory,
},
- commandBar: {
- includeSettings: configuration?.settings?.command_bar?.include_settings,
+ command_bar: {
+ include_settings: configuration?.settings?.command_bar?.include_settings,
},
}
}
@@ -73,29 +75,31 @@ export function projectConfigurationToSettingsPayload(
): DeepPartial {
return {
app: {
- // do not read in `theme`, because it is blocked on the project level
- themeColor: configuration?.settings?.app?.appearance?.color
- ? configuration?.settings?.app?.appearance?.color.toString()
- : undefined,
- onboardingStatus: configuration?.settings?.app?.onboarding_status,
- dismissWebBanner: configuration?.settings?.app?.dismiss_web_banner,
- streamIdleMode: configuration?.settings?.app?.stream_idle_mode,
- enableSSAO: configuration?.settings?.modeling?.enable_ssao,
+ appearance: {
+ // do not read in `theme`, because it is blocked on the project level
+ color: configuration?.settings?.app?.appearance?.color
+ ? configuration?.settings?.app?.appearance?.color.toString()
+ : undefined,
+ },
+ onboarding_status: configuration?.settings?.app?.onboarding_status,
+ dismiss_web_banner: configuration?.settings?.app?.dismiss_web_banner,
+ stream_idle_mode: configuration?.settings?.app?.stream_idle_mode,
},
modeling: {
- defaultUnit: configuration?.settings?.modeling?.base_unit,
- mouseControls: mouseControlsToCameraSystem(
+ base_unit: configuration?.settings?.modeling?.base_unit,
+ mouse_controls: mouseControlsToCameraSystem(
configuration?.settings?.modeling?.mouse_controls
),
- highlightEdges: configuration?.settings?.modeling?.highlight_edges,
- showDebugPanel: configuration?.settings?.modeling?.show_debug_panel,
+ highlight_edges: configuration?.settings?.modeling?.highlight_edges,
+ show_debug_panel: configuration?.settings?.modeling?.show_debug_panel,
+ enable_ssao: configuration?.settings?.modeling?.enable_ssao,
},
- textEditor: {
- textWrapping: configuration?.settings?.text_editor?.text_wrapping,
- blinkingCursor: configuration?.settings?.text_editor?.blinking_cursor,
+ text_editor: {
+ text_wrapping: configuration?.settings?.text_editor?.text_wrapping,
+ blinking_cursor: configuration?.settings?.text_editor?.blinking_cursor,
},
- commandBar: {
- includeSettings: configuration?.settings?.command_bar?.include_settings,
+ command_bar: {
+ include_settings: configuration?.settings?.command_bar?.include_settings,
},
}
}
@@ -181,7 +185,7 @@ export async function loadAndValidateSettings(
// Because getting the default directory is async, we need to set it after
if (onDesktop) {
- settings.app.projectDirectory.default = await getInitialDefaultDir()
+ settings.project.directory.default = await getInitialDefaultDir()
}
settingsNext = setSettingsAtLevel(
diff --git a/src/machines/settingsMachine.ts b/src/machines/settingsMachine.ts
index 1c432c923..32788455d 100644
--- a/src/machines/settingsMachine.ts
+++ b/src/machines/settingsMachine.ts
@@ -84,13 +84,13 @@ export const settingsMachine = setup({
return newContext
}),
setThemeClass: ({ context }) => {
- const currentTheme = context.app.theme.current ?? Themes.System
+ const currentTheme = context.app.appearance.theme.current ?? Themes.System
setThemeClass(
currentTheme === Themes.System ? getSystemTheme() : currentTheme
)
},
setEngineCameraProjection: ({ context }) => {
- const newCurrentProjection = context.modeling.cameraProjection.current
+ const newCurrentProjection = context.modeling.camera_projection.current
sceneInfra.camControls.setEngineCameraProjection(newCurrentProjection)
},
},
diff --git a/src/routes/Home.tsx b/src/routes/Home.tsx
index 3c4839637..7bfef7309 100644
--- a/src/routes/Home.tsx
+++ b/src/routes/Home.tsx
@@ -79,13 +79,13 @@ const Home = () => {
send({
type: 'assign',
data: {
- defaultProjectName: settings.projects.defaultProjectName.current,
- defaultDirectory: settings.app.projectDirectory.current,
+ defaultProjectName: settings.project.default_project_name.current,
+ defaultDirectory: settings.project.directory.current,
},
})
}, [
- settings.app.projectDirectory.current,
- settings.projects.defaultProjectName.current,
+ settings.project.directory.current,
+ settings.project.default_project_name.current,
send,
])
@@ -134,7 +134,7 @@ const Home = () => {
groupId: 'projects',
name: 'Create project',
argDefaultValues: {
- name: settings.projects.defaultProjectName.current,
+ name: settings.project.default_project_name.current,
},
},
})
@@ -207,7 +207,7 @@ const Home = () => {
to={`${PATHS.HOME + PATHS.SETTINGS_USER}#projectDirectory`}
className="text-chalkboard-90 dark:text-chalkboard-20 underline underline-offset-2"
>
- {settings.app.projectDirectory.current}
+ {settings.project.directory.current}
.