Skip to content

Development

ranjian0 edited this page Mar 3, 2020 · 12 revisions

Building Tool Development Guide

1. Getting Started

A basic understanding of Github, Git and blender python api is required.

2. Project Structure

The source code for building tool is laid out in an obvious manner.

.core
    .window
        __init__.py
        window.py
        window_ops.py
        window_props.py
        window_types.py

    ...
    __init__.py
    generic.py
    register.py

.utils
    util_common.py
    util_geometry.py
    util_material.py
    util_mesh.py

    ...
__init__.py

In the root folder __init__.py can be found which servers as the addon initialization. You can expect to find:

  • The addon bl_info used by Blender's Python API for addon meta data.
  • UI definition for the addon's main panels.
  • register and unregister functions.

Also in the root folder, a utils folder. This contains a collection of useful reusable modules and functions. Great effort has been taken to keep related functionality in common files.

Finaly, the guts of the addon is a folder called core. This folder contains collections of modules alongside some python files. The files include:

  • __init__.py
  • register.py - provides a centralized place to register classes.
  • generic.py - contains all properties that are used by more than one module.

The modules include:

  • window
  • door
  • roof
  • floorplan
  • floors

with more to be added.

Each of this modules contains at least 5 python files:

  • __init__.py
  • mod.py - contains a class to build geometry and validate the blender context.
  • mod_ops.py - contains operators required by the module
  • mod_props.py - contains properties required by the module.
  • mod_types.py - contains helper functions used by the module operator.

where mod is the name of the module.

3. Environment Setup

To start contributing to the development of Building Tool you need to have the appropriate environment setup. Developing blender addons can be a somewhat tricky especially when using an external editor. I will provide a short overview of my setup for developing Building Tool.

  1. You will need to get ScriptWatcher.

A very handy blender addon I stumbled across that watches your project files in blender and runs your addon when you make changes.

  1. Once ScriptWatcher is installed in blender, locate the ScriptWacher panel which should be in the Properties editor under the Scene tab.

  2. Point ScriptWacher to the __init__.py file at the root of your local Building Tool development sources. Click Watch Script to run Building Tool in the current blender workspace.

To avoid having to repeat this steps every time, you can save the current blender workspace as a file, say building_tool_dev.blend. Then in the SciptWatcher settings, enable the Watch on startup checkbox. Now every time you open the .blend file, everything will already be setup.

4. Making Changes

5. Submitting Pull Requests

Clone this wiki locally