Upload folder using huggingface_hub
Browse files- 6.0.0/model3D/Example.svelte +19 -0
- 6.0.0/model3D/Index.svelte +163 -0
- 6.0.0/model3D/package.json +54 -0
- 6.0.0/model3D/shared/Canvas3D.svelte +110 -0
- 6.0.0/model3D/shared/Canvas3DGS.svelte +102 -0
- 6.0.0/model3D/shared/Model3D.svelte +132 -0
- 6.0.0/model3D/shared/Model3DUpload.svelte +157 -0
- 6.0.0/model3D/types.ts +21 -0
6.0.0/model3D/Example.svelte
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
export let value: string | null;
|
| 3 |
+
export let type: "gallery" | "table";
|
| 4 |
+
export let selected = false;
|
| 5 |
+
</script>
|
| 6 |
+
|
| 7 |
+
<div
|
| 8 |
+
class:table={type === "table"}
|
| 9 |
+
class:gallery={type === "gallery"}
|
| 10 |
+
class:selected
|
| 11 |
+
>
|
| 12 |
+
{value ? value : ""}
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
<style>
|
| 16 |
+
.gallery {
|
| 17 |
+
padding: var(--size-1) var(--size-2);
|
| 18 |
+
}
|
| 19 |
+
</style>
|
6.0.0/model3D/Index.svelte
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script context="module" lang="ts">
|
| 2 |
+
export { default as BaseModel3D } from "./shared/Model3D.svelte";
|
| 3 |
+
export { default as BaseModel3DUpload } from "./shared/Model3DUpload.svelte";
|
| 4 |
+
export { default as BaseExample } from "./Example.svelte";
|
| 5 |
+
</script>
|
| 6 |
+
|
| 7 |
+
<script lang="ts">
|
| 8 |
+
import { tick } from "svelte";
|
| 9 |
+
import type { Model3DProps, Model3DEvents } from "./types";
|
| 10 |
+
import type { FileData } from "@gradio/client";
|
| 11 |
+
import { Gradio } from "@gradio/utils";
|
| 12 |
+
import Model3D from "./shared/Model3D.svelte";
|
| 13 |
+
import Model3DUpload from "./shared/Model3DUpload.svelte";
|
| 14 |
+
import { BlockLabel, Block, Empty, UploadText } from "@gradio/atoms";
|
| 15 |
+
import { File } from "@gradio/icons";
|
| 16 |
+
import { StatusTracker } from "@gradio/statustracker";
|
| 17 |
+
|
| 18 |
+
class Model3dGradio extends Gradio<Model3DEvents, Model3DProps> {
|
| 19 |
+
async get_data() {
|
| 20 |
+
if (upload_promise) {
|
| 21 |
+
await upload_promise;
|
| 22 |
+
await tick();
|
| 23 |
+
}
|
| 24 |
+
const data = await super.get_data();
|
| 25 |
+
|
| 26 |
+
return data;
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
const props = $props();
|
| 31 |
+
const gradio = new Model3dGradio(props);
|
| 32 |
+
|
| 33 |
+
let old_value = $state(gradio.props.value);
|
| 34 |
+
let uploading = $state(false);
|
| 35 |
+
let dragging = $state(false);
|
| 36 |
+
let has_change_history = $state(false);
|
| 37 |
+
let upload_promise = $state<Promise<any>>();
|
| 38 |
+
|
| 39 |
+
const is_browser = typeof window !== "undefined";
|
| 40 |
+
|
| 41 |
+
$effect(() => {
|
| 42 |
+
if (old_value !== gradio.props.value) {
|
| 43 |
+
old_value = gradio.props.value;
|
| 44 |
+
gradio.dispatch("change");
|
| 45 |
+
}
|
| 46 |
+
});
|
| 47 |
+
|
| 48 |
+
function handle_change(detail: FileData | null) {
|
| 49 |
+
gradio.props.value = detail;
|
| 50 |
+
gradio.dispatch("change", detail);
|
| 51 |
+
has_change_history = true;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
function handle_drag(detail: boolean) {
|
| 55 |
+
dragging = detail;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
function handle_clear() {
|
| 59 |
+
gradio.props.value = null;
|
| 60 |
+
gradio.dispatch("clear");
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function handle_load(detail: FileData) {
|
| 64 |
+
gradio.props.value = detail;
|
| 65 |
+
gradio.dispatch("upload");
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
function handle_error(detail: string) {
|
| 69 |
+
if (gradio.shared.loading_status)
|
| 70 |
+
gradio.shared.loading_status.status = "error";
|
| 71 |
+
gradio.dispatch("error", detail);
|
| 72 |
+
}
|
| 73 |
+
</script>
|
| 74 |
+
|
| 75 |
+
{#if !gradio.shared.interactive}
|
| 76 |
+
<Block
|
| 77 |
+
visible={gradio.shared.visible}
|
| 78 |
+
variant={gradio.props.value === null ? "dashed" : "solid"}
|
| 79 |
+
border_mode={dragging ? "focus" : "base"}
|
| 80 |
+
padding={false}
|
| 81 |
+
elem_id={gradio.shared.elem_id}
|
| 82 |
+
elem_classes={gradio.shared.elem_classes}
|
| 83 |
+
container={gradio.shared.container}
|
| 84 |
+
scale={gradio.shared.scale}
|
| 85 |
+
min_width={gradio.shared.min_width}
|
| 86 |
+
height={gradio.props.height}
|
| 87 |
+
>
|
| 88 |
+
<StatusTracker
|
| 89 |
+
autoscroll={gradio.shared.autoscroll}
|
| 90 |
+
i18n={gradio.i18n}
|
| 91 |
+
{...gradio.shared.loading_status}
|
| 92 |
+
on_clear_status={() =>
|
| 93 |
+
gradio.dispatch("clear_status", gradio.shared.loading_status)}
|
| 94 |
+
/>
|
| 95 |
+
|
| 96 |
+
{#if gradio.props.value && is_browser}
|
| 97 |
+
<Model3D
|
| 98 |
+
value={gradio.props.value}
|
| 99 |
+
i18n={gradio.i18n}
|
| 100 |
+
display_mode={gradio.props.display_mode}
|
| 101 |
+
clear_color={gradio.props.clear_color}
|
| 102 |
+
label={gradio.shared.label}
|
| 103 |
+
show_label={gradio.shared.show_label}
|
| 104 |
+
camera_position={gradio.props.camera_position}
|
| 105 |
+
zoom_speed={gradio.props.zoom_speed}
|
| 106 |
+
{has_change_history}
|
| 107 |
+
/>
|
| 108 |
+
{:else}
|
| 109 |
+
<BlockLabel
|
| 110 |
+
show_label={gradio.shared.show_label}
|
| 111 |
+
Icon={File}
|
| 112 |
+
label={gradio.shared.label || "3D Model"}
|
| 113 |
+
/>
|
| 114 |
+
|
| 115 |
+
<Empty unpadded_box={true} size="large"><File /></Empty>
|
| 116 |
+
{/if}
|
| 117 |
+
</Block>
|
| 118 |
+
{:else}
|
| 119 |
+
<Block
|
| 120 |
+
visible={gradio.shared.visible}
|
| 121 |
+
variant={gradio.props.value === null ? "dashed" : "solid"}
|
| 122 |
+
border_mode={dragging ? "focus" : "base"}
|
| 123 |
+
padding={false}
|
| 124 |
+
elem_id={gradio.shared.elem_id}
|
| 125 |
+
elem_classes={gradio.shared.elem_classes}
|
| 126 |
+
container={gradio.shared.container}
|
| 127 |
+
scale={gradio.shared.scale}
|
| 128 |
+
min_width={gradio.shared.min_width}
|
| 129 |
+
height={gradio.props.height}
|
| 130 |
+
>
|
| 131 |
+
<StatusTracker
|
| 132 |
+
autoscroll={gradio.shared.autoscroll}
|
| 133 |
+
i18n={gradio.i18n}
|
| 134 |
+
{...gradio.shared.loading_status}
|
| 135 |
+
on_clear_status={() =>
|
| 136 |
+
gradio.dispatch("clear_status", gradio.shared.loading_status)}
|
| 137 |
+
/>
|
| 138 |
+
|
| 139 |
+
<Model3DUpload
|
| 140 |
+
bind:upload_promise
|
| 141 |
+
label={gradio.shared.label}
|
| 142 |
+
show_label={gradio.shared.show_label}
|
| 143 |
+
root={gradio.shared.root}
|
| 144 |
+
display_mode={gradio.props.display_mode}
|
| 145 |
+
clear_color={gradio.props.clear_color}
|
| 146 |
+
value={gradio.props.value}
|
| 147 |
+
camera_position={gradio.props.camera_position}
|
| 148 |
+
zoom_speed={gradio.props.zoom_speed}
|
| 149 |
+
bind:uploading
|
| 150 |
+
on:change={({ detail }) => handle_change(detail)}
|
| 151 |
+
on:drag={({ detail }) => handle_drag(detail)}
|
| 152 |
+
on:clear={handle_clear}
|
| 153 |
+
on:load={({ detail }) => handle_load(detail)}
|
| 154 |
+
on:error={({ detail }) => handle_error(detail)}
|
| 155 |
+
i18n={gradio.i18n}
|
| 156 |
+
max_file_size={gradio.shared.max_file_size}
|
| 157 |
+
upload={(...args) => gradio.shared.client.upload(...args)}
|
| 158 |
+
stream_handler={(...args) => gradio.shared.client.stream(...args)}
|
| 159 |
+
>
|
| 160 |
+
<UploadText i18n={gradio.i18n} type="file" />
|
| 161 |
+
</Model3DUpload>
|
| 162 |
+
</Block>
|
| 163 |
+
{/if}
|
6.0.0/model3D/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/model3d",
|
| 3 |
+
"version": "0.15.1",
|
| 4 |
+
"description": "Gradio UI packages",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"author": "",
|
| 7 |
+
"license": "ISC",
|
| 8 |
+
"private": false,
|
| 9 |
+
"dependencies": {
|
| 10 |
+
"@babylonjs/core": "^8.30.5",
|
| 11 |
+
"@babylonjs/loaders": "^8.30.5",
|
| 12 |
+
"@babylonjs/viewer": "^8.30.5",
|
| 13 |
+
"@gradio/atoms": "workspace:^",
|
| 14 |
+
"@gradio/client": "workspace:^",
|
| 15 |
+
"@gradio/icons": "workspace:^",
|
| 16 |
+
"@gradio/statustracker": "workspace:^",
|
| 17 |
+
"@gradio/upload": "workspace:^",
|
| 18 |
+
"@gradio/utils": "workspace:^",
|
| 19 |
+
"@types/babylon": "^6.16.9",
|
| 20 |
+
"dequal": "^2.0.3",
|
| 21 |
+
"gsplat": "^1.2.9"
|
| 22 |
+
},
|
| 23 |
+
"devDependencies": {
|
| 24 |
+
"@gradio/preview": "workspace:^"
|
| 25 |
+
},
|
| 26 |
+
"main_changeset": true,
|
| 27 |
+
"main": "./Index.svelte",
|
| 28 |
+
"exports": {
|
| 29 |
+
".": {
|
| 30 |
+
"gradio": "./Index.svelte",
|
| 31 |
+
"svelte": "./dist/Index.svelte",
|
| 32 |
+
"types": "./dist/Index.svelte.d.ts"
|
| 33 |
+
},
|
| 34 |
+
"./example": {
|
| 35 |
+
"gradio": "./Example.svelte",
|
| 36 |
+
"svelte": "./dist/Example.svelte",
|
| 37 |
+
"types": "./dist/Example.svelte.d.ts"
|
| 38 |
+
},
|
| 39 |
+
"./base": {
|
| 40 |
+
"gradio": "./shared/Model3D.svelte",
|
| 41 |
+
"svelte": "./dist/shared/Model3D.svelte",
|
| 42 |
+
"types": "./dist/shared/Model3D.svelte.d.ts"
|
| 43 |
+
},
|
| 44 |
+
"./package.json": "./package.json"
|
| 45 |
+
},
|
| 46 |
+
"peerDependencies": {
|
| 47 |
+
"svelte": "^5.43.4"
|
| 48 |
+
},
|
| 49 |
+
"repository": {
|
| 50 |
+
"type": "git",
|
| 51 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 52 |
+
"directory": "js/model3D"
|
| 53 |
+
}
|
| 54 |
+
}
|
6.0.0/model3D/shared/Canvas3D.svelte
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { onMount } from "svelte";
|
| 3 |
+
import type { FileData } from "@gradio/client";
|
| 4 |
+
import type { Viewer, ViewerDetails } from "@babylonjs/viewer";
|
| 5 |
+
|
| 6 |
+
let BABYLON_VIEWER: typeof import("@babylonjs/viewer");
|
| 7 |
+
|
| 8 |
+
export let value: FileData;
|
| 9 |
+
export let display_mode: "solid" | "point_cloud" | "wireframe";
|
| 10 |
+
export let clear_color: [number, number, number, number];
|
| 11 |
+
export let camera_position: [number | null, number | null, number | null];
|
| 12 |
+
export let zoom_speed: number;
|
| 13 |
+
export let pan_speed: number;
|
| 14 |
+
|
| 15 |
+
$: url = value.url;
|
| 16 |
+
|
| 17 |
+
let canvas: HTMLCanvasElement;
|
| 18 |
+
let viewer: Viewer;
|
| 19 |
+
let viewerDetails: Readonly<ViewerDetails>;
|
| 20 |
+
let mounted = false;
|
| 21 |
+
|
| 22 |
+
onMount(() => {
|
| 23 |
+
const initViewer = async (): Promise<void> => {
|
| 24 |
+
BABYLON_VIEWER = await import("@babylonjs/viewer");
|
| 25 |
+
BABYLON_VIEWER.CreateViewerForCanvas(canvas, {
|
| 26 |
+
clearColor: clear_color,
|
| 27 |
+
useRightHandedSystem: true,
|
| 28 |
+
animationAutoPlay: true,
|
| 29 |
+
cameraAutoOrbit: { enabled: false },
|
| 30 |
+
onInitialized: (details: any) => {
|
| 31 |
+
viewerDetails = details;
|
| 32 |
+
}
|
| 33 |
+
}).then((promiseViewer: any) => {
|
| 34 |
+
viewer = promiseViewer;
|
| 35 |
+
mounted = true;
|
| 36 |
+
});
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
initViewer();
|
| 40 |
+
|
| 41 |
+
return () => {
|
| 42 |
+
viewer?.dispose();
|
| 43 |
+
};
|
| 44 |
+
});
|
| 45 |
+
|
| 46 |
+
$: mounted && load_model(url);
|
| 47 |
+
|
| 48 |
+
function setRenderingMode(pointsCloud: boolean, wireframe: boolean): void {
|
| 49 |
+
viewerDetails.scene.forcePointsCloud = pointsCloud;
|
| 50 |
+
viewerDetails.scene.forceWireframe = wireframe;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
function load_model(url: string | undefined): void {
|
| 54 |
+
if (viewer) {
|
| 55 |
+
if (url) {
|
| 56 |
+
viewer
|
| 57 |
+
.loadModel(url, {
|
| 58 |
+
pluginOptions: {
|
| 59 |
+
obj: {
|
| 60 |
+
importVertexColors: true
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
})
|
| 64 |
+
.then(() => {
|
| 65 |
+
if (display_mode === "point_cloud") {
|
| 66 |
+
setRenderingMode(true, false);
|
| 67 |
+
} else if (display_mode === "wireframe") {
|
| 68 |
+
setRenderingMode(false, true);
|
| 69 |
+
} else {
|
| 70 |
+
update_camera(camera_position, zoom_speed, pan_speed);
|
| 71 |
+
}
|
| 72 |
+
});
|
| 73 |
+
} else {
|
| 74 |
+
viewer.resetModel();
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
export function update_camera(
|
| 80 |
+
camera_position: [number | null, number | null, number | null],
|
| 81 |
+
zoom_speed: number,
|
| 82 |
+
pan_speed: number
|
| 83 |
+
): void {
|
| 84 |
+
const camera = viewerDetails.camera;
|
| 85 |
+
if (camera_position[0] !== null) {
|
| 86 |
+
camera.alpha = (camera_position[0] * Math.PI) / 180;
|
| 87 |
+
}
|
| 88 |
+
if (camera_position[1] !== null) {
|
| 89 |
+
camera.beta = (camera_position[1] * Math.PI) / 180;
|
| 90 |
+
}
|
| 91 |
+
if (camera_position[2] !== null) {
|
| 92 |
+
camera.radius = camera_position[2];
|
| 93 |
+
}
|
| 94 |
+
camera.lowerRadiusLimit = 0.1;
|
| 95 |
+
const updateCameraSensibility = (): void => {
|
| 96 |
+
camera.wheelPrecision = 250 / (camera.radius * zoom_speed);
|
| 97 |
+
camera.panningSensibility = (10000 * pan_speed) / camera.radius;
|
| 98 |
+
};
|
| 99 |
+
updateCameraSensibility();
|
| 100 |
+
camera.onAfterCheckInputsObservable.add(updateCameraSensibility);
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
export function reset_camera_position(): void {
|
| 104 |
+
if (viewerDetails) {
|
| 105 |
+
viewer.resetCamera();
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
</script>
|
| 109 |
+
|
| 110 |
+
<canvas bind:this={canvas}></canvas>
|
6.0.0/model3D/shared/Canvas3DGS.svelte
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { onMount } from "svelte";
|
| 3 |
+
import * as SPLAT from "gsplat";
|
| 4 |
+
import type { FileData } from "@gradio/client";
|
| 5 |
+
|
| 6 |
+
export let value: FileData;
|
| 7 |
+
export let zoom_speed: number;
|
| 8 |
+
export let pan_speed: number;
|
| 9 |
+
|
| 10 |
+
$: url = value.url;
|
| 11 |
+
|
| 12 |
+
let canvas: HTMLCanvasElement;
|
| 13 |
+
let scene: SPLAT.Scene;
|
| 14 |
+
let camera: SPLAT.Camera;
|
| 15 |
+
let renderer: SPLAT.WebGLRenderer | null = null;
|
| 16 |
+
let controls: SPLAT.OrbitControls;
|
| 17 |
+
let mounted = false;
|
| 18 |
+
let frameId: number | null = null;
|
| 19 |
+
|
| 20 |
+
function reset_scene(): void {
|
| 21 |
+
if (frameId !== null) {
|
| 22 |
+
cancelAnimationFrame(frameId);
|
| 23 |
+
frameId = null;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
if (renderer !== null) {
|
| 27 |
+
renderer.dispose();
|
| 28 |
+
renderer = null;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
scene = new SPLAT.Scene();
|
| 32 |
+
camera = new SPLAT.Camera();
|
| 33 |
+
renderer = new SPLAT.WebGLRenderer(canvas);
|
| 34 |
+
controls = new SPLAT.OrbitControls(camera, canvas);
|
| 35 |
+
controls.zoomSpeed = zoom_speed;
|
| 36 |
+
controls.panSpeed = pan_speed;
|
| 37 |
+
|
| 38 |
+
if (!value) {
|
| 39 |
+
return;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
let loading = false;
|
| 43 |
+
const load = async (): Promise<void> => {
|
| 44 |
+
if (loading) {
|
| 45 |
+
console.error("Already loading");
|
| 46 |
+
return;
|
| 47 |
+
}
|
| 48 |
+
if (!url) {
|
| 49 |
+
throw new Error("No resolved URL");
|
| 50 |
+
}
|
| 51 |
+
loading = true;
|
| 52 |
+
if (url.endsWith(".ply")) {
|
| 53 |
+
await SPLAT.PLYLoader.LoadAsync(url, scene, undefined);
|
| 54 |
+
} else if (url.endsWith(".splat")) {
|
| 55 |
+
await SPLAT.Loader.LoadAsync(url, scene, undefined);
|
| 56 |
+
} else {
|
| 57 |
+
throw new Error("Unsupported file type");
|
| 58 |
+
}
|
| 59 |
+
loading = false;
|
| 60 |
+
};
|
| 61 |
+
|
| 62 |
+
const frame = (): void => {
|
| 63 |
+
if (!renderer) {
|
| 64 |
+
return;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
if (loading) {
|
| 68 |
+
frameId = requestAnimationFrame(frame);
|
| 69 |
+
return;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
controls.update();
|
| 73 |
+
renderer.render(scene, camera);
|
| 74 |
+
|
| 75 |
+
frameId = requestAnimationFrame(frame);
|
| 76 |
+
};
|
| 77 |
+
|
| 78 |
+
load();
|
| 79 |
+
frameId = requestAnimationFrame(frame);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
onMount(() => {
|
| 83 |
+
if (value != null) {
|
| 84 |
+
reset_scene();
|
| 85 |
+
}
|
| 86 |
+
mounted = true;
|
| 87 |
+
|
| 88 |
+
return () => {
|
| 89 |
+
if (renderer) {
|
| 90 |
+
renderer.dispose();
|
| 91 |
+
}
|
| 92 |
+
};
|
| 93 |
+
});
|
| 94 |
+
|
| 95 |
+
$: ({ path } = value || {
|
| 96 |
+
path: undefined
|
| 97 |
+
});
|
| 98 |
+
|
| 99 |
+
$: canvas && mounted && path && reset_scene();
|
| 100 |
+
</script>
|
| 101 |
+
|
| 102 |
+
<canvas bind:this={canvas}></canvas>
|
6.0.0/model3D/shared/Model3D.svelte
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import type { FileData } from "@gradio/client";
|
| 3 |
+
import { BlockLabel, IconButton, IconButtonWrapper } from "@gradio/atoms";
|
| 4 |
+
import { File, Download, Undo } from "@gradio/icons";
|
| 5 |
+
import type { I18nFormatter } from "@gradio/utils";
|
| 6 |
+
import { dequal } from "dequal";
|
| 7 |
+
import type Canvas3DGS from "./Canvas3DGS.svelte";
|
| 8 |
+
import type Canvas3D from "./Canvas3D.svelte";
|
| 9 |
+
|
| 10 |
+
export let value: FileData | null;
|
| 11 |
+
export let display_mode: "solid" | "point_cloud" | "wireframe" = "solid";
|
| 12 |
+
export let clear_color: [number, number, number, number] = [0, 0, 0, 0];
|
| 13 |
+
export let label = "";
|
| 14 |
+
export let show_label: boolean;
|
| 15 |
+
export let i18n: I18nFormatter;
|
| 16 |
+
export let zoom_speed = 1;
|
| 17 |
+
export let pan_speed = 1;
|
| 18 |
+
// alpha, beta, radius
|
| 19 |
+
export let camera_position: [number | null, number | null, number | null] = [
|
| 20 |
+
null,
|
| 21 |
+
null,
|
| 22 |
+
null
|
| 23 |
+
];
|
| 24 |
+
export let has_change_history = false;
|
| 25 |
+
|
| 26 |
+
let current_settings = { camera_position, zoom_speed, pan_speed };
|
| 27 |
+
|
| 28 |
+
let use_3dgs = false;
|
| 29 |
+
let Canvas3DGSComponent: typeof Canvas3DGS;
|
| 30 |
+
let Canvas3DComponent: typeof Canvas3D;
|
| 31 |
+
async function loadCanvas3D(): Promise<typeof Canvas3D> {
|
| 32 |
+
const module = await import("./Canvas3D.svelte");
|
| 33 |
+
return module.default;
|
| 34 |
+
}
|
| 35 |
+
async function loadCanvas3DGS(): Promise<typeof Canvas3DGS> {
|
| 36 |
+
const module = await import("./Canvas3DGS.svelte");
|
| 37 |
+
return module.default;
|
| 38 |
+
}
|
| 39 |
+
$: if (value) {
|
| 40 |
+
use_3dgs = value.path.endsWith(".splat") || value.path.endsWith(".ply");
|
| 41 |
+
if (use_3dgs) {
|
| 42 |
+
loadCanvas3DGS().then((component) => {
|
| 43 |
+
Canvas3DGSComponent = component;
|
| 44 |
+
});
|
| 45 |
+
} else {
|
| 46 |
+
loadCanvas3D().then((component) => {
|
| 47 |
+
Canvas3DComponent = component;
|
| 48 |
+
});
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
let canvas3d: Canvas3D | undefined;
|
| 53 |
+
function handle_undo(): void {
|
| 54 |
+
canvas3d?.reset_camera_position();
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
$: {
|
| 58 |
+
if (
|
| 59 |
+
!dequal(current_settings.camera_position, camera_position) ||
|
| 60 |
+
current_settings.zoom_speed !== zoom_speed ||
|
| 61 |
+
current_settings.pan_speed !== pan_speed
|
| 62 |
+
) {
|
| 63 |
+
canvas3d?.update_camera(camera_position, zoom_speed, pan_speed);
|
| 64 |
+
current_settings = { camera_position, zoom_speed, pan_speed };
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
</script>
|
| 68 |
+
|
| 69 |
+
<BlockLabel
|
| 70 |
+
{show_label}
|
| 71 |
+
Icon={File}
|
| 72 |
+
label={label || i18n("3D_model.3d_model")}
|
| 73 |
+
/>
|
| 74 |
+
{#if value}
|
| 75 |
+
<div class="model3D" data-testid="model3d">
|
| 76 |
+
<IconButtonWrapper>
|
| 77 |
+
{#if !use_3dgs}
|
| 78 |
+
<!-- Canvas3DGS doesn't implement the undo method (reset_camera_position) -->
|
| 79 |
+
<IconButton
|
| 80 |
+
Icon={Undo}
|
| 81 |
+
label="Undo"
|
| 82 |
+
on:click={() => handle_undo()}
|
| 83 |
+
disabled={!has_change_history}
|
| 84 |
+
/>
|
| 85 |
+
{/if}
|
| 86 |
+
<a
|
| 87 |
+
href={value.url}
|
| 88 |
+
target={window.__is_colab__ ? "_blank" : null}
|
| 89 |
+
download={window.__is_colab__ ? null : value.orig_name || value.path}
|
| 90 |
+
>
|
| 91 |
+
<IconButton Icon={Download} label={i18n("common.download")} />
|
| 92 |
+
</a>
|
| 93 |
+
</IconButtonWrapper>
|
| 94 |
+
|
| 95 |
+
{#if use_3dgs}
|
| 96 |
+
<svelte:component
|
| 97 |
+
this={Canvas3DGSComponent}
|
| 98 |
+
{value}
|
| 99 |
+
{zoom_speed}
|
| 100 |
+
{pan_speed}
|
| 101 |
+
/>
|
| 102 |
+
{:else}
|
| 103 |
+
<svelte:component
|
| 104 |
+
this={Canvas3DComponent}
|
| 105 |
+
bind:this={canvas3d}
|
| 106 |
+
{value}
|
| 107 |
+
{display_mode}
|
| 108 |
+
{clear_color}
|
| 109 |
+
{camera_position}
|
| 110 |
+
{zoom_speed}
|
| 111 |
+
{pan_speed}
|
| 112 |
+
/>
|
| 113 |
+
{/if}
|
| 114 |
+
</div>
|
| 115 |
+
{/if}
|
| 116 |
+
|
| 117 |
+
<style>
|
| 118 |
+
.model3D {
|
| 119 |
+
display: flex;
|
| 120 |
+
position: relative;
|
| 121 |
+
width: var(--size-full);
|
| 122 |
+
height: var(--size-full);
|
| 123 |
+
border-radius: var(--block-radius);
|
| 124 |
+
overflow: hidden;
|
| 125 |
+
}
|
| 126 |
+
.model3D :global(canvas) {
|
| 127 |
+
width: var(--size-full);
|
| 128 |
+
height: var(--size-full);
|
| 129 |
+
object-fit: contain;
|
| 130 |
+
overflow: hidden;
|
| 131 |
+
}
|
| 132 |
+
</style>
|
6.0.0/model3D/shared/Model3DUpload.svelte
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { createEventDispatcher, tick } from "svelte";
|
| 3 |
+
import { Upload, ModifyUpload } from "@gradio/upload";
|
| 4 |
+
import type { FileData, Client } from "@gradio/client";
|
| 5 |
+
import { BlockLabel } from "@gradio/atoms";
|
| 6 |
+
import { File } from "@gradio/icons";
|
| 7 |
+
import type { I18nFormatter } from "@gradio/utils";
|
| 8 |
+
import type Canvas3DGS from "./Canvas3DGS.svelte";
|
| 9 |
+
import type Canvas3D from "./Canvas3D.svelte";
|
| 10 |
+
|
| 11 |
+
export let value: null | FileData;
|
| 12 |
+
export let display_mode: "solid" | "point_cloud" | "wireframe" = "solid";
|
| 13 |
+
export let clear_color: [number, number, number, number] = [0, 0, 0, 0];
|
| 14 |
+
export let label = "";
|
| 15 |
+
export let show_label: boolean;
|
| 16 |
+
export let root: string;
|
| 17 |
+
export let i18n: I18nFormatter;
|
| 18 |
+
export let zoom_speed = 1;
|
| 19 |
+
export let pan_speed = 1;
|
| 20 |
+
export let max_file_size: number | null = null;
|
| 21 |
+
export let uploading = false;
|
| 22 |
+
export let upload_promise: Promise<(FileData | null)[]> | null = null;
|
| 23 |
+
|
| 24 |
+
// alpha, beta, radius
|
| 25 |
+
export let camera_position: [number | null, number | null, number | null] = [
|
| 26 |
+
null,
|
| 27 |
+
null,
|
| 28 |
+
null
|
| 29 |
+
];
|
| 30 |
+
export let upload: Client["upload"];
|
| 31 |
+
export let stream_handler: Client["stream"];
|
| 32 |
+
|
| 33 |
+
async function handle_upload({
|
| 34 |
+
detail
|
| 35 |
+
}: CustomEvent<FileData>): Promise<void> {
|
| 36 |
+
value = detail;
|
| 37 |
+
await tick();
|
| 38 |
+
dispatch("change", value);
|
| 39 |
+
dispatch("load", value);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
async function handle_clear(): Promise<void> {
|
| 43 |
+
value = null;
|
| 44 |
+
await tick();
|
| 45 |
+
dispatch("clear");
|
| 46 |
+
dispatch("change");
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
let use_3dgs = false;
|
| 50 |
+
let Canvas3DGSComponent: typeof Canvas3DGS;
|
| 51 |
+
let Canvas3DComponent: typeof Canvas3D;
|
| 52 |
+
async function loadCanvas3D(): Promise<typeof Canvas3D> {
|
| 53 |
+
const module = await import("./Canvas3D.svelte");
|
| 54 |
+
return module.default;
|
| 55 |
+
}
|
| 56 |
+
async function loadCanvas3DGS(): Promise<typeof Canvas3DGS> {
|
| 57 |
+
const module = await import("./Canvas3DGS.svelte");
|
| 58 |
+
return module.default;
|
| 59 |
+
}
|
| 60 |
+
$: if (value) {
|
| 61 |
+
use_3dgs = value.path.endsWith(".splat") || value.path.endsWith(".ply");
|
| 62 |
+
if (use_3dgs) {
|
| 63 |
+
loadCanvas3DGS().then((component) => {
|
| 64 |
+
Canvas3DGSComponent = component;
|
| 65 |
+
});
|
| 66 |
+
} else {
|
| 67 |
+
loadCanvas3D().then((component) => {
|
| 68 |
+
Canvas3DComponent = component;
|
| 69 |
+
});
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
let canvas3d: Canvas3D | undefined;
|
| 74 |
+
async function handle_undo(): Promise<void> {
|
| 75 |
+
canvas3d?.reset_camera_position();
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
const dispatch = createEventDispatcher<{
|
| 79 |
+
change: FileData | null;
|
| 80 |
+
clear: undefined;
|
| 81 |
+
drag: boolean;
|
| 82 |
+
load: FileData;
|
| 83 |
+
}>();
|
| 84 |
+
|
| 85 |
+
let dragging = false;
|
| 86 |
+
|
| 87 |
+
$: dispatch("drag", dragging);
|
| 88 |
+
</script>
|
| 89 |
+
|
| 90 |
+
<BlockLabel {show_label} Icon={File} label={label || "3D Model"} />
|
| 91 |
+
|
| 92 |
+
{#if value == null}
|
| 93 |
+
<Upload
|
| 94 |
+
bind:upload_promise
|
| 95 |
+
{upload}
|
| 96 |
+
{stream_handler}
|
| 97 |
+
on:load={handle_upload}
|
| 98 |
+
{root}
|
| 99 |
+
{max_file_size}
|
| 100 |
+
filetype={[".stl", ".obj", ".gltf", ".glb", "model/obj", ".splat", ".ply"]}
|
| 101 |
+
bind:dragging
|
| 102 |
+
bind:uploading
|
| 103 |
+
on:error
|
| 104 |
+
aria_label={i18n("model3d.drop_to_upload")}
|
| 105 |
+
>
|
| 106 |
+
<slot />
|
| 107 |
+
</Upload>
|
| 108 |
+
{:else}
|
| 109 |
+
<div class="input-model">
|
| 110 |
+
<ModifyUpload
|
| 111 |
+
undoable={!use_3dgs}
|
| 112 |
+
on:clear={handle_clear}
|
| 113 |
+
{i18n}
|
| 114 |
+
on:undo={handle_undo}
|
| 115 |
+
/>
|
| 116 |
+
|
| 117 |
+
{#if use_3dgs}
|
| 118 |
+
<svelte:component
|
| 119 |
+
this={Canvas3DGSComponent}
|
| 120 |
+
{value}
|
| 121 |
+
{zoom_speed}
|
| 122 |
+
{pan_speed}
|
| 123 |
+
/>
|
| 124 |
+
{:else}
|
| 125 |
+
<svelte:component
|
| 126 |
+
this={Canvas3DComponent}
|
| 127 |
+
bind:this={canvas3d}
|
| 128 |
+
{value}
|
| 129 |
+
{display_mode}
|
| 130 |
+
{clear_color}
|
| 131 |
+
{camera_position}
|
| 132 |
+
{zoom_speed}
|
| 133 |
+
{pan_speed}
|
| 134 |
+
/>
|
| 135 |
+
{/if}
|
| 136 |
+
</div>
|
| 137 |
+
{/if}
|
| 138 |
+
|
| 139 |
+
<style>
|
| 140 |
+
.input-model {
|
| 141 |
+
display: flex;
|
| 142 |
+
position: relative;
|
| 143 |
+
justify-content: center;
|
| 144 |
+
align-items: center;
|
| 145 |
+
width: var(--size-full);
|
| 146 |
+
height: var(--size-full);
|
| 147 |
+
border-radius: var(--block-radius);
|
| 148 |
+
overflow: hidden;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.input-model :global(canvas) {
|
| 152 |
+
width: var(--size-full);
|
| 153 |
+
height: var(--size-full);
|
| 154 |
+
object-fit: contain;
|
| 155 |
+
overflow: hidden;
|
| 156 |
+
}
|
| 157 |
+
</style>
|
6.0.0/model3D/types.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { FileData } from "@gradio/client";
|
| 2 |
+
import type { LoadingStatus } from "js/statustracker";
|
| 3 |
+
|
| 4 |
+
export interface Model3DProps {
|
| 5 |
+
value: null | FileData;
|
| 6 |
+
display_mode: "solid" | "point_cloud" | "wireframe";
|
| 7 |
+
clear_color: [number, number, number, number];
|
| 8 |
+
height: number | undefined;
|
| 9 |
+
zoom_speed: number;
|
| 10 |
+
has_change_history: boolean;
|
| 11 |
+
camera_position: [number | null, number | null, number | null];
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
export interface Model3DEvents {
|
| 15 |
+
change: FileData | null;
|
| 16 |
+
upload: FileData;
|
| 17 |
+
edit: never;
|
| 18 |
+
clear: never;
|
| 19 |
+
clear_status: LoadingStatus;
|
| 20 |
+
error: string;
|
| 21 |
+
}
|