Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Move Explore model variations into a left sidebar

Scott Petrovic72ee7e807b95
diff --git a/src/dialog.css b/src/dialog.css
index d95ac77..da3105f 100644
--- a/src/dialog.css
+++ b/src/dialog.css
@@ -86,118 +86,6 @@
border: 0;
}
-/* ── Model Variation Dialog ── */
-
-.variation-dialog {
- width: 60vw;
- animation: dialog-bounce-in 0.3s ease-out;
- box-shadow: 0 0 7rem #08161e9e;
-}
-
-.variation-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
- gap: 0rem;
- padding: 0;
- max-height: 40vh;
- overflow: auto;
- background: var(--bg-alternate);
-}
-
-.variation-card {
- border: 2px solid var(--border-color);
- border-radius: 8px;
- padding: 0.25rem;
- cursor: pointer;
- text-align: center;
- transition: box-shadow 0.25s, transform 0.25s;
- background: var(--bg-alternate);
- transform: scale(0.95);
-}
-
-.variation-card:hover {
- box-shadow: 0 0 0 2px var(--text-alternate);
- transform: scale(1.00);
-}
-
-.variation-card:active {
- transform: scale(0.95);
-}
-
-.variation-card.selected {
- box-shadow: 0 0 0 2px var(--text-primary);
-}
-
-.variation-preview-image {
- width: 100%;
- object-fit: contain;
- border-radius: 12px;
- background: var(--bg-primary);
- margin: 0;
- filter: none !important; /* avoid inverting image like we do for icons in light mode */
-}
-
-.variation-name {
- font-size: 1.3rem;
-}
-
-.variation-license-chip {
- padding: 0.5rem 1.0rem;
- background: color-mix(in srgb, var(--text-alternate) 22%, var(--bg-primary));
- font-size: 90%;
- margin: 0;
-}
-.variation-license-chip:hover {
- background: color-mix(in srgb, var(--text-alternate) 32%, var(--bg-primary));
-}
-
-.variation-attribution {
- opacity: 0.7;
-}
-
-.variation-loading-container {
- display: flex;
- flex-direction: column;
- gap: 0;
- margin: 0;
-}
-
-.variation-loading-track {
- width: 100%;
- background: var(--bg-alternate);
- border-radius: 4px;
- overflow: hidden;
- border: 1px solid var(--border-color);
- display: flex;
- flex-direction: row;
- gap: 1rem;
- align-items: center; /* vertical align */
-}
-
-.variation-loading-bar {
- flex: 1;
- height: 100%;
- background-color: var(--button-primary-bg);
- border-radius: 4px;
- transform: scaleX(0);
- transform-origin: left center;
- transition: transform 0.2s ease;
- display: block;
-}
-
-.variation-loading-text {
- color: var(--text-primary);
- white-space: nowrap;
- flex-shrink: 0;
-}
-
-.variation-dialog-buttons {
- display: flex;
- justify-content: flex-end;
- gap: 0.75rem;
- margin-top: 1rem;
-}
-
/* ── Model Analysis Dialog ── */
.model-analysis-dialog .modal-dialog-content {
diff --git a/src/index.html b/src/index.html
index 609e9a4..6e2feff 100644
--- a/src/index.html
+++ b/src/index.html
@@ -7,7 +7,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
-<body style="margin: 0">
+<body class="explore-page" style="margin: 0">
<!-- Script files-->
<script type="module" src="./marketing/MarketingBootstrap.ts"></script>
@@ -39,9 +39,24 @@
<div id="header-ui-mount"></div>
- <div class="model-selection-section">
+ <aside class="model-selection-section">
<!-- populated dynamically from RigConfig -->
- </div>
+ <h2 class="sidebar-heading">Rig</h2>
+ <div id="skeleton-buttons"></div>
+
+ <div id="variation-section" style="display: none">
+ <h2 class="sidebar-heading">Model</h2>
+ <div id="variation-grid" class="variation-grid">
+ <!-- cards populated dynamically from RigConfig -->
+ </div>
+ <div id="variation-loading-container" class="variation-loading-container" style="display: none">
+ <div class="variation-loading-track">
+ <span id="variation-loading-text" class="variation-loading-text">Loading model…</span>
+ <div id="variation-loading-bar" class="variation-loading-bar"></div>
+ </div>
+ </div>
+ </div>
+ </aside>
<div id="tool-panel">
@@ -85,27 +100,6 @@
</span>
- <!-- model variation switcher-->
- <div id="model-variation-switcher">
- <div id="model-variation-info">
- <img id="model-variation-info-image" src="" alt="" />
- <div id="model-variation-info-details">
- <span style="display: flex; flex-direction: row; gap: 0.5rem;">
- <span id="model-variation-info-name"></span>
-
- </span>
- <span>
- <span id="model-variation-info-attribution"></span>
- <span id="model-variation-info-license" class="variation-license-chip"></span>
- </span>
-
- </div>
- </div>
- <button id="model-variation-button" class="secondary-button">Change</button>
- </div>
-
-
-
<span id="skinned-step-animation-export-options">
<div id="animations-listing">
@@ -207,26 +201,5 @@
<!-- build version information-->
<span id="build-version"></span>
- <!-- model variation confirmation dialog (hidden by default) -->
- <div id="variation-dialog-overlay" class="modal-dialog-overlay" style="display: none">
- <div class="modal-dialog-content variation-dialog">
- <h2>Choose Model</h2>
- <div id="variation-grid" class="variation-grid">
- <!-- cards populated dynamically from RigConfig -->
- </div>
- <div id="variation-loading-container" class="variation-loading-container" style="display: none">
- <div class="variation-loading-track">
- <span id="variation-loading-text" class="variation-loading-text">Loading model…</span>
- <div id="variation-loading-bar" class="variation-loading-bar"></div>
- </div>
-
- </div>
- <div class="variation-dialog-buttons">
- <button id="variation-cancel-button" class="secondary-button">Cancel</button>
- <button id="variation-confirm-button" disabled>Replace Model</button>
- </div>
- </div>
- </div>
-
</body>
</html>
\ No newline at end of file
diff --git a/src/lib/CustomViewHelper.ts b/src/lib/CustomViewHelper.ts
index 55e1afb..c23885e 100644
--- a/src/lib/CustomViewHelper.ts
+++ b/src/lib/CustomViewHelper.ts
@@ -133,7 +133,7 @@ export class CustomViewHelper extends Object3D {
this.updateMatrixWorld()
this.point.set(0, 0, 1)
this.point.applyQuaternion(this.camera.quaternion)
- const x = this.domElement.offsetWidth - this.dim
+ const x = this.domElement.offsetLeft + this.domElement.offsetWidth - this.dim
const y = (renderer as any).isWebGPURenderer ? this.domElement.offsetHeight - this.dim : 0
renderer.clearDepth()
renderer.getViewport(this.viewport)
diff --git a/src/lib/processes/animations-listing/ModelVariationSwitcher.ts b/src/lib/processes/animations-listing/ModelVariationSwitcher.ts
index 451375a..1663c47 100644
--- a/src/lib/processes/animations-listing/ModelVariationSwitcher.ts
+++ b/src/lib/processes/animations-listing/ModelVariationSwitcher.ts
@@ -7,44 +7,29 @@ import { type SkeletonType } from '../../enums/SkeletonType'
import { VariationLicenseCatalog } from '../../VariationLicenseInfo'
/**
- * Manages the model variation selection on the "Explore" page.
+ * Manages the model variation list in the Explore page's left sidebar.
* When a rig type is selected that has model_variations in the asset manifest,
- * a button is shown that opens a confirmation dialog with image previews
- * and attribution for each variation. Otherwise the button is hidden.
+ * a card is shown for each one; clicking a card loads that model immediately.
+ * Rigs without variations show an "no alternate models" message instead.
*
- * The dialog HTML lives in index.html; this class populates and shows/hides it.
+ * The sidebar HTML lives in index.html; this class populates it.
* Loads the selected variation GLB and dispatches 'variation-changed'
* with the extracted SkinnedMesh[] so consumers can swap the model directly.
*/
export class ModelVariationSwitcher extends EventTarget {
-
- // Dialog related DOM elements for switching the model with a popup dialog
- private readonly dom_dialog_overlay: HTMLElement | null = document.querySelector('#variation-dialog-overlay')
+ private readonly dom_section: HTMLElement | null = document.querySelector('#variation-section')
private readonly dom_grid: HTMLElement | null = document.querySelector('#variation-grid')
- private readonly dom_dialog_confirm_button: HTMLButtonElement | null = document.querySelector('#variation-confirm-button')
- private readonly dom_dialog_cancel_button: HTMLButtonElement | null = document.querySelector('#variation-cancel-button')
-
- private readonly loader: GLTFLoader = new GLTFLoader()
- private current_rig: RigConfigEntry | undefined
- private added_event_listeners = false
- private _is_variation_active: boolean = false
- private confirmed_variation: ModelVariation | null = null // model we currently have loaded
- private pending_variation: ModelVariation | null = null // active selection (will be reset if user cancels out of dialog)
-
- // Loading progress bar elements within the dialog once confirmation happens. A few models are around 5MB which could take
- // a moment to load.
+ // A few models are around 5MB, so show progress while one loads.
private readonly dom_loading_container: HTMLElement | null = document.querySelector('#variation-loading-container')
private readonly dom_loading_bar: HTMLElement | null = document.querySelector('#variation-loading-bar')
private readonly dom_loading_text: HTMLElement | null = document.querySelector('#variation-loading-text')
- // UI elements on the explore page that show the currently selected variation's info. Used to populate current value.
- private readonly dom_switcher: HTMLElement | null = document.querySelector('#model-variation-switcher')
- private readonly dom_change_model_button: HTMLButtonElement | null = document.querySelector('#model-variation-button')
- private readonly dom_info_image: HTMLImageElement | null = document.querySelector('#model-variation-info-image')
- private readonly dom_info_name: HTMLElement | null = document.querySelector('#model-variation-info-name')
- private readonly dom_info_license: HTMLElement | null = document.querySelector('#model-variation-info-license')
- private readonly dom_info_attribution: HTMLElement | null = document.querySelector('#model-variation-info-attribution')
+ private readonly loader: GLTFLoader = new GLTFLoader()
+ private current_rig: RigConfigEntry | undefined
+ private _is_variation_active: boolean = false
+ private selected_variation: ModelVariation | null = null // model we currently have loaded
+ private load_request_id = 0 // lets a rig switch or newer click discard a stale load
public get is_variation_active (): boolean {
return this._is_variation_active
@@ -54,100 +39,42 @@ export class ModelVariationSwitcher extends EventTarget {
this._is_variation_active = value
}
- /**
- * Call this whenever the active rig type changes.
- * Shows the variation button if the rig has variations, otherwise hides it.
- */
+ /** Call this whenever the active rig type changes. */
public update_for_rig (skeleton_type: SkeletonType): void {
this.current_rig = RigConfig.by_skeleton_type(skeleton_type)
- this.update_button_visibility()
- this.add_event_listeners()
+ this.load_request_id++
+ this.hide_loading_progress()
- // select the first variation by default if variation selection doesn't exist
+ // the rig's default model (first variation) is what gets loaded on rig change
const variations = this.current_rig?.model_variations
- this.confirmed_variation = (variations !== undefined && variations.length > 0) ? variations[0] : null
- this.pending_variation = this.confirmed_variation
- this.update_active_model_info()
+ this.selected_variation = (variations !== undefined && variations.length > 0) ? variations[0] : null
+ this.populate_grid()
}
- /**
- * Updates the info section on the explore page to reflect the currently active variation.
- * If no variation is active, hides the info section.
- */
- private update_active_model_info (): void {
-
- // nothing selected for rig, or user cancelled out of dialog -> hide info section
- if (this.confirmed_variation === null) {
- if (this.dom_info_image !== null) this.dom_info_image.style.display = 'none'
- if (this.dom_info_name !== null) this.dom_info_name.textContent = ''
- if (this.dom_info_license !== null) {
- this.dom_info_license.textContent = ''
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- ;(this.dom_info_license as any)._tippy?.destroy()
- }
- return
- }
-
- // update image properties
- if (this.dom_info_image !== null) {
- this.dom_info_image.src = '../' + this.confirmed_variation.preview_image
- this.dom_info_image.alt = this.confirmed_variation.display_name
- this.dom_info_image.style.display = ''
- }
-
- // Update rig name
- if (this.dom_info_name !== null) {
- this.dom_info_name.textContent = this.confirmed_variation.display_name
- }
-
- // update license info
- if (this.dom_info_license !== null) {
- this.dom_info_license.textContent = this.confirmed_variation.license
- const license_description = VariationLicenseCatalog.get_license_info(this.confirmed_variation.license).description
- tippy(this.dom_info_license, { content: license_description, theme: 'mesh2motion' })
- }
+ private populate_grid (): void {
+ const grid = this.dom_grid
+ if (grid === null) return
- // update attribution
- if (this.dom_info_attribution !== null) {
- if (this.confirmed_variation.attribution !== 'None') {
- this.dom_info_attribution.textContent = this.confirmed_variation.attribution
- this.dom_info_attribution.style.display = ''
- } else {
- this.dom_info_attribution.textContent = ''
- this.dom_info_attribution.style.display = 'none'
- }
- }
- }
+ grid.innerHTML = ''
- private update_button_visibility (): void {
- const switcher = this.dom_switcher
- if (switcher === null) return
+ if (this.dom_section !== null) this.dom_section.style.display = '' // hidden in the HTML until the first rig loads
const variations = this.current_rig?.model_variations
if (variations === undefined || variations.length === 0) {
- switcher.style.display = 'none'
+ const empty_message = document.createElement('div')
+ empty_message.className = 'variation-empty-message'
+ empty_message.textContent = 'No alternate models for this rig.'
+ grid.appendChild(empty_message)
return
}
- switcher.style.display = '' // use default display style by removing inline style
- }
-
- private populate_grid (): void {
- const grid = this.dom_grid
- if (grid === null) return
-
- const variations = this.current_rig?.model_variations
- if (variations === undefined || variations.length === 0) return
-
- grid.innerHTML = '' // reset whatever was there before
-
- // show tiles alphabetically. Sort a copy so the rig's default (first) variation is unchanged
+ // Sort a copy so the rig's default (first) variation is unchanged
const sorted_variations = [...variations].sort((a, b) => a.display_name.localeCompare(b.display_name))
- // create tiles for each variation item
for (const variation of sorted_variations) {
const card = document.createElement('div')
card.className = 'variation-card'
+ card.dataset.variation = variation.name
const img = document.createElement('img')
img.src = '../' + variation.preview_image
@@ -155,62 +82,47 @@ export class ModelVariationSwitcher extends EventTarget {
img.className = 'variation-preview-image'
card.appendChild(img)
- const name_el = document.createElement('div')
- name_el.className = 'variation-name'
- name_el.textContent = variation.display_name
- card.appendChild(name_el)
+ card.title = variation.display_name // name isn't shown on the card
+
+ const details = document.createElement('div')
+ details.className = 'variation-details'
+ card.appendChild(details)
+
+ if (variation.attribution !== 'None') {
+ const attribution_el = document.createElement('div')
+ attribution_el.className = 'variation-attribution'
+ attribution_el.textContent = variation.attribution
+ details.appendChild(attribution_el)
+ }
const license_info = VariationLicenseCatalog.get_license_info(variation.license)
const license_chip = document.createElement('span')
license_chip.className = 'variation-license-chip'
license_chip.textContent = variation.license
- card.appendChild(license_chip)
+ details.appendChild(license_chip)
tippy(license_chip, {
content: `${variation.license}: ${license_info.description}`,
theme: 'mesh2motion',
- placement: 'top'
+ placement: 'right'
})
- if (variation.attribution !== 'None') {
- const attribution_el = document.createElement('div')
- attribution_el.className = 'variation-attribution'
- attribution_el.textContent = variation.attribution
- card.appendChild(attribution_el)
- }
-
- // add class for default selection
- if (this.pending_variation !== null && variation.name === this.pending_variation.name) {
- card.classList.add('selected')
- }
-
- card.addEventListener('click', () => {
- grid.querySelectorAll('.variation-card').forEach(c => c.classList.remove('selected'))
- card.classList.add('selected')
- this.pending_variation = variation
- if (this.dom_dialog_confirm_button !== null) this.dom_dialog_confirm_button.disabled = false
- })
+ card.classList.toggle('selected', variation.name === this.selected_variation?.name)
+ card.addEventListener('click', () => { this.select_variation(variation) })
grid.appendChild(card)
}
}
- private show_dialog (): void {
- if (this.dom_dialog_overlay === null) return
-
- this.pending_variation = this.confirmed_variation
-
- if (this.dom_dialog_confirm_button !== null) {
- this.dom_dialog_confirm_button.disabled = this.pending_variation === null
- }
+ private select_variation (variation: ModelVariation): void {
+ if (variation.name === this.selected_variation?.name) return
- this.populate_grid()
- this.dom_dialog_overlay.style.display = '' // reset to default styling
- }
+ this.selected_variation = variation
+ this.dom_grid?.querySelectorAll('.variation-card').forEach(card => {
+ card.classList.toggle('selected', (card as HTMLElement).dataset.variation === variation.name)
+ })
- private hide_dialog (): void {
- if (this.dom_dialog_overlay === null) return
- this.dom_dialog_overlay.style.display = 'none'
+ this.load_variation_model(variation.model_file, variation.expandArms, variation.pelvis_position_scale)
}
private show_loading_progress (): void {
@@ -225,8 +137,8 @@ export class ModelVariationSwitcher extends EventTarget {
}
private update_loading_progress (percent: number): void {
- // the progress callback from the GLTF loader can fire frequently and the DOM never 'repaints' with the new values
- // this forces the DOM to update the new progress bar values immediately.
+ // the GLTF loader fires progress often and the DOM won't repaint between calls,
+ // so push each update through requestAnimationFrame
requestAnimationFrame(() => {
if (this.dom_loading_bar !== null) this.dom_loading_bar.style.transform = `scaleX(${percent / 100})`
if (this.dom_loading_text !== null) this.dom_loading_text.textContent = `Loading model… ${Math.round(percent)}%`
@@ -234,13 +146,15 @@ export class ModelVariationSwitcher extends EventTarget {
}
private load_variation_model (model_file: string, expand_arms: number = 0, pelvis_position_scale: number = 1.0): void {
+ const request_id = ++this.load_request_id
this.show_loading_progress()
this.loader.load(
'../' + model_file,
(gltf) => {
+ if (request_id !== this.load_request_id) return
+
this.hide_loading_progress()
- this.hide_dialog()
const skinned_meshes: SkinnedMesh[] = []
gltf.scene.traverse((child) => {
@@ -258,46 +172,15 @@ export class ModelVariationSwitcher extends EventTarget {
}))
},
(progress: ProgressEvent<EventTarget>) => {
- if (progress.lengthComputable) {
- const percent = (progress.loaded / progress.total) * 100
- this.update_loading_progress(percent)
+ if (progress.lengthComputable && request_id === this.load_request_id) {
+ this.update_loading_progress((progress.loaded / progress.total) * 100)
}
},
(error: unknown) => {
// this should never happen since we are only using application files
console.error('Failed to load model variation:', model_file, error)
- this.hide_loading_progress()
- if (this.dom_dialog_confirm_button !== null) this.dom_dialog_confirm_button.disabled = false
+ if (request_id === this.load_request_id) this.hide_loading_progress()
}
)
}
-
- private add_event_listeners (): void {
- if (this.added_event_listeners) return
- this.added_event_listeners = true
-
- this.dom_switcher?.addEventListener('click', () => {
- this.show_dialog()
- })
-
- this.dom_dialog_cancel_button?.addEventListener('click', () => {
- this.hide_dialog()
- })
-
- // accept changes
- this.dom_dialog_confirm_button?.addEventListener('click', () => {
- if (this.pending_variation === null) return // this shouldn't happen, but leave for a safe guard
-
- this.confirmed_variation = this.pending_variation
- if (this.dom_dialog_confirm_button !== null) this.dom_dialog_confirm_button.disabled = true
- this.update_active_model_info()
- this.load_variation_model(this.confirmed_variation.model_file, this.confirmed_variation.expandArms,
- this.confirmed_variation.pelvis_position_scale)
- })
-
- // clicking on the overlay screen bg should also close/cancel the dialog
- this.dom_dialog_overlay?.addEventListener('click', (e) => {
- if (e.target === this.dom_dialog_overlay) this.hide_dialog()
- })
- }
}
diff --git a/src/marketing/MarketingBootstrap.ts b/src/marketing/MarketingBootstrap.ts
index 32e7476..ad891ad 100644
--- a/src/marketing/MarketingBootstrap.ts
+++ b/src/marketing/MarketingBootstrap.ts
@@ -22,8 +22,7 @@ export class MarketingBootstrap {
}
private change_active_skeleton (active_dom_button: HTMLElement): void {
- // remove the active classes from all buttons in .model-selection-section
- const model_buttons = document.querySelectorAll('.model-selection-section button')
+ const model_buttons = document.querySelectorAll('#skeleton-buttons button')
model_buttons.forEach((button) => {
button.classList.remove('active-button')
})
@@ -32,7 +31,7 @@ export class MarketingBootstrap {
}
public setup_model_buttons (): void {
- const model_section = document.querySelector('.model-selection-section')
+ const model_section = document.querySelector('#skeleton-buttons')
if (model_section === null) return
model_section.innerHTML = ''
diff --git a/src/marketing/marketing.css b/src/marketing/marketing.css
index 5505f7a..a621bf4 100644
--- a/src/marketing/marketing.css
+++ b/src/marketing/marketing.css
@@ -1,32 +1,65 @@
+/* Explore page left sidebar: skeleton buttons on top, model variations below */
+body.explore-page {
+ --explore-sidebar-width: 12.5rem;
+}
+
.model-selection-section {
- display: inline-flex;
+ display: flex;
flex-direction: column;
- left: 0;
- top: 3rem;
- gap: 0;
- margin: 1rem;
+ gap: 0.75rem;
position: fixed;
- z-index: 1; /* put it above the 3d gizmo if they overlap on small screen */
+ left: 0;
+ top: var(--navigation-height);
+ bottom: 0;
+ width: var(--explore-sidebar-width);
+ box-sizing: border-box;
+ padding: 0.75rem;
+ z-index: 1; /* above the 3d gizmo if they overlap on small screens */
+ background: radial-gradient(circle, var(--bg-alternate) 0%, var(--bg-primary) 100%);
+ box-shadow: 1px 1px 8px 0px var(--bg-primary);
+ border-right: 1px solid var(--bg-tertiary);
}
-.model-selection-section button:first-child {
+.sidebar-heading {
+ margin: 0;
+ text-align: center;
+ font-size: 0.85rem;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.08em;
+ opacity: 0.7;
+ flex-shrink: 0;
+}
+
+/* the sidebar's flex gap already spaces sections; keep each heading close to its own content */
+.sidebar-heading + #skeleton-buttons {
+ margin-top: -0.4rem;
+}
+
+#skeleton-buttons {
+ display: flex;
+ flex-direction: column;
+ flex-shrink: 0;
+}
+
+#skeleton-buttons button:first-child {
border-top-left-radius: 1rem;
border-top-right-radius: 1rem;
}
-.model-selection-section button:last-child {
+#skeleton-buttons button:last-child {
border-bottom-left-radius: 1rem;
border-bottom-right-radius: 1rem;
}
-.model-selection-section button {
- height: 3rem;
+#skeleton-buttons button {
+ height: 2.5rem;
background: none;
box-shadow: none;
border-radius: 0;
border: 1px solid var(--button-primary-bg);
background-color: var(--nav-background);
}
-.model-selection-section button:hover {
+#skeleton-buttons button:hover {
transform: scale(1.0);
background-color: var(--nav-active-item-bg);
}
@@ -35,53 +68,152 @@ button.active-button {
background-color: var(--button-primary-bg);
}
-/* model switcher styles on the explore page */
-#model-variation-switcher {
- display: flex;
- align-items: center;
- justify-content: space-between;
- cursor: pointer;
- border-radius: 8px;
- box-sizing: border-box;
- transition: background 0.15s;
- padding: 0;
+/* variation list takes the remaining sidebar height and scrolls on its own */
+#variation-section {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ gap: 0.35rem;
+}
+
+.variation-grid {
+ display: flex;
+ flex-direction: column;
+ gap: 0.25rem;
+ flex: 1;
+ min-height: 0;
+ overflow-y: auto;
+ overflow-x: hidden;
}
-#model-variation-switcher:hover {
- background: color-mix(in srgb, var(--text-alternate) 12%, var(--bg-primary));
+.variation-empty-message {
+ padding: 0.5rem;
+ text-align: center;
+ font-style: italic;
+ opacity: 0.7;
}
-#model-variation-info {
- display: flex;
- align-items: center;
- gap: 0.5rem;
+.variation-card {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 0.25rem;
+ border: 2px solid var(--border-color);
+ border-radius: 8px;
+ padding: 0.25rem;
+ cursor: pointer;
+ background: var(--bg-alternate);
+ transition: box-shadow 0.25s;
+ position: relative;
+ flex-shrink: 0; /* keep cards full height so the list scrolls instead of squashing them */
+ box-sizing: border-box;
+ max-width: 100%;
}
-#model-variation-info-image {
- width: 40px;
- height: 40px;
- border-radius: 6px;
- object-fit: cover;
- background: var(--bg-primary);
- filter: none !important;
+.variation-card:hover {
+ box-shadow: 0 0 0 2px var(--text-alternate);
}
-#model-variation-info-details {
- display: flex;
- flex-direction: column;
- gap: 0.15rem;
+.variation-card.selected {
+ box-shadow: 0 0 0 2px var(--text-primary);
}
-#model-variation-info-name {
- font-size: 1.1rem;
+.variation-preview-image {
+ width: 100%;
+ aspect-ratio: 1;
+ flex-shrink: 0;
+ object-fit: contain;
+ border-radius: 6px;
+ background: var(--bg-primary);
+ margin: 0;
+ filter: none !important; /* avoid inverting image like we do for icons in light mode */
}
-#model-variation-info-license {
- padding: 0.1rem 0.4rem;
- width: fit-content;
+/* credit (left) and license (right) overlaid on the bottom of the thumbnail */
+.variation-details {
+ position: absolute;
+ left: 0.6rem;
+ right: 0.6rem;
+ bottom: 0.6rem;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.3rem;
+ min-width: 0;
+ pointer-events: none; /* clicks fall through to the card; license chip re-enables for its tooltip */
}
-#model-variation-info-attribution {
- opacity: 0.7;
- font-size: 90%;
-}
\ No newline at end of file
+.variation-attribution {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ padding: 0.1rem 0.4rem;
+ border-radius: 4px;
+ font-size: 80%;
+ color: #fff;
+ background: rgba(0, 0, 0, 0.55);
+}
+
+.variation-license-chip {
+ flex-shrink: 0;
+ margin-left: auto; /* stay bottom-right even when there is no credit */
+ padding: 0.1rem 0.4rem;
+ border-radius: 4px;
+ background: rgba(0, 0, 0, 0.55);
+ color: #fff;
+ font-size: 80%;
+ pointer-events: auto;
+}
+.variation-license-chip:hover {
+ background: rgba(0, 0, 0, 0.8);
+}
+
+.variation-loading-container {
+ display: flex;
+ flex-direction: column;
+ flex-shrink: 0;
+ margin: 0;
+}
+
+.variation-loading-track {
+ width: 100%;
+ background: var(--bg-alternate);
+ border-radius: 4px;
+ overflow: hidden;
+ border: 1px solid var(--border-color);
+ display: flex;
+ flex-direction: row;
+ gap: 0.5rem;
+ align-items: center;
+}
+
+.variation-loading-bar {
+ flex: 1;
+ height: 100%;
+ background-color: var(--button-primary-bg);
+ border-radius: 4px;
+ transform: scaleX(0);
+ transform-origin: left center;
+ transition: transform 0.2s ease;
+ display: block;
+}
+
+.variation-loading-text {
+ color: var(--text-primary);
+ white-space: nowrap;
+ flex-shrink: 0;
+ font-size: 90%;
+}
+
+/* mouse hints, view gizmo and build version sit to the right of the sidebar */
+body.explore-page #header-ui,
+body.explore-page #view-control-hitbox,
+body.explore-page #build-version {
+ left: var(--explore-sidebar-width);
+}
+body.explore-page #header-ui {
+ margin-left: 5px;
+}