@gradio/model3d 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,32 +1,48 @@
1
1
  # @gradio/model3d
2
2
 
3
+ ## 0.8.2
4
+
5
+ ### Fixes
6
+
7
+ - [#7511](https://github.com/gradio-app/gradio/pull/7511) [`33f68cb`](https://github.com/gradio-app/gradio/commit/33f68cb6c22897f7996b6c84b0e528c47fae00b5) - Fix Canvas3D/Canvas3DGS async imports. Thanks [@whitphx](https://github.com/whitphx)!
8
+
9
+ ## 0.8.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`f191786`](https://github.com/gradio-app/gradio/commit/f1917867916647d383b8d7ce15e0c17f2abbdec1)]:
14
+ - @gradio/icons@0.3.3
15
+ - @gradio/atoms@0.5.3
16
+ - @gradio/statustracker@0.4.7
17
+ - @gradio/upload@0.7.4
18
+
3
19
  ## 0.8.0
4
20
 
5
21
  ### Features
6
22
 
7
- - [#7406](https://github.com/gradio-app/gradio/pull/7406) [`3e886d8`](https://github.com/gradio-app/gradio/commit/3e886d8f0ac55c416dae51c1c2661e16eb34718e) - Model3D Gaussian Splatting. Thanks [@dylanebert](https://github.com/dylanebert)!
23
+ - [#7406](https://github.com/gradio-app/gradio/pull/7406) [`3e886d8`](https://github.com/gradio-app/gradio/commit/3e886d8f0ac55c416dae51c1c2661e16eb34718e) - Model3D Gaussian Splatting. Thanks [@dylanebert](https://github.com/dylanebert)!
8
24
 
9
25
  ## 0.7.0
10
26
 
11
27
  ### Features
12
28
 
13
- - [#7183](https://github.com/gradio-app/gradio/pull/7183) [`49d9c48`](https://github.com/gradio-app/gradio/commit/49d9c48537aa706bf72628e3640389470138bdc6) - [WIP] Refactor file normalization to be in the backend and remove it from the frontend of each component. Thanks [@abidlabs](https://github.com/abidlabs)!
29
+ - [#7183](https://github.com/gradio-app/gradio/pull/7183) [`49d9c48`](https://github.com/gradio-app/gradio/commit/49d9c48537aa706bf72628e3640389470138bdc6) - [WIP] Refactor file normalization to be in the backend and remove it from the frontend of each component. Thanks [@abidlabs](https://github.com/abidlabs)!
14
30
 
15
31
  ## 0.6.0
16
32
 
17
33
  ### Features
18
34
 
19
- - [#7315](https://github.com/gradio-app/gradio/pull/7315) [`b3a9c83`](https://github.com/gradio-app/gradio/commit/b3a9c830955a5ded8528d6118aaf1b6e019857a2) - Lite: Wasm-compatible Model3D. Thanks [@whitphx](https://github.com/whitphx)!
35
+ - [#7315](https://github.com/gradio-app/gradio/pull/7315) [`b3a9c83`](https://github.com/gradio-app/gradio/commit/b3a9c830955a5ded8528d6118aaf1b6e019857a2) - Lite: Wasm-compatible Model3D. Thanks [@whitphx](https://github.com/whitphx)!
20
36
 
21
37
  ### Fixes
22
38
 
23
- - [#7192](https://github.com/gradio-app/gradio/pull/7192) [`8dd6f4b`](https://github.com/gradio-app/gradio/commit/8dd6f4bc1901792f05cd59e86df7b1dbab692739) - Handle the case where examples is `null` for all components. Thanks [@abidlabs](https://github.com/abidlabs)!
39
+ - [#7192](https://github.com/gradio-app/gradio/pull/7192) [`8dd6f4b`](https://github.com/gradio-app/gradio/commit/8dd6f4bc1901792f05cd59e86df7b1dbab692739) - Handle the case where examples is `null` for all components. Thanks [@abidlabs](https://github.com/abidlabs)!
24
40
 
25
41
  ## 0.5.0
26
42
 
27
43
  ### Features
28
44
 
29
- - [#7049](https://github.com/gradio-app/gradio/pull/7049) [`1718c4a`](https://github.com/gradio-app/gradio/commit/1718c4aeb23a88ef02b17b30a1d1cb72e413e04a) - add STL 3D model support. Thanks [@Mon-ius](https://github.com/Mon-ius)!
45
+ - [#7049](https://github.com/gradio-app/gradio/pull/7049) [`1718c4a`](https://github.com/gradio-app/gradio/commit/1718c4aeb23a88ef02b17b30a1d1cb72e413e04a) - add STL 3D model support. Thanks [@Mon-ius](https://github.com/Mon-ius)!
30
46
 
31
47
  ## 0.4.15
32
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/model3d",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -12,13 +12,13 @@
12
12
  "babylonjs-loaders": "^4.2.1",
13
13
  "dequal": "^2.0.2",
14
14
  "gsplat": "^1.0.5",
15
- "@gradio/atoms": "^0.5.2",
15
+ "@gradio/atoms": "^0.5.3",
16
16
  "@gradio/client": "^0.12.1",
17
- "@gradio/icons": "^0.3.2",
18
- "@gradio/statustracker": "^0.4.6",
19
- "@gradio/upload": "^0.7.3",
17
+ "@gradio/upload": "^0.7.4",
18
+ "@gradio/icons": "^0.3.3",
20
19
  "@gradio/utils": "^0.3.0",
21
- "@gradio/wasm": "^0.6.0"
20
+ "@gradio/wasm": "^0.6.0",
21
+ "@gradio/statustracker": "^0.4.8"
22
22
  },
23
23
  "main_changeset": true,
24
24
  "main": "./Index.svelte",
@@ -4,6 +4,8 @@
4
4
  import { File, Download, Undo } from "@gradio/icons";
5
5
  import type { I18nFormatter } from "@gradio/utils";
6
6
  import { dequal } from "dequal";
7
+ import type Canvas3DGS from "./Canvas3DGS.svelte";
8
+ import type Canvas3D from "./Canvas3D.svelte";
7
9
 
8
10
  export let value: FileData | null;
9
11
  export let clear_color: [number, number, number, number] = [0, 0, 0, 0];
@@ -21,23 +23,33 @@
21
23
 
22
24
  let current_settings = { camera_position, zoom_speed, pan_speed };
23
25
 
24
- let canvas3dgs: any;
25
- let canvas3d: any;
26
26
  let use_3dgs = false;
27
- let resolved_url: string | undefined;
28
-
29
- async function loadCanvas3D(): Promise<any> {
27
+ let Canvas3DGSComponent: typeof Canvas3DGS;
28
+ let Canvas3DComponent: typeof Canvas3D;
29
+ async function loadCanvas3D(): Promise<typeof Canvas3D> {
30
30
  const module = await import("./Canvas3D.svelte");
31
31
  return module.default;
32
32
  }
33
-
34
- async function loadCanvas3DGS(): Promise<any> {
33
+ async function loadCanvas3DGS(): Promise<typeof Canvas3DGS> {
35
34
  const module = await import("./Canvas3DGS.svelte");
36
35
  return module.default;
37
36
  }
37
+ $: if (value) {
38
+ use_3dgs = value.path.endsWith(".splat") || value.path.endsWith(".ply");
39
+ if (use_3dgs) {
40
+ loadCanvas3DGS().then((component) => {
41
+ Canvas3DGSComponent = component;
42
+ });
43
+ } else {
44
+ loadCanvas3D().then((component) => {
45
+ Canvas3DComponent = component;
46
+ });
47
+ }
48
+ }
38
49
 
50
+ let canvas3d: Canvas3D | undefined;
39
51
  function handle_undo(): void {
40
- canvas3d.reset_camera_position(camera_position, zoom_speed, pan_speed);
52
+ canvas3d?.reset_camera_position(camera_position, zoom_speed, pan_speed);
41
53
  }
42
54
 
43
55
  $: {
@@ -46,25 +58,12 @@
46
58
  current_settings.zoom_speed !== zoom_speed ||
47
59
  current_settings.pan_speed !== pan_speed
48
60
  ) {
49
- canvas3d.reset_camera_position(camera_position, zoom_speed, pan_speed);
61
+ canvas3d?.reset_camera_position(camera_position, zoom_speed, pan_speed);
50
62
  current_settings = { camera_position, zoom_speed, pan_speed };
51
63
  }
52
64
  }
53
65
 
54
- $: {
55
- if (value) {
56
- use_3dgs = value?.path.endsWith(".splat") || value?.path.endsWith(".ply");
57
- if (use_3dgs) {
58
- loadCanvas3DGS().then((module) => {
59
- canvas3dgs = module;
60
- });
61
- } else {
62
- loadCanvas3D().then((module) => {
63
- canvas3d = module;
64
- });
65
- }
66
- }
67
- }
66
+ let resolved_url: string | undefined;
68
67
  </script>
69
68
 
70
69
  <BlockLabel
@@ -75,7 +74,10 @@
75
74
  {#if value}
76
75
  <div class="model3D">
77
76
  <div class="buttons">
78
- <IconButton Icon={Undo} label="Undo" on:click={() => handle_undo()} />
77
+ {#if !use_3dgs}
78
+ <!-- Canvas3DGS doesn't implement the undo method (reset_camera_position) -->
79
+ <IconButton Icon={Undo} label="Undo" on:click={() => handle_undo()} />
80
+ {/if}
79
81
  <a
80
82
  href={resolved_url}
81
83
  target={window.__is_colab__ ? "_blank" : null}
@@ -87,7 +89,7 @@
87
89
 
88
90
  {#if use_3dgs}
89
91
  <svelte:component
90
- this={canvas3dgs}
92
+ this={Canvas3DGSComponent}
91
93
  bind:resolved_url
92
94
  {value}
93
95
  {zoom_speed}
@@ -95,7 +97,8 @@
95
97
  />
96
98
  {:else}
97
99
  <svelte:component
98
- this={canvas3d}
100
+ this={Canvas3DComponent}
101
+ bind:this={canvas3d}
99
102
  bind:resolved_url
100
103
  {value}
101
104
  {clear_color}
@@ -5,6 +5,8 @@
5
5
  import { BlockLabel } from "@gradio/atoms";
6
6
  import { File } from "@gradio/icons";
7
7
  import type { I18nFormatter } from "@gradio/utils";
8
+ import type Canvas3DGS from "./Canvas3DGS.svelte";
9
+ import type Canvas3D from "./Canvas3D.svelte";
8
10
 
9
11
  export let value: null | FileData;
10
12
  export let clear_color: [number, number, number, number] = [0, 0, 0, 0];
@@ -38,22 +40,33 @@
38
40
  dispatch("change");
39
41
  }
40
42
 
41
- let canvas3d: any;
42
- let canvas3dgs: any;
43
43
  let use_3dgs = false;
44
-
45
- async function loadCanvas3D(): Promise<any> {
44
+ let Canvas3DGSComponent: typeof Canvas3DGS;
45
+ let Canvas3DComponent: typeof Canvas3D;
46
+ async function loadCanvas3D(): Promise<typeof Canvas3D> {
46
47
  const module = await import("./Canvas3D.svelte");
47
48
  return module.default;
48
49
  }
49
-
50
- async function loadCanvas3DGS(): Promise<any> {
50
+ async function loadCanvas3DGS(): Promise<typeof Canvas3DGS> {
51
51
  const module = await import("./Canvas3DGS.svelte");
52
52
  return module.default;
53
53
  }
54
+ $: if (value) {
55
+ use_3dgs = value.path.endsWith(".splat") || value.path.endsWith(".ply");
56
+ if (use_3dgs) {
57
+ loadCanvas3DGS().then((component) => {
58
+ Canvas3DGSComponent = component;
59
+ });
60
+ } else {
61
+ loadCanvas3D().then((component) => {
62
+ Canvas3DComponent = component;
63
+ });
64
+ }
65
+ }
54
66
 
67
+ let canvas3d: Canvas3D | undefined;
55
68
  async function handle_undo(): Promise<void> {
56
- canvas3d.reset_camera_position(camera_position, zoom_speed, pan_speed);
69
+ canvas3d?.reset_camera_position(camera_position, zoom_speed, pan_speed);
57
70
  }
58
71
 
59
72
  const dispatch = createEventDispatcher<{
@@ -66,21 +79,6 @@
66
79
  let dragging = false;
67
80
 
68
81
  $: dispatch("drag", dragging);
69
-
70
- $: {
71
- if (value) {
72
- use_3dgs = value?.path.endsWith(".splat") || value?.path.endsWith(".ply");
73
- if (use_3dgs) {
74
- loadCanvas3DGS().then((module) => {
75
- canvas3dgs = module;
76
- });
77
- } else {
78
- loadCanvas3D().then((module) => {
79
- canvas3d = module;
80
- });
81
- }
82
- }
83
- }
84
82
  </script>
85
83
 
86
84
  <BlockLabel {show_label} Icon={File} label={label || "3D Model"} />
@@ -97,7 +95,7 @@
97
95
  {:else}
98
96
  <div class="input-model">
99
97
  <ModifyUpload
100
- undoable
98
+ undoable={!use_3dgs}
101
99
  on:clear={handle_clear}
102
100
  {i18n}
103
101
  on:undo={handle_undo}
@@ -105,10 +103,16 @@
105
103
  />
106
104
 
107
105
  {#if use_3dgs}
108
- <svelte:component this={canvas3dgs} {value} {zoom_speed} {pan_speed} />
106
+ <svelte:component
107
+ this={Canvas3DGSComponent}
108
+ {value}
109
+ {zoom_speed}
110
+ {pan_speed}
111
+ />
109
112
  {:else}
110
113
  <svelte:component
111
- this={canvas3d}
114
+ this={Canvas3DComponent}
115
+ bind:this={canvas3d}
112
116
  {value}
113
117
  {clear_color}
114
118
  {camera_position}