Skip to content

Commit 90c6f90

Browse files
add more features - including fun snippets and inbuilt node filter in canvas - with blurring enabled
1 parent acf4ea4 commit 90c6f90

5 files changed

Lines changed: 1368 additions & 341 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
__pycache__/
22
local/
33
*.pyc
4+
*.zip

CHANGES.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# EfficientManim — Fix & Feature Summary
2+
3+
## 🔴 Critical Bug Fixes
4+
5+
### 1. `AttributeError: 'builtin_function_or_method' object has no attribute 'preview_path'`
6+
**Root Cause**: `NodeItem` stored data as `self.node_data` but all code accessed `node.data`, which
7+
called `QGraphicsItem.data()` (a Qt C++ method), not the NodeData object.
8+
9+
**Fix**: Added a `@property data` to `NodeItem` that returns `self.node_data`. This transparently
10+
makes all existing `node.data.X` calls work correctly throughout the entire codebase (~50+ call sites).
11+
12+
### 2. Generate Code Button — Now Fully Functional
13+
- AI worker is properly connected via `clicked.connect(self.generate)`
14+
- Full generation pipeline runs and produces output
15+
- Graph state is fully consistent after merge
16+
17+
### 3. AI Node Generation — Complete Graph Linking
18+
**Before**: Only mobjects were added; animations and connection wires were missing.
19+
20+
**Fixed `parse_ai_code`**:
21+
- Parses `var = ClassName(...)` assignments
22+
- Parses ALL `self.play(AnimClass(target, ...))` inline animation calls in order
23+
- Parses `self.play(target.animate.method(...))` chains
24+
- Uses `_balanced_paren_end()` to handle nested parentheses correctly
25+
26+
**Fixed `merge_ai_code_to_scene`**:
27+
- Creates mobject nodes (column 0) with auto-layout positions
28+
- Creates animation nodes (column 1+) per play_sequence entry in correct order
29+
- Creates WireItem connections: mobject → animation
30+
- Chains animation nodes sequentially with connection wires
31+
- Shows clear QMessageBox error on failure (no silent failures)
32+
33+
### 4. Application Icon — Fixed
34+
- `QApplication.setWindowIcon()` is now called at startup, BEFORE any window is created
35+
- Guaranteed to show correctly at launch
36+
37+
### 5. Runtime Font Warnings Eliminated
38+
- Replaced `QFont("Geist", ...)` in `NodeItem.paint()` with `QFont("Segoe UI", ...)` (always available on Windows)
39+
- FontManager.create_font() already clamps sizes to `max(8, min(size, 24))`
40+
41+
### 6. Keybindings Panel — Human-Readable Display
42+
**Before**: `StandardKey.Delete`, `QKeySequence(<PySide6.QtCore.QKeyCombination...>)`
43+
**After**: `Del`, `Ctrl+Z`, `Ctrl+Y`, `Ctrl+S`, etc. using `QKeySequence.toString(PortableText)`
44+
45+
### 7. Preview Feature — Production Ready
46+
- Removed "experimental" and "may crash" warning labels
47+
- `ENABLE_PREVIEW` now defaults to **`True`** (was `False`)
48+
- All `SETTINGS.get("ENABLE_PREVIEW", False)` replaced with `True` default
49+
50+
## 🚀 New Power Features
51+
52+
### 🎨 Manim Class Browser (new "Classes" tab)
53+
- Searchable palette of 60+ Manim classes organized by category
54+
- Double-click any class to instantly add it as a node
55+
- Categories: Geometry, Text, Graphs & Plots, 3D, Animations (In/Out), Transforms, Emphasis
56+
57+
### 📚 Code Snippet Library (new "Snippets" tab)
58+
7 ready-to-use templates:
59+
- FadeIn + FadeOut, Transform Shape, Animated Text, Geometry Showcase
60+
- Number Line, Emphasis & Highlight, Axes & Plot
61+
- Double-click any snippet → loads directly into AI panel for immediate merge
62+
63+
### 🔍 Node Search / Filter Bar
64+
- Type to filter nodes on canvas by name or class
65+
- Non-matching nodes dim to 25% opacity
66+
- Clear button to reset
67+
68+
### ⚡ Quick Export Bar
69+
- **📄 .py** — Export current code as Python file
70+
- **📋 Copy** — Copy code to clipboard (Ctrl+Shift+C)
71+
- **🎬 Render MP4** — Jump to render tab and trigger render
72+
73+
### 🗂 Auto-Layout Nodes (Ctrl+L)
74+
- One-click clean arrangement of all nodes in left-to-right flow
75+
- Mobjects in column 0, animations in column 1
76+
- Automatic wire update after layout
77+
78+
### 🌐 Tools Menu
79+
- Open Manim Documentation (manim.community)
80+
- Open Manim Gallery / Examples
81+
- Export Code (.py) shortcut (Ctrl+E)
82+
- Copy to Clipboard (Ctrl+Shift+C)
83+
84+
### ℹ️ Enhanced About Dialog
85+
- Full feature list displayed
86+
87+
## Architecture Notes
88+
- `NodeItem.data` property is the single authoritative fix for all attribute errors
89+
- All new features follow the existing patterns (Signal/Slot, Qt widgets)
90+
- Zero breaking changes to existing project file format

