Setup

HyperBlend setup.

Contains HyperBlend setup scripts.

Initializes logging and checks directory structure and Blender version.

Internal checks are performed in tandem with project structure defined in definitions.

Initialization

This module contains the initialization functions for HyperBlend.

Running the initialization populates setup.runtime_environment. After this, the values in runtime are not supposed to be changed.

You can also change the logging options in this file.

_check_blender_version(runtime: RuntimeEnvironment)

Check the installed Blender version and set the corresponding variable in the runtime environment.

On a Windows machine, the latest supported version is selected. Supported versions are listed in root/src/definitions/app_info.toml.

_check_operating_system(runtime: RuntimeEnvironment)

Check the operating system and set the corresponding variable in the runtime environment.

Warning

If the operating system is not recognized (Windows or Linux), the program will exit.

Raises:

NotImplementedError – If the operating system is not supported, i.e., Mac OS.

_init_logging()

Initializes global logger.

By default, the logging level is info. Logging options can only be changed by editing the source code in this method.

_load_app_info(runtime: RuntimeEnvironment)

Load application information from the app info from root/src/definitions/app_info.toml.

This function reads the application information file, which contains metadata about HyperBlend, such as the application version and supported Blender versions. The data is then stored in the runtime environment for later use.

Raises:

FileNotFoundError – If the app info file is not found. This is an unrecoverable error.

initialize()

Initializes HyperBlend and provides the runtime environment object.

Directory structure is checked and missing directories created as necessary. Dynamically checks operating system and found Blender versions on Windows machine. On Linux, there are no dynamic checks performed.

Returns:

RuntimeEnvironment object

Directory check

This module checks the directory structure of the project and ensures that all required directories and files are present.

RECOGNIZED_KEYS = ['name', 'type', 'extensions']

List of recognized keys in the directory structure definition file.

_process_dir_struct_sub_entry(sub_dict: dict, dir_list)

Process a subdictionary of the directory structure definition file.

This function is called recursively to process all subdirectories. It checks if the directory exists and if it contains the expected files. If the directory does not exist, it creates it. If the expected files are not present, it throws an error.

Parameters:
  • sub_dict – The subdictionary to process.

  • dir_list – The list of directories to build the path.

Returns:

None

Raises:

FileNotFoundError – If one of the expected files is not present. This is unrecoverable error.

check_directory_structure(runtime: RuntimeEnvironment)

Checks the directory structure of the project.

Runtime environment

This script contains similar data to the src.constants module except that rather than being actual hard-coded constants, they are inferred during initialization of HyperBlend.

class RuntimeEnvironment

Class to hold runtime environment variables for HyperBlend.

This class is used to store the runtime environment variables for HyperBlend. The values are set during initialization and should not be changed afterwards, which is why only getters are exposed outwards. The class is supposed to be populated by the setup.initialization module.

property blender_executable_path
property hyperblend_version
property operating_system_string
property supported_blender_versions