datacut 0.1.0__tar.gz
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.
- datacut-0.1.0/LICENSE.md +21 -0
- datacut-0.1.0/MANIFEST.in +2 -0
- datacut-0.1.0/PKG-INFO +226 -0
- datacut-0.1.0/README.md +167 -0
- datacut-0.1.0/datacut/__init__.py +121 -0
- datacut-0.1.0/datacut/__main__.py +122 -0
- datacut-0.1.0/datacut/animation/__init__.py +0 -0
- datacut-0.1.0/datacut/animation/animation.py +336 -0
- datacut-0.1.0/datacut/animation/composition.py +258 -0
- datacut-0.1.0/datacut/animation/creation.py +315 -0
- datacut-0.1.0/datacut/animation/fading.py +328 -0
- datacut-0.1.0/datacut/animation/growing.py +90 -0
- datacut-0.1.0/datacut/animation/indication.py +608 -0
- datacut-0.1.0/datacut/animation/movement.py +165 -0
- datacut-0.1.0/datacut/animation/numbers.py +92 -0
- datacut-0.1.0/datacut/animation/physics.py +453 -0
- datacut-0.1.0/datacut/animation/rotation.py +95 -0
- datacut-0.1.0/datacut/animation/specialized.py +956 -0
- datacut-0.1.0/datacut/animation/transform.py +505 -0
- datacut-0.1.0/datacut/animation/transform_matching_parts.py +343 -0
- datacut-0.1.0/datacut/animation/update.py +95 -0
- datacut-0.1.0/datacut/camera/__init__.py +0 -0
- datacut-0.1.0/datacut/camera/camera.py +795 -0
- datacut-0.1.0/datacut/camera/camera_frame.py +320 -0
- datacut-0.1.0/datacut/camera/cinematography.py +1166 -0
- datacut-0.1.0/datacut/config.py +479 -0
- datacut-0.1.0/datacut/constants.py +160 -0
- datacut-0.1.0/datacut/css/__init__.py +189 -0
- datacut-0.1.0/datacut/css/easing.py +328 -0
- datacut-0.1.0/datacut/css/engine.py +1727 -0
- datacut-0.1.0/datacut/css/gradients.py +678 -0
- datacut-0.1.0/datacut/css/motion.py +1615 -0
- datacut-0.1.0/datacut/css/parser.py +741 -0
- datacut-0.1.0/datacut/css/presets.py +143 -0
- datacut-0.1.0/datacut/css/shader_fill.py +703 -0
- datacut-0.1.0/datacut/css/values.py +650 -0
- datacut-0.1.0/datacut/default_config.yml +224 -0
- datacut-0.1.0/datacut/event_handler/__init__.py +6 -0
- datacut-0.1.0/datacut/event_handler/event_dispatcher.py +161 -0
- datacut-0.1.0/datacut/event_handler/event_listner.py +31 -0
- datacut-0.1.0/datacut/event_handler/event_type.py +11 -0
- datacut-0.1.0/datacut/event_handler/picking.py +111 -0
- datacut-0.1.0/datacut/event_keys.py +53 -0
- datacut-0.1.0/datacut/extract_scene.py +200 -0
- datacut-0.1.0/datacut/layout/__init__.py +39 -0
- datacut-0.1.0/datacut/layout/components.py +425 -0
- datacut-0.1.0/datacut/layout/containers.py +1520 -0
- datacut-0.1.0/datacut/logger.py +13 -0
- datacut-0.1.0/datacut/mobject/__init__.py +0 -0
- datacut-0.1.0/datacut/mobject/boolean_ops.py +168 -0
- datacut-0.1.0/datacut/mobject/changing.py +209 -0
- datacut-0.1.0/datacut/mobject/coordinate_systems.py +1056 -0
- datacut-0.1.0/datacut/mobject/fractals.py +348 -0
- datacut-0.1.0/datacut/mobject/frame.py +80 -0
- datacut-0.1.0/datacut/mobject/functions.py +147 -0
- datacut-0.1.0/datacut/mobject/geometry.py +1834 -0
- datacut-0.1.0/datacut/mobject/gltf.py +243 -0
- datacut-0.1.0/datacut/mobject/interactive.py +906 -0
- datacut-0.1.0/datacut/mobject/lights.py +366 -0
- datacut-0.1.0/datacut/mobject/materials.py +207 -0
- datacut-0.1.0/datacut/mobject/matrix.py +570 -0
- datacut-0.1.0/datacut/mobject/mesh3d.py +2288 -0
- datacut-0.1.0/datacut/mobject/mobject.py +2885 -0
- datacut-0.1.0/datacut/mobject/mobject_update_utils.py +123 -0
- datacut-0.1.0/datacut/mobject/model.py +543 -0
- datacut-0.1.0/datacut/mobject/number_line.py +517 -0
- datacut-0.1.0/datacut/mobject/numbers.py +441 -0
- datacut-0.1.0/datacut/mobject/probability.py +536 -0
- datacut-0.1.0/datacut/mobject/shape_matchers.py +161 -0
- datacut-0.1.0/datacut/mobject/subtitles.py +260 -0
- datacut-0.1.0/datacut/mobject/svg/__init__.py +0 -0
- datacut-0.1.0/datacut/mobject/svg/brace.py +356 -0
- datacut-0.1.0/datacut/mobject/svg/drawings.py +1041 -0
- datacut-0.1.0/datacut/mobject/svg/old_tex_mobject.py +335 -0
- datacut-0.1.0/datacut/mobject/svg/path_cache.py +155 -0
- datacut-0.1.0/datacut/mobject/svg/special_tex.py +216 -0
- datacut-0.1.0/datacut/mobject/svg/string_mobject.py +622 -0
- datacut-0.1.0/datacut/mobject/svg/svg_mobject.py +657 -0
- datacut-0.1.0/datacut/mobject/svg/svg_parse.py +437 -0
- datacut-0.1.0/datacut/mobject/svg/tex_mobject.py +499 -0
- datacut-0.1.0/datacut/mobject/svg/text_mobject.py +702 -0
- datacut-0.1.0/datacut/mobject/svg/typst_mobject.py +864 -0
- datacut-0.1.0/datacut/mobject/three_dimensions.py +686 -0
- datacut-0.1.0/datacut/mobject/types/__init__.py +0 -0
- datacut-0.1.0/datacut/mobject/types/dot_cloud.py +220 -0
- datacut-0.1.0/datacut/mobject/types/image_mobject.py +130 -0
- datacut-0.1.0/datacut/mobject/types/point_cloud_mobject.py +138 -0
- datacut-0.1.0/datacut/mobject/types/shader_mobject.py +268 -0
- datacut-0.1.0/datacut/mobject/types/surface.py +848 -0
- datacut-0.1.0/datacut/mobject/types/vectorized_mobject.py +1749 -0
- datacut-0.1.0/datacut/mobject/types/video_mobject.py +3902 -0
- datacut-0.1.0/datacut/mobject/value_tracker.py +110 -0
- datacut-0.1.0/datacut/mobject/vector_field.py +585 -0
- datacut-0.1.0/datacut/module_loader.py +176 -0
- datacut-0.1.0/datacut/reactive/__init__.py +25 -0
- datacut-0.1.0/datacut/reactive/signals.py +610 -0
- datacut-0.1.0/datacut/renderer/__init__.py +4 -0
- datacut-0.1.0/datacut/renderer/drawing.py +1066 -0
- datacut-0.1.0/datacut/renderer/gpu.py +800 -0
- datacut-0.1.0/datacut/renderer/material.py +88 -0
- datacut-0.1.0/datacut/renderer/pipeline.py +179 -0
- datacut-0.1.0/datacut/renderer/post_process.py +577 -0
- datacut-0.1.0/datacut/renderer/renderer.py +1285 -0
- datacut-0.1.0/datacut/renderer/shader_source.py +146 -0
- datacut-0.1.0/datacut/renderer/shared_buffer.py +185 -0
- datacut-0.1.0/datacut/renderer/texture.py +217 -0
- datacut-0.1.0/datacut/renderer/uniform_block.py +118 -0
- datacut-0.1.0/datacut/scene/__init__.py +0 -0
- datacut-0.1.0/datacut/scene/incremental.py +233 -0
- datacut-0.1.0/datacut/scene/interactive_scene.py +758 -0
- datacut-0.1.0/datacut/scene/performance.py +226 -0
- datacut-0.1.0/datacut/scene/presentation_scene.py +783 -0
- datacut-0.1.0/datacut/scene/recording.py +541 -0
- datacut-0.1.0/datacut/scene/safe_zones.py +323 -0
- datacut-0.1.0/datacut/scene/scene.py +2849 -0
- datacut-0.1.0/datacut/scene/scene_embed.py +277 -0
- datacut-0.1.0/datacut/scene/scene_file_writer.py +1014 -0
- datacut-0.1.0/datacut/scene/scene_task.py +183 -0
- datacut-0.1.0/datacut/scene/sfx.py +164 -0
- datacut-0.1.0/datacut/scene/sound.py +702 -0
- datacut-0.1.0/datacut/scene/sound_clip.py +580 -0
- datacut-0.1.0/datacut/scene/timeline.py +1689 -0
- datacut-0.1.0/datacut/scene/transcript.py +503 -0
- datacut-0.1.0/datacut/shaders/fill.wgsl +107 -0
- datacut-0.1.0/datacut/shaders/fill_depth.wgsl +198 -0
- datacut-0.1.0/datacut/shaders/image.wgsl +25 -0
- datacut-0.1.0/datacut/shaders/inserts/NOTE.md +16 -0
- datacut-0.1.0/datacut/shaders/inserts/clip_test.wgsl +14 -0
- datacut-0.1.0/datacut/shaders/inserts/complex_functions.wgsl +20 -0
- datacut-0.1.0/datacut/shaders/inserts/fill_color.wgsl +10 -0
- datacut-0.1.0/datacut/shaders/inserts/finalize_color.wgsl +44 -0
- datacut-0.1.0/datacut/shaders/inserts/frame_uniforms.wgsl +37 -0
- datacut-0.1.0/datacut/shaders/inserts/frame_units.wgsl +18 -0
- datacut-0.1.0/datacut/shaders/inserts/image_quad.wgsl +28 -0
- datacut-0.1.0/datacut/shaders/inserts/mobject_uniforms.wgsl +11 -0
- datacut-0.1.0/datacut/shaders/inserts/project_point.wgsl +44 -0
- datacut-0.1.0/datacut/shaders/inserts/quad_corners.wgsl +12 -0
- datacut-0.1.0/datacut/shaders/inserts/read_data.wgsl +33 -0
- datacut-0.1.0/datacut/shaders/inserts/surface_mesh.wgsl +106 -0
- datacut-0.1.0/datacut/shaders/mandelbrot_fractal.wgsl +100 -0
- datacut-0.1.0/datacut/shaders/mesh.wgsl +474 -0
- datacut-0.1.0/datacut/shaders/newton_fractal.wgsl +200 -0
- datacut-0.1.0/datacut/shaders/present.wgsl +62 -0
- datacut-0.1.0/datacut/shaders/stroke.wgsl +1141 -0
- datacut-0.1.0/datacut/shaders/stroke_depth.wgsl +1136 -0
- datacut-0.1.0/datacut/shaders/surface.wgsl +40 -0
- datacut-0.1.0/datacut/shaders/textured_surface.wgsl +59 -0
- datacut-0.1.0/datacut/shaders/true_dot.wgsl +78 -0
- datacut-0.1.0/datacut/shaders/video.wgsl +42 -0
- datacut-0.1.0/datacut/tex_templates.yml +736 -0
- datacut-0.1.0/datacut/transcribe.py +32 -0
- datacut-0.1.0/datacut/typing.py +412 -0
- datacut-0.1.0/datacut/utils/__init__.py +0 -0
- datacut-0.1.0/datacut/utils/bezier.py +467 -0
- datacut-0.1.0/datacut/utils/browser_audio.py +423 -0
- datacut-0.1.0/datacut/utils/browser_code_transform.py +1293 -0
- datacut-0.1.0/datacut/utils/browser_completions.py +2255 -0
- datacut-0.1.0/datacut/utils/browser_fonts.py +143 -0
- datacut-0.1.0/datacut/utils/browser_pathops.py +47 -0
- datacut-0.1.0/datacut/utils/browser_scheduler.py +18 -0
- datacut-0.1.0/datacut/utils/browser_typst.py +82 -0
- datacut-0.1.0/datacut/utils/cache.py +34 -0
- datacut-0.1.0/datacut/utils/cinematic_vfx.py +779 -0
- datacut-0.1.0/datacut/utils/color.py +203 -0
- datacut-0.1.0/datacut/utils/debug.py +46 -0
- datacut-0.1.0/datacut/utils/dict_ops.py +22 -0
- datacut-0.1.0/datacut/utils/directories.py +55 -0
- datacut-0.1.0/datacut/utils/editor_signatures.py +1806 -0
- datacut-0.1.0/datacut/utils/editor_thumbnails.py +769 -0
- datacut-0.1.0/datacut/utils/family_ops.py +48 -0
- datacut-0.1.0/datacut/utils/file_ops.py +65 -0
- datacut-0.1.0/datacut/utils/images.py +52 -0
- datacut-0.1.0/datacut/utils/iterables.py +216 -0
- datacut-0.1.0/datacut/utils/native.py +280 -0
- datacut-0.1.0/datacut/utils/paths.py +83 -0
- datacut-0.1.0/datacut/utils/rate_functions.py +154 -0
- datacut-0.1.0/datacut/utils/render_geometry.py +186 -0
- datacut-0.1.0/datacut/utils/simple_functions.py +99 -0
- datacut-0.1.0/datacut/utils/sounds.py +43 -0
- datacut-0.1.0/datacut/utils/space_ops.py +460 -0
- datacut-0.1.0/datacut/utils/structured_array.py +256 -0
- datacut-0.1.0/datacut/utils/svg_export.py +102 -0
- datacut-0.1.0/datacut/utils/tex.py +139 -0
- datacut-0.1.0/datacut/utils/tex_file_writing.py +164 -0
- datacut-0.1.0/datacut/utils/tex_to_symbol_count.py +186 -0
- datacut-0.1.0/datacut/utils/typst_file_writing.py +205 -0
- datacut-0.1.0/datacut/utils/vfx_presets.py +4543 -0
- datacut-0.1.0/datacut/utils/visual_css.py +737 -0
- datacut-0.1.0/datacut/utils/visual_editor.py +4292 -0
- datacut-0.1.0/datacut/utils/window_audio.py +760 -0
- datacut-0.1.0/datacut/window.py +910 -0
- datacut-0.1.0/datacut.egg-info/PKG-INFO +226 -0
- datacut-0.1.0/datacut.egg-info/SOURCES.txt +228 -0
- datacut-0.1.0/datacut.egg-info/dependency_links.txt +1 -0
- datacut-0.1.0/datacut.egg-info/entry_points.txt +2 -0
- datacut-0.1.0/datacut.egg-info/requires.txt +38 -0
- datacut-0.1.0/datacut.egg-info/top_level.txt +1 -0
- datacut-0.1.0/pyproject.toml +2 -0
- datacut-0.1.0/setup.cfg +73 -0
- datacut-0.1.0/setup.py +2 -0
- datacut-0.1.0/tests/test_browser_code_transform.py +396 -0
- datacut-0.1.0/tests/test_browser_completions.py +299 -0
- datacut-0.1.0/tests/test_browser_wheel.py +162 -0
- datacut-0.1.0/tests/test_bugfixes.py +254 -0
- datacut-0.1.0/tests/test_cinematography.py +171 -0
- datacut-0.1.0/tests/test_coordinate_systems.py +52 -0
- datacut-0.1.0/tests/test_css_ui.py +297 -0
- datacut-0.1.0/tests/test_editor_signatures.py +634 -0
- datacut-0.1.0/tests/test_encoding.py +141 -0
- datacut-0.1.0/tests/test_hot_reload.py +164 -0
- datacut-0.1.0/tests/test_incremental.py +121 -0
- datacut-0.1.0/tests/test_interactive_scene.py +102 -0
- datacut-0.1.0/tests/test_materials.py +344 -0
- datacut-0.1.0/tests/test_mesh3d.py +204 -0
- datacut-0.1.0/tests/test_new_features.py +333 -0
- datacut-0.1.0/tests/test_picking.py +67 -0
- datacut-0.1.0/tests/test_recording.py +304 -0
- datacut-0.1.0/tests/test_scene_task.py +341 -0
- datacut-0.1.0/tests/test_sound.py +308 -0
- datacut-0.1.0/tests/test_sound_clip.py +244 -0
- datacut-0.1.0/tests/test_space_ops.py +42 -0
- datacut-0.1.0/tests/test_subtitles.py +162 -0
- datacut-0.1.0/tests/test_svg_parse.py +348 -0
- datacut-0.1.0/tests/test_timeline.py +802 -0
- datacut-0.1.0/tests/test_transcript.py +219 -0
- datacut-0.1.0/tests/test_video_from_scene.py +336 -0
- datacut-0.1.0/tests/test_video_playback_speed.py +247 -0
- datacut-0.1.0/tests/test_visual_editor.py +1140 -0
- datacut-0.1.0/tests/test_window_audio.py +478 -0
datacut-0.1.0/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2026 3Blue1Brown LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
datacut-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: datacut
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Programmatic animated video, on the desktop and in the browser
|
|
5
|
+
Home-page: https://github.com/MathItYT/datacut
|
|
6
|
+
Author: Benjamín Ubilla
|
|
7
|
+
Author-email: benjamin.ubilla@uc.cl
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/MathItYT/datacut/issues
|
|
10
|
+
Project-URL: Editor, https://mathityt.github.io/datacut/
|
|
11
|
+
Project-URL: Source Code, https://github.com/MathItYT/datacut
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering
|
|
15
|
+
Classifier: Topic :: Multimedia :: Video
|
|
16
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Natural Language :: English
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown; charset=UTF-8
|
|
25
|
+
License-File: LICENSE.md
|
|
26
|
+
Requires-Dist: addict
|
|
27
|
+
Requires-Dist: appdirs
|
|
28
|
+
Requires-Dist: av; sys_platform != "emscripten"
|
|
29
|
+
Requires-Dist: audioop-lts; python_version >= "3.13" and sys_platform != "emscripten"
|
|
30
|
+
Requires-Dist: colour
|
|
31
|
+
Requires-Dist: diskcache
|
|
32
|
+
Requires-Dist: ipython>=8.18.0
|
|
33
|
+
Requires-Dist: isosurfaces
|
|
34
|
+
Requires-Dist: fontTools
|
|
35
|
+
Requires-Dist: glfw; sys_platform != "emscripten"
|
|
36
|
+
Requires-Dist: manimpango>=0.6.0; sys_platform != "emscripten"
|
|
37
|
+
Requires-Dist: matplotlib
|
|
38
|
+
Requires-Dist: numpy
|
|
39
|
+
Requires-Dist: Pillow
|
|
40
|
+
Requires-Dist: pydub; sys_platform != "emscripten"
|
|
41
|
+
Requires-Dist: pygments
|
|
42
|
+
Requires-Dist: pyperclip; sys_platform != "emscripten"
|
|
43
|
+
Requires-Dist: pywavefront
|
|
44
|
+
Requires-Dist: pyyaml
|
|
45
|
+
Requires-Dist: rendercanvas
|
|
46
|
+
Requires-Dist: rich
|
|
47
|
+
Requires-Dist: scipy
|
|
48
|
+
Requires-Dist: setuptools
|
|
49
|
+
Requires-Dist: skia-pathops; sys_platform != "emscripten"
|
|
50
|
+
Requires-Dist: svgelements>=1.8.1
|
|
51
|
+
Requires-Dist: sympy
|
|
52
|
+
Requires-Dist: trimesh
|
|
53
|
+
Requires-Dist: tqdm
|
|
54
|
+
Requires-Dist: typing-extensions; python_version < "3.11"
|
|
55
|
+
Requires-Dist: validators
|
|
56
|
+
Requires-Dist: wgpu<0.34,>=0.32.0; sys_platform != "emscripten"
|
|
57
|
+
Requires-Dist: datacut-native<0.2,>=0.1.0; sys_platform != "emscripten"
|
|
58
|
+
Dynamic: license-file
|
|
59
|
+
|
|
60
|
+
<p align="center">
|
|
61
|
+
<img src="https://raw.githubusercontent.com/MathItYT/datacut/main/logo/logo.png" alt="DataCut" width="600">
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
# DataCut
|
|
65
|
+
|
|
66
|
+
DataCut is an engine and editor for precise, programmatic animated video. You describe a scene in Python, and DataCut renders it on the GPU through **WebGPU**, on your desktop or directly in the browser, with nothing to install.
|
|
67
|
+
|
|
68
|
+
**[Open the DataCut editor in your browser](https://mathityt.github.io/datacut/)**
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from datacut import *
|
|
72
|
+
|
|
73
|
+
class HelloDataCut(Scene):
|
|
74
|
+
def construct(self):
|
|
75
|
+
title = Text("Hello from DataCut")
|
|
76
|
+
circle = Circle(color=BLUE).next_to(title, DOWN)
|
|
77
|
+
self.play(Write(title), name="Intro")
|
|
78
|
+
self.play(ShowCreation(circle))
|
|
79
|
+
self.wait()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Contents
|
|
83
|
+
|
|
84
|
+
- [The browser editor](#the-browser-editor)
|
|
85
|
+
- [Features](#features)
|
|
86
|
+
- [Local installation](#local-installation)
|
|
87
|
+
- [Command line](#command-line)
|
|
88
|
+
- [Repository layout](#repository-layout)
|
|
89
|
+
- [Development](#development)
|
|
90
|
+
- [Credits](#credits)
|
|
91
|
+
- [License](#license)
|
|
92
|
+
|
|
93
|
+
## The browser editor
|
|
94
|
+
|
|
95
|
+
The editor runs the full engine in the browser with **Pyodide** and **WebGPU**. It needs a browser with WebGPU support (a recent Chrome or Edge, for example).
|
|
96
|
+
|
|
97
|
+
- **Plain Python, transformed for you.** Write ordinary synchronous scene code (`self.play(...)`, `self.wait(...)`). The editor reads the code's AST and turns it into browser-ready code when you press Run. The **Generated Web Code** panel shows the result.
|
|
98
|
+
- **Projects with their own file system.** Each project keeps its files, folders and assets (images, video, audio, fonts, 3D models) in the browser. You can import your own `.py` modules, install packages with `micropip`, and share a project as a `.zip`.
|
|
99
|
+
- **A Monaco code editor** with autocompletion for `import *` from any library, hover docs, signature help and linting.
|
|
100
|
+
- **Plain scripts.** A file with no `Scene` runs as an ordinary Python script, and its output appears in the Output panel.
|
|
101
|
+
- **Visual Mode.** A lossless, AST-backed visual editor that edits your code as you work:
|
|
102
|
+
- a drag-and-drop shelf of objects, animations and VFX with thumbnails; you drop an animation or effect onto the object it applies to;
|
|
103
|
+
- a typed live-preview inspector driven by `datacut.typing` hints, which your own classes can use too;
|
|
104
|
+
- a WebGPU gizmo for moving, scaling and rotating in 3D, with deep submobject selection;
|
|
105
|
+
- a pen tool (`PenPath`), graphs bound to axes, and a Typst equation morph;
|
|
106
|
+
- a multi-track timeline (`self.add/remove(..., at=t)`, `play_background`) with magnets that snap the playhead and drops;
|
|
107
|
+
- a keyframe animator, a cubic-Bézier `rate_func` editor, and a DevTools-style CSS panel.
|
|
108
|
+
- **Interactive canvas and timeline** with chapters (`name=` in `self.play`), scrubbing and range selection.
|
|
109
|
+
- **Export** to video or PNG directly from the browser.
|
|
110
|
+
- **Built-in documentation** with a quick tour, a guide to every editor feature, interactive examples you can add as a project in one click, and a full **API Reference**.
|
|
111
|
+
|
|
112
|
+
## Features
|
|
113
|
+
|
|
114
|
+
| Area | What DataCut offers |
|
|
115
|
+
| --- | --- |
|
|
116
|
+
| **Rendering** | A WebGPU engine (`wgpu` + WGSL) that runs on the desktop and in the browser, with a native **Rust** core (`datacut_native`) for SVG parsing and per-frame geometry |
|
|
117
|
+
| **VFX and post-processing** | A GPU pipeline with Glow, Gaussian Blur, Drop Shadow, Vignette, Grain, Glitch, Chromatic Aberration, Liquid Glass, masks and `CustomVFX`; cinematic grading (`ColorGrading`, `AnamorphicLensFlare`, `Halation`, `Letterbox`) |
|
|
118
|
+
| **Typography** | Native **Typst** (`Typst`, `TypstText`), LaTeX, Pango text (`Text`, `MarkupText`), a fast SVG parser and path caching |
|
|
119
|
+
| **3D** | `Mesh3D`, `PBRMaterial`, lights, shadow maps, environment maps, and direct loading of `.glb/.gltf/.obj/.ply/.stl` (`load_model`) |
|
|
120
|
+
| **Cinematography** | `look_at`, `follow`/`stop_following`, `CameraPath`, `KeyframePath`, `DepthOfField`, `Haze`, `RotationalBlur` |
|
|
121
|
+
| **Audio** | `Sound` (synthesis and DSP), `SoundClip`, an SFX library (`register_sfx`/`add_sfx`), live mixing, transcription with `faster-whisper` (`Transcript`, `wait_for_word`) and `Subtitles` |
|
|
122
|
+
| **Physics and reactivity** | Spring physics (`SpringTracker`, `SpringAnimation`, `CameraShake`) and reactive state (`State`, `Computed`, `Effect`, `ReactiveStore`) |
|
|
123
|
+
| **Layouts and DataCut CSS** | Declarative layouts (`HStack`, `VStack`, `ZStack`, `FlexBox`, `Grid`, `Card`) styled with CSS: selectors, `var()`, `calc()`, `@media`, the box model, transforms and filters |
|
|
124
|
+
| **UI motion** | CSS transitions and `@keyframes`, 40 motion presets, FLIP `LayoutTransition`, text animators by character, word or line, UI components, and GPU `ShaderFill` gradients |
|
|
125
|
+
| **Media** | Images, SVG, and `VideoMobject`, including `VideoMobject.from_scene(OtherScene)` to embed one scene inside another |
|
|
126
|
+
| **Production** | A navigable timeline (chapters, range export, erasing the future), interactive recording, `SceneTask`, a performance overlay, `PresentationScene`, 2D/3D picking, incremental rendering, quality profiles, GPU video encoding, and vertical presets with safe-zone guides |
|
|
127
|
+
|
|
128
|
+
## Local installation
|
|
129
|
+
|
|
130
|
+
DataCut needs Python 3.10 or higher, [FFmpeg](https://ffmpeg.org/) to export video, and optionally a [LaTeX](https://www.latex-project.org) distribution for `Tex`. On Linux, [Pango](https://pango.org) and its development headers are also required.
|
|
131
|
+
|
|
132
|
+
With `pip`:
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
pip install datacut
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
With `uv`, inside a project:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
uv add datacut
|
|
142
|
+
uv run datacut main.py HelloDataCut
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
With `uv`, into the active environment:
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
uv pip install datacut
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
DataCut's Rust core, `datacut-native`, is installed with it as a prebuilt wheel for Windows, macOS and Linux.
|
|
152
|
+
|
|
153
|
+
To work on DataCut itself, clone the repository and install it in editable mode, with the Rust core built from `native/` (this needs [Rust](https://rustup.rs)):
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
git clone https://github.com/MathItYT/datacut.git
|
|
157
|
+
cd datacut
|
|
158
|
+
pip install ./native
|
|
159
|
+
pip install -e .
|
|
160
|
+
datacut example_scenes.py OpeningManimExample
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Command line
|
|
164
|
+
|
|
165
|
+
```sh
|
|
166
|
+
datacut scene.py MyScene
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
opens the scene in an interactive WebGPU window. Common flags:
|
|
170
|
+
|
|
171
|
+
| Command | Effect |
|
|
172
|
+
| --- | --- |
|
|
173
|
+
| `datacut scene.py MyScene -w` | Render and write a video file (needs FFmpeg) |
|
|
174
|
+
| `datacut scene.py MyScene -w --quality youtube` | Quality profiles: `preview`, `youtube`, `master`, `alpha`, `lossless` |
|
|
175
|
+
| `datacut scene.py MyScene -w --encoder gpu` | Use the GPU's hardware encoder (`auto`, `gpu`, `cpu`) |
|
|
176
|
+
| `datacut scene.py MyScene -w --incremental` | Re-render only the segments that changed |
|
|
177
|
+
| `datacut scene.py MyScene --autoreload` | Reload the scene when you save |
|
|
178
|
+
| `datacut scene.py MyScene --presenter_mode` | Present the scene slide by slide |
|
|
179
|
+
| `datacut scene.py MyScene -t -w` | Export with a transparent background |
|
|
180
|
+
| `datacut scene.py MyScene -r 1920x1080 --fps 60` | Set a custom resolution and frame rate |
|
|
181
|
+
| `datacut scene.py MyScene --aspect 9:16 --safe_zones youtube_shorts` | Vertical presets (`9:16`, `1:1`, `4:5`, `21:9`) with preview-only safe-zone guides |
|
|
182
|
+
| `datacut scene.py MyScene -s` | Skip to the end and show the final frame |
|
|
183
|
+
| `datacut scene.py MyScene -n 3` | Skip ahead to the third animation |
|
|
184
|
+
|
|
185
|
+
Defaults such as output folders, asset paths, style and video quality live in `datacut/default_config.yml`. To override them, put a `custom_config.yml` in the directory you run DataCut from.
|
|
186
|
+
|
|
187
|
+
## Repository layout
|
|
188
|
+
|
|
189
|
+
| Path | Contents |
|
|
190
|
+
| --- | --- |
|
|
191
|
+
| `datacut/` | The engine (Python package, imported as `datacut`) |
|
|
192
|
+
| `native/` | `datacut_native`, the Rust core built with PyO3 (published as `datacut-native`) |
|
|
193
|
+
| `editor/` | The browser editor, deployed to GitHub Pages |
|
|
194
|
+
| `editor/browser_wasm/` | The Pyodide build: browser wheels, Pango and font loaders |
|
|
195
|
+
| `editor/docs/` | Editor documentation, examples, API Reference and thumbnails |
|
|
196
|
+
| `editor/scripts/` | Generators for the API Reference, thumbnails and fonts |
|
|
197
|
+
| `logo/` | The DataCut logo, rendered with DataCut (`logo/logo.py`) |
|
|
198
|
+
| `tests/` | Test suite |
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
Serve the editor locally:
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
python editor/serve.py
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
The Rust module builds with `maturin` (see `native/README.md`):
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
cd native
|
|
212
|
+
uvx maturin build --release --out dist
|
|
213
|
+
uv pip install dist/datacut_native-*.whl
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
On every push to `main` that touches `datacut/` or `native/`, a GitHub Actions workflow rebuilds the browser wheels, regenerates the API Reference and the Visual Mode thumbnails, and deploys the editor to GitHub Pages.
|
|
217
|
+
|
|
218
|
+
Publishing a GitHub release tagged `vX.Y.Z` (the version in `setup.cfg`) builds `datacut` and the `datacut-native` wheels for every platform and uploads them to PyPI.
|
|
219
|
+
|
|
220
|
+
## Credits
|
|
221
|
+
|
|
222
|
+
DataCut is a fork of [ManimGL](https://github.com/3b1b/manim), the animation engine created by Grant Sanderson. Many thanks to [3Blue1Brown](https://www.3blue1brown.com/) for building it and sharing it with the world.
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
DataCut is released under the MIT license. See [LICENSE.md](LICENSE.md).
|
datacut-0.1.0/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/MathItYT/datacut/main/logo/logo.png" alt="DataCut" width="600">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# DataCut
|
|
6
|
+
|
|
7
|
+
DataCut is an engine and editor for precise, programmatic animated video. You describe a scene in Python, and DataCut renders it on the GPU through **WebGPU**, on your desktop or directly in the browser, with nothing to install.
|
|
8
|
+
|
|
9
|
+
**[Open the DataCut editor in your browser](https://mathityt.github.io/datacut/)**
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from datacut import *
|
|
13
|
+
|
|
14
|
+
class HelloDataCut(Scene):
|
|
15
|
+
def construct(self):
|
|
16
|
+
title = Text("Hello from DataCut")
|
|
17
|
+
circle = Circle(color=BLUE).next_to(title, DOWN)
|
|
18
|
+
self.play(Write(title), name="Intro")
|
|
19
|
+
self.play(ShowCreation(circle))
|
|
20
|
+
self.wait()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Contents
|
|
24
|
+
|
|
25
|
+
- [The browser editor](#the-browser-editor)
|
|
26
|
+
- [Features](#features)
|
|
27
|
+
- [Local installation](#local-installation)
|
|
28
|
+
- [Command line](#command-line)
|
|
29
|
+
- [Repository layout](#repository-layout)
|
|
30
|
+
- [Development](#development)
|
|
31
|
+
- [Credits](#credits)
|
|
32
|
+
- [License](#license)
|
|
33
|
+
|
|
34
|
+
## The browser editor
|
|
35
|
+
|
|
36
|
+
The editor runs the full engine in the browser with **Pyodide** and **WebGPU**. It needs a browser with WebGPU support (a recent Chrome or Edge, for example).
|
|
37
|
+
|
|
38
|
+
- **Plain Python, transformed for you.** Write ordinary synchronous scene code (`self.play(...)`, `self.wait(...)`). The editor reads the code's AST and turns it into browser-ready code when you press Run. The **Generated Web Code** panel shows the result.
|
|
39
|
+
- **Projects with their own file system.** Each project keeps its files, folders and assets (images, video, audio, fonts, 3D models) in the browser. You can import your own `.py` modules, install packages with `micropip`, and share a project as a `.zip`.
|
|
40
|
+
- **A Monaco code editor** with autocompletion for `import *` from any library, hover docs, signature help and linting.
|
|
41
|
+
- **Plain scripts.** A file with no `Scene` runs as an ordinary Python script, and its output appears in the Output panel.
|
|
42
|
+
- **Visual Mode.** A lossless, AST-backed visual editor that edits your code as you work:
|
|
43
|
+
- a drag-and-drop shelf of objects, animations and VFX with thumbnails; you drop an animation or effect onto the object it applies to;
|
|
44
|
+
- a typed live-preview inspector driven by `datacut.typing` hints, which your own classes can use too;
|
|
45
|
+
- a WebGPU gizmo for moving, scaling and rotating in 3D, with deep submobject selection;
|
|
46
|
+
- a pen tool (`PenPath`), graphs bound to axes, and a Typst equation morph;
|
|
47
|
+
- a multi-track timeline (`self.add/remove(..., at=t)`, `play_background`) with magnets that snap the playhead and drops;
|
|
48
|
+
- a keyframe animator, a cubic-Bézier `rate_func` editor, and a DevTools-style CSS panel.
|
|
49
|
+
- **Interactive canvas and timeline** with chapters (`name=` in `self.play`), scrubbing and range selection.
|
|
50
|
+
- **Export** to video or PNG directly from the browser.
|
|
51
|
+
- **Built-in documentation** with a quick tour, a guide to every editor feature, interactive examples you can add as a project in one click, and a full **API Reference**.
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
| Area | What DataCut offers |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| **Rendering** | A WebGPU engine (`wgpu` + WGSL) that runs on the desktop and in the browser, with a native **Rust** core (`datacut_native`) for SVG parsing and per-frame geometry |
|
|
58
|
+
| **VFX and post-processing** | A GPU pipeline with Glow, Gaussian Blur, Drop Shadow, Vignette, Grain, Glitch, Chromatic Aberration, Liquid Glass, masks and `CustomVFX`; cinematic grading (`ColorGrading`, `AnamorphicLensFlare`, `Halation`, `Letterbox`) |
|
|
59
|
+
| **Typography** | Native **Typst** (`Typst`, `TypstText`), LaTeX, Pango text (`Text`, `MarkupText`), a fast SVG parser and path caching |
|
|
60
|
+
| **3D** | `Mesh3D`, `PBRMaterial`, lights, shadow maps, environment maps, and direct loading of `.glb/.gltf/.obj/.ply/.stl` (`load_model`) |
|
|
61
|
+
| **Cinematography** | `look_at`, `follow`/`stop_following`, `CameraPath`, `KeyframePath`, `DepthOfField`, `Haze`, `RotationalBlur` |
|
|
62
|
+
| **Audio** | `Sound` (synthesis and DSP), `SoundClip`, an SFX library (`register_sfx`/`add_sfx`), live mixing, transcription with `faster-whisper` (`Transcript`, `wait_for_word`) and `Subtitles` |
|
|
63
|
+
| **Physics and reactivity** | Spring physics (`SpringTracker`, `SpringAnimation`, `CameraShake`) and reactive state (`State`, `Computed`, `Effect`, `ReactiveStore`) |
|
|
64
|
+
| **Layouts and DataCut CSS** | Declarative layouts (`HStack`, `VStack`, `ZStack`, `FlexBox`, `Grid`, `Card`) styled with CSS: selectors, `var()`, `calc()`, `@media`, the box model, transforms and filters |
|
|
65
|
+
| **UI motion** | CSS transitions and `@keyframes`, 40 motion presets, FLIP `LayoutTransition`, text animators by character, word or line, UI components, and GPU `ShaderFill` gradients |
|
|
66
|
+
| **Media** | Images, SVG, and `VideoMobject`, including `VideoMobject.from_scene(OtherScene)` to embed one scene inside another |
|
|
67
|
+
| **Production** | A navigable timeline (chapters, range export, erasing the future), interactive recording, `SceneTask`, a performance overlay, `PresentationScene`, 2D/3D picking, incremental rendering, quality profiles, GPU video encoding, and vertical presets with safe-zone guides |
|
|
68
|
+
|
|
69
|
+
## Local installation
|
|
70
|
+
|
|
71
|
+
DataCut needs Python 3.10 or higher, [FFmpeg](https://ffmpeg.org/) to export video, and optionally a [LaTeX](https://www.latex-project.org) distribution for `Tex`. On Linux, [Pango](https://pango.org) and its development headers are also required.
|
|
72
|
+
|
|
73
|
+
With `pip`:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
pip install datacut
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
With `uv`, inside a project:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
uv add datacut
|
|
83
|
+
uv run datacut main.py HelloDataCut
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
With `uv`, into the active environment:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
uv pip install datacut
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
DataCut's Rust core, `datacut-native`, is installed with it as a prebuilt wheel for Windows, macOS and Linux.
|
|
93
|
+
|
|
94
|
+
To work on DataCut itself, clone the repository and install it in editable mode, with the Rust core built from `native/` (this needs [Rust](https://rustup.rs)):
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
git clone https://github.com/MathItYT/datacut.git
|
|
98
|
+
cd datacut
|
|
99
|
+
pip install ./native
|
|
100
|
+
pip install -e .
|
|
101
|
+
datacut example_scenes.py OpeningManimExample
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Command line
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
datacut scene.py MyScene
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
opens the scene in an interactive WebGPU window. Common flags:
|
|
111
|
+
|
|
112
|
+
| Command | Effect |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `datacut scene.py MyScene -w` | Render and write a video file (needs FFmpeg) |
|
|
115
|
+
| `datacut scene.py MyScene -w --quality youtube` | Quality profiles: `preview`, `youtube`, `master`, `alpha`, `lossless` |
|
|
116
|
+
| `datacut scene.py MyScene -w --encoder gpu` | Use the GPU's hardware encoder (`auto`, `gpu`, `cpu`) |
|
|
117
|
+
| `datacut scene.py MyScene -w --incremental` | Re-render only the segments that changed |
|
|
118
|
+
| `datacut scene.py MyScene --autoreload` | Reload the scene when you save |
|
|
119
|
+
| `datacut scene.py MyScene --presenter_mode` | Present the scene slide by slide |
|
|
120
|
+
| `datacut scene.py MyScene -t -w` | Export with a transparent background |
|
|
121
|
+
| `datacut scene.py MyScene -r 1920x1080 --fps 60` | Set a custom resolution and frame rate |
|
|
122
|
+
| `datacut scene.py MyScene --aspect 9:16 --safe_zones youtube_shorts` | Vertical presets (`9:16`, `1:1`, `4:5`, `21:9`) with preview-only safe-zone guides |
|
|
123
|
+
| `datacut scene.py MyScene -s` | Skip to the end and show the final frame |
|
|
124
|
+
| `datacut scene.py MyScene -n 3` | Skip ahead to the third animation |
|
|
125
|
+
|
|
126
|
+
Defaults such as output folders, asset paths, style and video quality live in `datacut/default_config.yml`. To override them, put a `custom_config.yml` in the directory you run DataCut from.
|
|
127
|
+
|
|
128
|
+
## Repository layout
|
|
129
|
+
|
|
130
|
+
| Path | Contents |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| `datacut/` | The engine (Python package, imported as `datacut`) |
|
|
133
|
+
| `native/` | `datacut_native`, the Rust core built with PyO3 (published as `datacut-native`) |
|
|
134
|
+
| `editor/` | The browser editor, deployed to GitHub Pages |
|
|
135
|
+
| `editor/browser_wasm/` | The Pyodide build: browser wheels, Pango and font loaders |
|
|
136
|
+
| `editor/docs/` | Editor documentation, examples, API Reference and thumbnails |
|
|
137
|
+
| `editor/scripts/` | Generators for the API Reference, thumbnails and fonts |
|
|
138
|
+
| `logo/` | The DataCut logo, rendered with DataCut (`logo/logo.py`) |
|
|
139
|
+
| `tests/` | Test suite |
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
Serve the editor locally:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
python editor/serve.py
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The Rust module builds with `maturin` (see `native/README.md`):
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
cd native
|
|
153
|
+
uvx maturin build --release --out dist
|
|
154
|
+
uv pip install dist/datacut_native-*.whl
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
On every push to `main` that touches `datacut/` or `native/`, a GitHub Actions workflow rebuilds the browser wheels, regenerates the API Reference and the Visual Mode thumbnails, and deploys the editor to GitHub Pages.
|
|
158
|
+
|
|
159
|
+
Publishing a GitHub release tagged `vX.Y.Z` (the version in `setup.cfg`) builds `datacut` and the `datacut-native` wheels for every platform and uploads them to PyPI.
|
|
160
|
+
|
|
161
|
+
## Credits
|
|
162
|
+
|
|
163
|
+
DataCut is a fork of [ManimGL](https://github.com/3b1b/manim), the animation engine created by Grant Sanderson. Many thanks to [3Blue1Brown](https://www.3blue1brown.com/) for building it and sharing it with the world.
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
DataCut is released under the MIT license. See [LICENSE.md](LICENSE.md).
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
5
|
+
except ImportError: # For Python <3.8 fallback
|
|
6
|
+
from importlib_metadata import version, PackageNotFoundError # type: ignore
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
__version__ = version("datacut")
|
|
10
|
+
except PackageNotFoundError:
|
|
11
|
+
__version__ = "unknown"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from datacut.config import manim_config
|
|
15
|
+
|
|
16
|
+
from typing import TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from datacut.typing import *
|
|
20
|
+
|
|
21
|
+
from datacut.constants import *
|
|
22
|
+
|
|
23
|
+
from datacut.window import *
|
|
24
|
+
|
|
25
|
+
# The browser-only scene runner is intentionally absent on native platforms.
|
|
26
|
+
if sys.platform == "emscripten":
|
|
27
|
+
from datacut.window import run_scene_from_class
|
|
28
|
+
|
|
29
|
+
from datacut.animation.animation import *
|
|
30
|
+
from datacut.animation.composition import *
|
|
31
|
+
from datacut.animation.creation import *
|
|
32
|
+
from datacut.animation.fading import *
|
|
33
|
+
from datacut.animation.growing import *
|
|
34
|
+
from datacut.animation.indication import *
|
|
35
|
+
from datacut.animation.movement import *
|
|
36
|
+
from datacut.animation.numbers import *
|
|
37
|
+
from datacut.animation.physics import *
|
|
38
|
+
from datacut.animation.rotation import *
|
|
39
|
+
from datacut.animation.specialized import *
|
|
40
|
+
from datacut.animation.transform import *
|
|
41
|
+
from datacut.animation.transform_matching_parts import *
|
|
42
|
+
from datacut.animation.update import *
|
|
43
|
+
|
|
44
|
+
from datacut.camera.camera import *
|
|
45
|
+
from datacut.camera.cinematography import CameraPath, KeyframePath, DepthOfField, Haze, RotationalBlur, CameraShake
|
|
46
|
+
|
|
47
|
+
from datacut.mobject.boolean_ops import *
|
|
48
|
+
from datacut.mobject.changing import *
|
|
49
|
+
from datacut.mobject.coordinate_systems import *
|
|
50
|
+
from datacut.mobject.fractals import *
|
|
51
|
+
from datacut.mobject.frame import *
|
|
52
|
+
from datacut.mobject.functions import *
|
|
53
|
+
from datacut.mobject.geometry import *
|
|
54
|
+
from datacut.mobject.interactive import *
|
|
55
|
+
from datacut.mobject.matrix import *
|
|
56
|
+
from datacut.mobject.mobject import *
|
|
57
|
+
from datacut.mobject.mobject_update_utils import *
|
|
58
|
+
from datacut.mobject.number_line import *
|
|
59
|
+
from datacut.mobject.numbers import *
|
|
60
|
+
from datacut.mobject.probability import *
|
|
61
|
+
from datacut.mobject.shape_matchers import *
|
|
62
|
+
from datacut.mobject.subtitles import *
|
|
63
|
+
from datacut.mobject.svg.brace import *
|
|
64
|
+
from datacut.mobject.svg.drawings import *
|
|
65
|
+
from datacut.mobject.svg.string_mobject import *
|
|
66
|
+
from datacut.mobject.svg.svg_mobject import *
|
|
67
|
+
from datacut.mobject.svg.special_tex import *
|
|
68
|
+
from datacut.mobject.svg.tex_mobject import *
|
|
69
|
+
from datacut.mobject.svg.text_mobject import *
|
|
70
|
+
from datacut.mobject.svg.typst_mobject import *
|
|
71
|
+
from datacut.mobject.three_dimensions import *
|
|
72
|
+
from datacut.mobject.types.dot_cloud import *
|
|
73
|
+
from datacut.mobject.types.image_mobject import *
|
|
74
|
+
from datacut.mobject.types.point_cloud_mobject import *
|
|
75
|
+
from datacut.mobject.types.shader_mobject import *
|
|
76
|
+
from datacut.mobject.types.surface import *
|
|
77
|
+
from datacut.mobject.types.video_mobject import *
|
|
78
|
+
from datacut.mobject.types.vectorized_mobject import *
|
|
79
|
+
from datacut.mobject.value_tracker import *
|
|
80
|
+
from datacut.mobject.vector_field import *
|
|
81
|
+
from datacut.mobject.mesh3d import *
|
|
82
|
+
from datacut.mobject.materials import *
|
|
83
|
+
from datacut.mobject.lights import *
|
|
84
|
+
from datacut.mobject.model import *
|
|
85
|
+
|
|
86
|
+
from datacut.scene.interactive_scene import *
|
|
87
|
+
from datacut.scene.presentation_scene import *
|
|
88
|
+
from datacut.scene.scene import *
|
|
89
|
+
from datacut.scene.safe_zones import *
|
|
90
|
+
from datacut.scene.sound import *
|
|
91
|
+
from datacut.scene.sfx import *
|
|
92
|
+
from datacut.scene.transcript import *
|
|
93
|
+
from datacut.scene.scene_task import *
|
|
94
|
+
|
|
95
|
+
from datacut.renderer.shader_source import get_colormap_code
|
|
96
|
+
from datacut.renderer.uniform_block import *
|
|
97
|
+
|
|
98
|
+
from datacut.utils.vfx_presets import *
|
|
99
|
+
from datacut.utils.browser_fonts import *
|
|
100
|
+
from datacut.utils.bezier import *
|
|
101
|
+
from datacut.utils.cache import *
|
|
102
|
+
from datacut.utils.color import *
|
|
103
|
+
from datacut.utils.dict_ops import *
|
|
104
|
+
from datacut.utils.debug import *
|
|
105
|
+
from datacut.utils.directories import *
|
|
106
|
+
from datacut.utils.file_ops import *
|
|
107
|
+
from datacut.utils.images import *
|
|
108
|
+
from datacut.utils.iterables import *
|
|
109
|
+
from datacut.utils.paths import *
|
|
110
|
+
from datacut.utils.rate_functions import *
|
|
111
|
+
from datacut.utils.simple_functions import *
|
|
112
|
+
from datacut.utils.sounds import *
|
|
113
|
+
from datacut.utils.space_ops import *
|
|
114
|
+
from datacut.utils.svg_export import *
|
|
115
|
+
from datacut.utils.tex import *
|
|
116
|
+
|
|
117
|
+
from datacut.reactive import *
|
|
118
|
+
from datacut.css import *
|
|
119
|
+
from datacut.layout import *
|
|
120
|
+
|
|
121
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
from addict import Dict
|
|
3
|
+
|
|
4
|
+
from datacut import __version__
|
|
5
|
+
from datacut.config import manim_config
|
|
6
|
+
from datacut.config import parse_cli
|
|
7
|
+
import datacut.extract_scene
|
|
8
|
+
from datacut.utils.cache import clear_cache
|
|
9
|
+
from datacut.window import Window
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
from IPython.terminal.embed import KillEmbedded
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import sys
|
|
16
|
+
import time
|
|
17
|
+
import traceback
|
|
18
|
+
|
|
19
|
+
from datacut.logger import log
|
|
20
|
+
from datacut.scene.scene import ReloadScene
|
|
21
|
+
|
|
22
|
+
sys.path.insert(0, os.getcwd())
|
|
23
|
+
|
|
24
|
+
from typing import TYPE_CHECKING
|
|
25
|
+
if TYPE_CHECKING:
|
|
26
|
+
from argparse import Namespace
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def run_scenes():
|
|
30
|
+
"""
|
|
31
|
+
Runs the scenes in a loop and detects when a scene reload is requested.
|
|
32
|
+
"""
|
|
33
|
+
# Create a new dict to be able to upate without
|
|
34
|
+
# altering global configuration
|
|
35
|
+
scene_config = Dict(manim_config.scene)
|
|
36
|
+
run_config = manim_config.run
|
|
37
|
+
|
|
38
|
+
if run_config.show_in_window:
|
|
39
|
+
# Create a reusable window
|
|
40
|
+
window = Window(**manim_config.window)
|
|
41
|
+
scene_config.update(window=window)
|
|
42
|
+
|
|
43
|
+
scene = None
|
|
44
|
+
while True:
|
|
45
|
+
try:
|
|
46
|
+
# Blocking call since a scene may init an IPython shell()
|
|
47
|
+
scenes = datacut.extract_scene.main(scene_config, run_config)
|
|
48
|
+
for scene in scenes:
|
|
49
|
+
scene.run()
|
|
50
|
+
return
|
|
51
|
+
except KillEmbedded:
|
|
52
|
+
# Requested via the `exit_raise` IPython runline magic
|
|
53
|
+
# by means of the reload_scene() command, which starts over
|
|
54
|
+
scene_config.update(resume_time=None, resume_view=None)
|
|
55
|
+
except ReloadScene as reload:
|
|
56
|
+
# The scene's file was saved, see Scene.check_hot_reload: made again, carrying on
|
|
57
|
+
# from where this one had got to
|
|
58
|
+
reload.scene.release_for_reload()
|
|
59
|
+
run_config.is_reload = True
|
|
60
|
+
scene_config.update(resume_time=reload.resume_time, resume_view=reload.resume_view)
|
|
61
|
+
except KeyboardInterrupt:
|
|
62
|
+
break
|
|
63
|
+
except Exception:
|
|
64
|
+
# A scene made again from its file which fails is shown as failing, and made
|
|
65
|
+
# again when the file is next saved, rather than closing the window
|
|
66
|
+
if scene_config.get("resume_time") is None or scene_config.get("window") is None:
|
|
67
|
+
raise
|
|
68
|
+
traceback.print_exc()
|
|
69
|
+
log.error("The scene failed. Fix it and save: it is made again then")
|
|
70
|
+
if scene is not None:
|
|
71
|
+
scene.release_for_reload()
|
|
72
|
+
if not wait_for_change(scene_config.window, run_config.file_name):
|
|
73
|
+
return
|
|
74
|
+
run_config.is_reload = True
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def wait_for_change(window: Window, path: str) -> bool:
|
|
78
|
+
"""
|
|
79
|
+
Keeps the window answering until the file is saved again so as to compile, True then,
|
|
80
|
+
or until the window is closed, False
|
|
81
|
+
"""
|
|
82
|
+
try:
|
|
83
|
+
mtime = os.path.getmtime(path)
|
|
84
|
+
except OSError:
|
|
85
|
+
return False
|
|
86
|
+
while not window.is_closing:
|
|
87
|
+
window.poll_events()
|
|
88
|
+
time.sleep(0.1)
|
|
89
|
+
try:
|
|
90
|
+
new_mtime = os.path.getmtime(path)
|
|
91
|
+
except OSError:
|
|
92
|
+
continue
|
|
93
|
+
if new_mtime == mtime:
|
|
94
|
+
continue
|
|
95
|
+
mtime = new_mtime
|
|
96
|
+
try:
|
|
97
|
+
with open(path, encoding="utf-8") as file:
|
|
98
|
+
compile(file.read(), path, "exec")
|
|
99
|
+
except SyntaxError as error:
|
|
100
|
+
log.error(f"Not reloaded: {path}, line {error.lineno}: {error.msg}")
|
|
101
|
+
continue
|
|
102
|
+
return True
|
|
103
|
+
return False
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def main():
|
|
107
|
+
"""
|
|
108
|
+
Main entry point for DataCut.
|
|
109
|
+
"""
|
|
110
|
+
print(f"DataCut \033[32mv{__version__}\033[0m")
|
|
111
|
+
|
|
112
|
+
args = parse_cli()
|
|
113
|
+
if args.version and args.file is None:
|
|
114
|
+
return
|
|
115
|
+
if args.clear_cache:
|
|
116
|
+
clear_cache()
|
|
117
|
+
|
|
118
|
+
run_scenes()
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
if __name__ == "__main__":
|
|
122
|
+
main()
|
|
File without changes
|