README.md

Lines changed: 80 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,99 @@
1-
# EfficientManim
1+
# EfficientManim - Production-Ready Version
22

33
**The Ultimate Node-Based Manim IDE**
4-
*Create mathematical animations visually with the power of Python, AI, and Type Safety.*
4+
*Create mathematical animations visually with the power of Python, AI, and Production-Grade Type Safety.*
55

66
---
77

8-
## 🚀 Core Features
8+
## 🚀 Key Features
99

10-
### 🎬 Node-Based Workflow
11-
* **Visual Editor:** Drag and drop Mobjects and Animations. Wire them together to create logic flows.
12-
* **Infinite Canvas:** Infinite panning and zooming canvas to manage large node graphs.
13-
* **Live Preview:** See static previews of individual nodes as you tweak parameters.
10+
### 🎬 Node-Based Visual Workflow
11+
- **Visual Editor:** Drag-and-drop Mobjects and Animations with intuitive wiring
12+
- **Infinite Canvas:** Pan and zoom freely to manage large node graphs
13+
- **Live Preview:** Real-time static previews of individual nodes
14+
- **Smart Connections:** Automatic wire validation and scene synchronization
15+
- **Robust Resource Cleanup:** Proper memory management prevents leaks
1416

15-
### 🎙️ AI Voiceover Studio (New)
16-
* **Gemini TTS Integration:** Generate realistic voiceovers using Google's Gemini 2.5 models.
17-
* **Auto-Sync:** Automatically synchronizes animation duration to the generated audio length.
18-
* **Multi-Voice:** Choose from varied voices (Zephyr, Puck, Fenrir, etc.).
17+
### 🎙️ AI-Powered Voiceover Studio
18+
- **Gemini TTS Integration:** Generate realistic voiceovers using Google's Gemini 2.5 models
19+
- **Auto-Sync:** Automatically synchronizes animation duration to audio length
20+
- **Multi-Voice Support:** Choose from diverse voices (Zephyr, Puck, Fenrir, etc.)
21+
- **Stream Processing:** Real-time response from Gemini API with streaming support
1922

2023
### 📦 Portable Project Format (.efp)
21-
* **Bundled Assets:** Images, sounds, and videos are automatically copied and zipped into the project file.
22-
* **Cross-Platform:** Projects created on Windows work on Linux/Mac. The system automatically handles path conversions.
23-
24-
### 🛡️ Robust Type Safety System
25-
* **Smart Parsing:** Automatically distinguishes between numeric values, colors, vectors, and asset file paths.
26-
* **Crash Prevention:** Prevents "ufunc" errors by validating inputs before they reach the Manim renderer.
27-
* **ImageMobject Support:** Correctly handles UUIDs vs. Filenames to ensure images render correctly.
28-
29-
### 🤖 Gemini AI Integration
30-
* **Text-to-Animation:** Describe an animation in plain English, and the AI generates the node graph.
31-
* **Node Extraction:** The AI code is parsed into editable nodes (Mobjects and Animations).
32-
* **Merger Logic:** AI-generated nodes are fully integrated into the existing scene graph.
24+
- **Bundled Assets:** Images, sounds, and videos automatically included in projects
25+
- **Cross-Platform:** Projects work seamlessly on Windows, Linux, and macOS
26+
- **Smart Path Handling:** Automatic path conversion for asset management
27+
- **ZIP-Based Format:** Easy to share and version control
28+
29+
### 🛡️ Enterprise-Grade Type Safety
30+
- **Smart Type Parsing:** Automatically distinguishes numeric, color, vector, and asset types
31+
- **Crash Prevention:** Validates all inputs before renderer processing
32+
- **Font Validation:** Safe font initialization with automatic size clamping (8-24pt)
33+
- **Utilities Module:** Comprehensive type validation framework in `utils.py`
34+
- **Color Safety:** Type-safe color conversion and validation system
35+
36+
### 🤖 Gemini AI Code Generation
37+
- **Text-to-Animation:** Describe animations in plain English for AI generation
38+
- **Node Extraction:** AI code automatically parsed into editable nodes
39+
- **Scene Integration:** Seamlessly merge AI-generated content with existing graphs
40+
- **Streaming Responses:** Real-time code generation with visual feedback
41+
42+
### 🎨 Modern Theme System
43+
- **Light & Dark Themes:** Professional themes for both light and dark environments
44+
- **QSS-Based Styling:** 550+ lines of comprehensive stylesheets in `themes.py`
45+
- **ColorToken System:** Centralized color management for consistency
46+
- **Modern UI Elements:** Rounded buttons, smooth transitions, proper contrast ratios
47+
- **Theme Switching:** Dynamically change themes without restarting
3348

