kolibril13 commited on
Commit
70589c6
·
1 Parent(s): 1d26037

remove widget

Browse files
Files changed (1) hide show
  1. 02_widget_future_idea.ipynb +0 -88
02_widget_future_idea.ipynb DELETED
@@ -1,88 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {},
7
- "outputs": [],
8
- "source": [
9
- "import sys\n",
10
- "import os\n",
11
- "\n",
12
- "sys.stdout = open(os.devnull, 'w')\n",
13
- "sys.stderr = open(os.devnull, 'w')"
14
- ]
15
- },
16
- {
17
- "cell_type": "code",
18
- "execution_count": null,
19
- "metadata": {},
20
- "outputs": [],
21
- "source": [
22
- "import bpy\n",
23
- "from IPython.display import display\n",
24
- "from anywidget_3dviewer import Viewer\n",
25
- "import solara\n",
26
- "from pathlib import Path\n",
27
- "\n",
28
- "\n",
29
- "def make_gltf_model():\n",
30
- " bpy.ops.preferences.addon_enable(module=\"io_scene_gltf2\")\n",
31
- " bpy.ops.object.select_all(action=\"DESELECT\")\n",
32
- " bpy.ops.object.select_by_type(type=\"MESH\")\n",
33
- "\n",
34
- " bpy.ops.object.delete()\n",
35
- " bpy.ops.mesh.primitive_cube_add(size=2, align=\"WORLD\", location=(0, 1, 1))\n",
36
- " cube = bpy.context.active_object\n",
37
- " gltf_path = \"./model_cube.gltf\"\n",
38
- " bpy.ops.object.select_all(action=\"DESELECT\")\n",
39
- " cube.select_set(True)\n",
40
- " bpy.ops.export_scene.gltf(\n",
41
- " filepath=gltf_path, export_format=\"GLTF_EMBEDDED\", use_selection=True\n",
42
- " )\n",
43
- " gltf_path = Path() / \"model_cube.gltf\"\n",
44
- " data = gltf_path.read_bytes()\n",
45
- " gltf_path.unlink()\n",
46
- " return data\n",
47
- "\n",
48
- "data = make_gltf_model()\n",
49
- "\n",
50
- "@solara.component\n",
51
- "def Page():\n",
52
- " viewer = Viewer(gltf_data=data)\n",
53
- " display(viewer)\n",
54
- "\n",
55
- "\n",
56
- "Page()"
57
- ]
58
- },
59
- {
60
- "cell_type": "code",
61
- "execution_count": null,
62
- "metadata": {},
63
- "outputs": [],
64
- "source": []
65
- }
66
- ],
67
- "metadata": {
68
- "kernelspec": {
69
- "display_name": ".venv",
70
- "language": "python",
71
- "name": "python3"
72
- },
73
- "language_info": {
74
- "codemirror_mode": {
75
- "name": "ipython",
76
- "version": 3
77
- },
78
- "file_extension": ".py",
79
- "mimetype": "text/x-python",
80
- "name": "python",
81
- "nbconvert_exporter": "python",
82
- "pygments_lexer": "ipython3",
83
- "version": "3.10.13"
84
- }
85
- },
86
- "nbformat": 4,
87
- "nbformat_minor": 2
88
- }