Spaces:
Running
Running
Add the bedroom, kitchen and garage scenes
Browse filesFiles changed (4)
- README.md+6
- app.js+33-18
- data/catalog.json
- index.html+2-2
41 unmodified lines42434445464748495051527 unmodified lines6061626364656641 unmodified lines- `tools/make_previews.py` makes `previews/<asset>.glb` (a small Draco GLB made with Blender from the USD, textures at 1024 px) and `previews/<asset>.json` (each hinge and slider: the part it moves, pivot, axis and range). Cached in `tools/preview_cache.json`.- Scenes (the **Scenes** group) come from the gated dataset [projectsim/scenes-and-worlds](https://huggingface.co/datasets/projectsim/scenes-and-worlds), listed in `tools/scenes.json`. `tools/make_scene_previews.py` downloads each scene's GLB and preview image (read only, needs an HF token with access) and writes a smaller GLB to `previews/scenes/` and a thumbnail to `previews/thumbs/`.- `tools/render_thumbs.py` renders `previews/thumbs/<asset>.webp`: 640 px studio thumbnails (Blender Cycles, transparent background, contact shadow) from the preview GLBs. It only renders missing or outdated ones.7 unmodified linescd simready-libraryHF_TOKEN=$(hf auth token) uv run tools/make_previews.pypython3 tools/render_thumbs.pyHF_TOKEN=$(hf auth token) uv run tools/make_scene_previews.py # only when scenes changeuv run tools/build_catalog.pyhf upload projectsim/simready-library . --repo-type space --commit-message "Update catalog"```15 unmodified lines16171819192021226 unmodified lines29303132323334353637383839404167 unmodified lines109110111112112113114115103 unmodified lines2192202212222232222232242252262272272282292301 unmodified line23223323423523523623723871 unmodified lines3103113123133143153163173183193203173183193203213223233243253263273283293303313323333343356 unmodified lines3423433443333453463473483373493503513523533543553563573453583593603613623493633643653663533673683693707 unmodified lines37837938038136738238338438515 unmodified linesconst FACETS = [ { key: "moving", title: "Moving parts", options: [ ["yes", "Has moving parts", (a) => a.joints.length > 0], ["no", "Rigid", (a) => a.joints.length === 0], ["no", "Rigid", (a) => a.joints.length === 0 && a.kind !== "scene"], ] }, { key: "joint", title: "Joint type", options: [ ["hinge", "Hinge", (a) => a.joints.some((j) => j.type === "hinge")],6 unmodified lines ["xl", "1.5 m +", (a) => maxDim(a) >= 1.5], ] }, { key: "mass", title: "Mass", options: [ ["xs", "< 100 g", (a) => a.mass < 0.1], ["xs", "< 100 g", (a) => a.mass != null && a.mass < 0.1], ["s", "100 g–1 kg", (a) => a.mass >= 0.1 && a.mass < 1], ["m", "1–10 kg", (a) => a.mass >= 1 && a.mass < 10], ["l", "10 kg +", (a) => a.mass >= 10], ] }, { key: "mount", title: "Placement", options: [ ["free", "Free-standing", (a) => !a.mounted], ["free", "Free-standing", (a) => !a.mounted && a.kind !== "scene"], ["fixed", "Mounted (fixed base)", (a) => a.mounted], ] },];67 unmodified lines// ---- filtering ----------------------------------------------------------------function matchesQuery(a, words) { if (!words.length) return true; const hay = a._hay || (a._hay = [a.id, a.name, a.class, a.category, a.group, ...a.joints.map((j) => `${j.name} ${j.type}`)] const hay = a._hay || (a._hay = [a.id, a.name, a.class, a.category, a.group, a.summary || "", ...a.joints.map((j) => `${j.name} ${j.type}`)] .join(" ").toLowerCase().replace(/_/g, " ")); return words.every((w) => hay.includes(w));}103 unmodified lines onclick: () => openAsset(a.id), "data-id": a.id, }, el("div", { class: "thumb" }, el("img", { src: thumbUrl(a, variant), alt: "", loading: "lazy", decoding: "async", width: 640, height: 640 }), el("div", { class: "badges" }, el("span", { class: "badge" }, el("img", { src: thumbUrl(a, variant), alt: "", loading: "lazy", decoding: "async", width: 640, height: 640, class: a.kind === "scene" ? "cover" : null }), el("div", { class: "badges" }, el("span", { class: "badge" }, a.kind === "scene" ? "scene" : a.joints.length ? `${a.joints.length} moving part${a.joints.length > 1 ? "s" : ""}` : "rigid"))), el("div", { class: "card-text" }, el("span", { class: "card-name" }, a.name), el("span", { class: "card-meta" }, `${cap(a.class || a.category)} · ${fmtMass(a.mass)}`)))))); el("span", { class: "card-meta" }, a.kind === "scene" ? `${a.objects} objects · ${fmtDims(a)}` : `${cap(a.class || a.category)} · ${fmtMass(a.mass)}`))))));}
// ---- detail + 3D viewer -------------------------------------------------------1 unmodified lineasync function getViewer() { if (viewer || viewerFailed) return viewer; try { const { createViewer } = await import(signed("./viewer.js?v=15")); const { createViewer } = await import(signed("./viewer.js?v=20")); viewer = createViewer(); viewer.setTheme(theme()); } catch (e) {71 unmodified lines } else { bar.append(el("span", { class: "hint" }, a.joints.length ? "Drag a part to move it · drag empty space to orbit · scroll to zoom · right-drag to pan" : a.kind === "scene" && !a.splat ? "Drag to look around · scroll to move in and out · right-drag to pan" : "Drag to orbit · scroll to zoom · right-drag to pan")); } if (bar.childNodes.length) box.append(bar);
const scene = a.kind === "scene"; const cmd = scene ? `hf download ${a.scene_dataset} --repo-type dataset --include "scenes/${a.scene}/*" --local-dir scenes-and-worlds` const cmd = `hf download ${DATA.dataset} --repo-type dataset --include "${a.id}/*" --local-dir simready-assets`; const folder = `${HF}/datasets/${DATA.dataset}/tree/main/${a.id}`; const usd = `${HF}/datasets/${DATA.dataset}/blob/main/${a.id}/simready_usd/${a.id}.usd`; const facts = [ : `hf download ${DATA.dataset} --repo-type dataset --include "${a.id}/*" --local-dir simready-assets`; const folder = scene ? `${HF}/datasets/${a.scene_dataset}/tree/main/scenes/${a.scene}` : `${HF}/datasets/${DATA.dataset}/tree/main/${a.id}`; const usd = scene ? `${HF}/datasets/${a.scene_dataset}` : `${HF}/datasets/${DATA.dataset}/blob/main/${a.id}/simready_usd/${a.id}.usd`; const facts = scene ? [ ["Type", "Indoor scene"], ["Dimensions", fmtDims(a)], ["Objects", `${a.objects}, each its own USD asset`], ["Triangles", a.triangles ? a.triangles.toLocaleString("en-US") : "—"], ["Backdrop", a.splat ? "Gaussian splat (USDZ) around the room" : "Modelled room, no splat"], ["Format", "OpenUSD scene for NVIDIA Isaac Sim, plus a GLB preview"], ["License", "CC BY 4.0 · credit “projectsim by Kaedim”"], ] : [ ["Class", a.qcode ? el("a", { href: `https://www.wikidata.org/wiki/${a.qcode}`, target: "_blank", rel: "noopener" }, `${a.class || a.qcode} (${a.qcode})`) : a.class], ["Category", `${a.group} › ${cap(a.category)}`], ["Dimensions", fmtDims(a)],6 unmodified lines ["License", "CC BY 4.0 · credit “projectsim by Kaedim”"], ["Version", a.version], ]; $("detail-body").replaceChildren( $("detail-body").replaceChildren(...[ el("div", {}, el("div", { class: "detail-head" }, el("h2", {}, a.name), el("button", { class: "icon-button", type: "button", "aria-label": "Close details", onclick: () => openAsset(null) }, icon(CROSS))), el("p", { class: "detail-sub" }, `${cap(a.class || a.category)} · ${partsLabel(a)}`)), el("p", { class: "detail-sub" }, scene ? a.summary : `${cap(a.class || a.category)} · ${partsLabel(a)}`)), box, a.joints.length ? el("section", {}, el("h3", { class: "section-title" }, "Moving parts"), jointList, jointActions) : null, el("dl", { class: "facts" }, facts.map(([k, v]) => [el("dt", {}, k), el("dd", {}, v ?? "—")])), el("section", { class: "actions" }, el("h3", { class: "section-title" }, "Get it"), scene ? el("p", { class: "note" }, "Free: log in to Hugging Face, answer 3 quick questions on the dataset page, then run hf auth login and this command.") : null, el("div", { class: "cmd" }, el("code", {}, cmd), copyButton(cmd)), el("div", { class: "btn-row" }, el("a", { class: "btn primary", href: folder, target: "_blank", rel: "noopener" }, "Open on Hugging Face"), el("a", { class: "btn", href: usd, target: "_blank", rel: "noopener" }, "USD file"), scene ? null : el("a", { class: "btn", href: usd, target: "_blank", rel: "noopener" }, "USD file"), copyButton(shareUrl(), "Copy link"))), el("section", { class: "more" }, el("p", {}, el("strong", {}, "Need many variations, or your own objects?")), el("p", {}, scene ? "projectsim generates sim-ready rooms and the objects in them at scale, with physics set up." el("p", {}, `projectsim generates sim-ready objects like this ${a.class || "asset"} at scale, with physics and moving parts set up.`), : `projectsim generates sim-ready objects like this ${a.class || "asset"} at scale, with physics and moving parts set up.`), el("div", { class: "btn-row" }, el("a", { class: "btn primary", href: API_DOCS, target: "_blank", rel: "noopener" }, "Generate with the API"), el("a", { class: "btn", href: "mailto:team@projectsim.ai" }, "team@projectsim.ai"))), ); ].filter(Boolean)); // replaceChildren() would print a null section as the text "null" $("detail-body").scrollTop = 0;
if (mode !== "3d") return;7 unmodified lines rig = rigState.map((r) => ({ ...r })); } else { loadedId = a.id; rig = scene ? await v.load(signed(`previews/scenes/${a.scene}.glb`), null, { interior: !a.splat, enclosed: !a.splat }) rig = await v.load(signed(`previews/${a.id}.glb`), signed(`previews/${a.id}.json`)); : await v.load(signed(`previews/${a.id}.glb`), signed(`previews/${a.id}.json`)); if (state.asset !== a.id) return; } if (rig.length) {7 unmodified lines8910111112131468 unmodified lines838485868687887 unmodified lines <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Fira+Code:wght@400;500&display=swap"> <link rel="stylesheet" href="style.css?v=15"> <link rel="stylesheet" href="style.css?v=20"> <script type="importmap"> { "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js",68 unmodified lines </aside> </div>
<script src="app.js?v=15"></script> <script src="app.js?v=20"></script></body></html>README.md+6
app.js+33-18
data/catalog.json
index.html+2-2