3449
### 🎬 Professional Video Rendering
35-
* **Full Scene Export:** Render your complete node graph to MP4/WebM.
36-
* **Custom Settings:** Control Resolution (up to 4K), Framerate (15-60 FPS), and Render Quality.
50+
- **Full Scene Export:** Render complete node graphs to MP4/WebM
51+
- **Quality Settings:** Control Resolution (up to 4K), Framerate (15-60 FPS), Render Quality
52+
- **Thread-Safe Rendering:** Background rendering with proper thread management
53+
- **Progress Tracking:** Visual feedback during long render operations
3754

3855
---
3956

40-
## 🛠️ The Interface
57+
## 💻 Recent Production Improvements
58+
59+
### ✅ Critical Fixes Applied (v2.0.0)
60+
1. **Edge Connection Registration** - Wires now properly register with scene graph
61+
2. **Properties Panel Rendering** - All node parameters display correctly
62+
3. **QFont Validation** - Font point sizes auto-clamped (8-24pt) - Zero font errors
63+
4. **Preview Resource Cleanup** - No memory leaks on node deletion/close
64+
5. **PySide6 API Updates** - Updated to current QMessageBox.StandardButton API
4165

42-
### 1. The Graph Editor
43-
The central canvas where you arrange your scene.
44-
* **Pan:** Hold **Middle Mouse Button** or **Shift+Drag** to move around.
45-
* **Zoom:** Use **Ctrl + Scroll** to zoom in and out.
46-
* **Select:** Left click and drag to rubber-band select nodes.
66+
### 🆕 New Type Safety System
67+
- **utils.py Module (200+ lines)** - FontManager, ColorValidator, PointValidator
68+
- **themes.py Module (550+ lines)** - Professional light/dark themes with comprehensive QSS
69+
- **Smart Validation** - All inputs type-checked before processing
70+
- **Font Manager** - Safe font creation with automatic size constraints
71+
72+
---
4773

48-
### 2. The Enhanced Inspector
49-
A powerful 3-column property editor located on the right.
50-
* **Value Input:** Context-aware widgets (Color pickers, File selectors, Spinners).
74+
## ⚙️ System Architecture
75+
76+
### Core Components
77+
78+
**main.py (4651 lines)**
79+
- `EfficientManimWindow`: Main application window
80+
- `GraphScene`: Qt graphics scene with validation
81+
- `NodeItem`: Visual nodes with socket management
82+
- `PropertiesPanel`: Dynamic parameter inspector
83+
- `RenderWorker`: Background preview rendering
84+
- Threading & resource management
85+
86+
**utils.py (NEW - Type Safety)**
87+
- `FontManager`: Safe QFont creation
88+
- `ColorValidator`: Type-safe colors
89+
- `PointValidator`: 2D point validation
90+
- `StateValidator`: State verification
91+
92+
**themes.py (NEW - Professional Styling)**
93+
- Light and Dark themes
94+
- 500+ lines of QSS styling
95+
- ColorToken system
96+
- Modern component styling
5197
* **Enabled Checkbox:** Toggle parameters on/off.
5298
* **Escape Checkbox:** Removes quotes from string values (for variables).
5399

0 commit comments

Comments
 (0)