GSoC 2025 - Week 12
This week, I completed the Canvas related changes.
Here is the progress I made:
- PR #932 (merged) - Rendering Animations support
- A common context manager to temporarily override any object property
- A context manager to suppress stdout - to suppress Blender stdout outputs during rendering
- Refactored
frame_object
andsnapshot
methods ofCanvas
. Added frame number support forsnapshot
- Added
animation
method toCanvas
tqdm
based progress display- Blender’s Video Sequence Editor API to generate final mp4 from image sequence
- PR #937 (merged) - Fixed Entity Type discrepancies
- Fixed the default entity type being
molecule
for Blender object’s bug - Added new entity types for
StarFile
andCellPack
- Added tests to ensure entity type matches the corresponding object’s
mn.entity_type
for all entities
- Fixed the default entity type being
- PR #938 (merged) - Frame Views support for Canvas
- Added ability to frame camera to one or more views
- For trajectories, both selection phrases and
AtomGroup
s can be used to get views - Added a common entity method to return views (defaults to entity object)
- Added a
Camera
class toCanvas
to support basic camera settings (focal length, clip distances, rotation, etc) - Added support for preset viewpoints that can be used when framing views and objects
- PR #940 (merged) - Added MDAnalysisTests dependency
- PR #941 (merged) - Added density examples to docs
- PR #942 (merged) - Added Canvas examples to docs
Here are some learnings from this week:
- Python’s
ExitStack
fromcontextlib
can be very useful when multiplewith
contexts have to be created - we use this to create temporary overrides of several render settings before creating the render images and animations - Most of what is available through operators for Blender’s Video Sequence Editor can be done through API as well, which has the added advantage that it is faster and doesn’t require the context to be present
- Contents of VSE take precedence when rendering images / animations in Blender, so they must be cleared if setup temporarily
- Blender’s EnumProperty defaults to the first value when the default is not specified, so it is good to explicitly set a default
- Blender’s
camera_to_view_selected
(bpy.ops.view3d.camera_to_view_selected()
) is a great way to frame a selection. Care should be taken to ensure only what is required is selected (and restored) before calling this operator - A set of vertices can be turned to an object using
from_pydata
ofbpy.data.meshes
that can be used to create bounding box objects - Python’s
Literal
fromtyping
module for literal annotations and theget_args
call for checks bpy.utils.expose_bundled_modules()
is needed to access Blender’s bundledopenvdb
package in the background mode (bpy
)
This week was the official final week of GSoC 2025.
Next week, I will add the following additional documentation:
- Trajectory Annotations under Tutorials > MDAnalysis - with examples of the bundled annotations
- Generic Annotations API and writing custom Annotations under API > Annotations
- Trajectory Styles examples under Tutorials > MDAnalysis > Styles
I will submit the final GSoC 2025 report as a blog post here end of next week - on or before 08/31.
This post is licensed under CC BY 4.0 by the author.