Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

better visibility on what rig is selected

Scott Petrovicaffff457a4e2
diff --git a/src/lib/RigConfig.ts b/src/lib/RigConfig.ts
index fe1d5b0..42954df 100644
--- a/src/lib/RigConfig.ts
+++ b/src/lib/RigConfig.ts
@@ -33,6 +33,9 @@ interface RigSettings {
preview_camera?: PreviewCamera
// keyed by the variation name in the asset manifest. Variations listed here are shown first, in this order
variations?: Record<string, VariationSettings>
+ // manifest variations to leave out of the app. The manifest is generated by the external assets repo,
+ // so it can't be edited here
+ excluded_variations?: string[]
}
export interface PreviewCamera {
@@ -122,7 +125,8 @@ const rig_settings: RigSettings[] = [
dog: { display_name: 'Dog' },
cat: { display_name: 'Carrot', attribution: 'David Revoy', license: 'CC-BY' },
panda: { display_name: 'Panda' }
- }
+ },
+ excluded_variations: ['horse'] // the Horse rig already covers this
},
{
skeleton_type: SkeletonType.Bird,
@@ -227,7 +231,9 @@ function create_variations (settings: RigSettings, manifest_rig: ManifestRig): M
}
// configured variations first in their configured order, then any others in manifest order
- const sorted = [...manifest_rig.variations].sort((a, b) => {
+ const excluded_names = settings.excluded_variations ?? []
+ const included = manifest_rig.variations.filter(v => !excluded_names.includes(v.name))
+ const sorted = included.sort((a, b) => {
const a_index = configured_names.indexOf(a.name)
const b_index = configured_names.indexOf(b.name)
return (a_index === -1 ? Infinity : a_index) - (b_index === -1 ? Infinity : b_index)
diff --git a/src/marketing/MarketingBootstrap.ts b/src/marketing/MarketingBootstrap.ts
index ad891ad..2635b86 100644
--- a/src/marketing/MarketingBootstrap.ts
+++ b/src/marketing/MarketingBootstrap.ts
@@ -25,9 +25,11 @@ export class MarketingBootstrap {
const model_buttons = document.querySelectorAll('#skeleton-buttons button')
model_buttons.forEach((button) => {
button.classList.remove('active-button')
+ button.setAttribute('aria-pressed', 'false')
})
active_dom_button.classList.add('active-button')
+ active_dom_button.setAttribute('aria-pressed', 'true')
}
public setup_model_buttons (): void {
diff --git a/src/marketing/marketing.css b/src/marketing/marketing.css
index b2c9b75..d04d046 100644
--- a/src/marketing/marketing.css
+++ b/src/marketing/marketing.css
@@ -56,7 +56,7 @@ body.explore-page {
background: none;
box-shadow: none;
border-radius: 0;
- border: 1px solid var(--button-primary-bg);
+ border: 1px solid var(--bg-tertiary); /* neutral so the selected rig's fill stands out */
background-color: var(--nav-background);
}
#skeleton-buttons button:hover {
@@ -64,8 +64,10 @@ body.explore-page {
background-color: var(--nav-active-item-bg);
}
-button.active-button {
- background-color: var(--button-primary-bg);
+/* selected rig: softened fill. Needs the id selector to beat '#skeleton-buttons button' above */
+#skeleton-buttons button.active-button,
+#skeleton-buttons button.active-button:hover {
+ background-color: color-mix(in srgb, var(--button-primary-bg) 55%, var(--nav-background));
}
/* variation list takes the remaining sidebar height and scrolls on its own */