ANIMA
Anima is a Python framework for Blender focused on mathematical visualizations, procedural animations, and educational content. It provides tools for animating curves, rendering LaTeX text, managing scenes, and supporting a streamlined development workflow.
- Tools for animating curves, splines, and geometric objects
- LaTeX text rendering as animated 3D glyphs
- Bézier spline and curve utilities
- Automated scene setup and cleanup
- Hot reload support for rapid development
- uv (Python package manager)
- GNU Make (for building, testing, and running)
- Python 3.11+ (specifically 3.11.4 - 3.11.13 for Blender compatibility)
- Blender (4.0+ recommended)
- Visual Studio Code (optional, but recommended for development)
-
Clone the Repository
git clone https://github.com/8bit-euclid/Anima.git cd Anima -
Configure Blender Settings
Edit
pyproject.tomlto specify your Blender version and installation directory:[tool.blender] version = "4.5.3" install-dir = "~/Applications/blender/"
Note: Your Blender directory must follow the naming convention
blender-{version}-{platform}(e.g.,blender-4.5.3-linux-x64) -
Install the Project
make install
After installation, verify the setup by running tests:
make testThe project includes several make targets for common development tasks. Run make help to see all available targets, or use these essential commands:
| Command | Description |
|---|---|
make help |
Show all available targets with descriptions |
make install |
Install the project and its dependencies |
make install-dev |
Install the project in development mode |
make install-blender-deps |
Install Blender-specific dependencies |
make run |
Run the project |
make test |
Run all tests |
make format |
Format code using black and isort |
make lint |
Lint the project using pylint and flake8 |
make clean |
Clean build artifacts and cache files |
make all |
Run the complete workflow (clean, format, lint, install, and test) |
To upgrade to a new Blender version:
- Install the new Blender version following the naming convention
- Update
version = "4.6.0"inpyproject.toml - Run
make install
The system automatically updates the bpy dependency and paths to match.
To start Blender using the Blender Development extension in Visual Studio Code:
make run- Open the Anima project folder in VSCode and navigate to the
run.pyfile. - Select Blender: Start from the command palette (
Ctrl+Shift+P→ "Blender: Start"). - When prompted, select the Blender executable from your installation directory.
- Blender will launch with the current project loaded, enabling rapid development and testing.
- Run
animain Blender by selecting Blender: Run Script from the command palette (Ctrl+Shift+P→ "Blender: Run Script"). - Repeat step 5 to hot-reload recent changes into Blender.
To streamline step 5, you can assign a custom key binding (e.g., Ctrl+Shift+B) to the Blender: Run Script command in VSCode:
- Open the command palette (
Ctrl+Shift+P) and search for "Preferences: Open Keyboard Shortcuts". - In the search bar, type
Blender: Run Script. - Click the pencil icon next to the command and press your desired key combination (e.g.
Ctrl+Shift+B). - Press Enter to save the key binding.
Now, you can quickly hot-reload recent changes in Blender using your chosen shortcut.
Anima includes a built-in logging system powered by loguru that provides structured, colorized output for debugging and monitoring.
The logger can be configured using environment variables:
ANIMA_LOG_LEVEL: Set the logging level (default:DEBUG)- Options:
TRACE,DEBUG,INFO,WARNING,ERROR,CRITICAL
- Options:
ANIMA_LOG_SHOW_FUNCTION: Show function names in logs (default:0)- Set to
1to enable
- Set to
ANIMA_LOG_SHOW_PROCESS: Show process and thread IDs (default:0)- Set to
1to enable
- Set to
Import and use the logger in your code:
from anima.diagnostics import logger, format_output
# Basic logging examples
logger.trace("This is a trace message")
logger.info("Animation started")
logger.debug("Processing curve data")
logger.warning("Texture not found, using default")
logger.error("Failed to load mesh")
# Format output with title
output = format_output("Render Settings", "Resolution: 1920x1080\nSamples: 128")
logger.info(output)To configure logging behavior, set the environment variables before running Anima.
On Linux/macOS:
export ANIMA_LOG_LEVEL=INFO
export ANIMA_LOG_SHOW_FUNCTION=1
make runAlternatively, set them immediately before the run command:
ANIMA_LOG_LEVEL=INFO ANIMA_LOG_SHOW_FUNCTION=1 make runThis project is a work in progress. Usage instructions and examples will be sporadically added as development progresses.