Blender architecture

Version: $Id: architecture.html,v 1.3 2001/08/24 13:28:33 nzc Exp $

This document describes the structure of Blender, and the reasoning behind this structure. It provides a high-level view of the components that make up Blender, and their interactions. When Blender needs to change, it should be consistent with this overall view.

Index

1. Overview
2. Top level requirements
3. Functional decomposition
3.1. Top-level system view
3.2. mainloop modules
3.3. handleable modules
3.4. library modules
3.5. system modules
3.6. Interfaces
3.7. Modules and migration
4. Implementation issues
4.1. Current implementation
4.2. Physical storage model
4.3. Conceptual storage model

1. Overview

This document describes the structure of Blender. It gives a break-down of the functionality, and a description of all interfaces that are used between parts.

2. Top level requirements

Top-level requirements (to be filled in).

3. Functional decomposition

This section details the relations between different kinds of functionality wrapped in modules, and the specific functionality that is currently contained in them. This is a description of how we want the system to be in the end, and not the current situation. A description of the current implementation is given in Section 3. The internal structure of modules is a separate issue. A description of this structure is given elsewhere.

3.1. Top-level system view

There are several kinds of modules in the Blender system. Each type of module has distinct responsibilities attaches to it. The relation between these elements is given in Figure 1.

Figure 1: The relations between module types in Blender.

A more detailed view of this system is given in Figure 2. This view presents several modules needed for making a complete Blender.

Figure 2: The relations between module types in Blender.

The implementation is centred around two instantiations of modules: a system and a mainloop. The mainloop provides the coherence between the functional modules. There may be more than one mainloop module in the system, that can hand over control to each other. A dedicated application only has one mainloop.

The system class act as a wrapper for the devices, and provides common functionality, such as remembering command line options, global variables, Making a new executable would typically consist of selecting a set of functional modules and devices, and bind these together with one or more mainloops, and a system class.

3.2. mainloop modules

3.3. handleable modules

3.4. library modules

Libraries handle large numbers of related functions. They will usually be either language or platform specific, or both.

3.5. system modules

There will typically be a system class for a specific platform, or a specific set of libraries. Currently we use OpenGL/OpenAL/Glut, but these low-level api-s are not available on all our platforms (e.g. PS2, hand-held phones).

3.6. Interfaces

There are several interfaces to which Blender modules need to comply. The specification of the interfaces is given in separate documents.

3.7. Modules and migration

The long-term target is a completely redesigned Blender, which will incorporate all requirements we have concerning modularity, maintainability, and extensibility. Keeping the current code is neither required, nor forbidden. There needs to be a balance between inverting in long-term work (structuring, integrating, documenting) and short-term (immediate improvements, features, bug fixes).

4. Implementation issues

These sections deal with several implementation issues that will have influence on the available migration trajectories.

4.1. Current implementation

The current implementation differs in several areas from the desired structure. A diagram of the current structure is given in Figure 3. Not all modules are drawn here: some libraries have been left out.

Figure 3: The current module interdependencies in Blender.

The migration to a new architecture can be facilitated if code chunks can be recycled on component basis. Figure 4 shows the intermediary model. Parallel development of modules will be possible if the interfaces are concise, and stable. Designing such interface will be the major task for the redesign.

Figure 4: The first intermediary structure target.

4.2. Physical storage model

Storage in memory is simple: a straightforward list of lists of structs. This structure is directly written to file and vice versa. The list of lists is the Main structure. There is also a mechanism that handles versioning for the files (see the documentation on the dna system).

4.3. Conceptual storage model

Piece about the data model (oops, but also the 'under-water' model)