blosm icon indicating copy to clipboard operation
blosm copied to clipboard

Extension as a Blender addon

Open vvoovv opened this issue 6 years ago • 3 comments

Here we describe and discuss how to extend the blender-osm addon via a separate Blender addon (i.e. an addon for the blender-osm addon).

General notes

There are a number of scenarios how blender-osm and an extension can interact.

blender-osm is the master, extension is the slave

blender-osm serves as the master addon, the extesion serves as the slave addon. The extension registers some objects (functions, classes, instances of class, etc) in the bpy namespace. The blender-osm addon checks if the bpy namespace contains the agreed stuff and performs the agreed actions with it.

blender-osm is the slave, extension is the master.

Example: OpenStreetMap 3D editor for Blender. Currently only the export from Blender to an OpenStreetMap has been done. Additional work is needed based on the NP Station to provide creating a simple 3D building for OSM in Blender.

Here the OSM editor simply imports the blender-osm modules responsible for creating specific roof shapes.

Extension provides a well known functionality

The extension provides a well known functionality which isn't specific for the blender-osm addon. Example: custom map projections being developed by @JeremyBYU. All Blender addons dealing with geographic data, can benefit from that extension. Among those addons are blender-gpx and blender-terrain.

Here the blender-osm (or another addon) checks if the addon for the custom map projections is installed and activated (?). If yes, the master addon imports the required stuff from the extension. The master addon must be aware of the module, class and function names in the extension.

vvoovv avatar Apr 26 '18 22:04 vvoovv

Sounds great. I think the extension as a slave will work best. Look forward to working on it with you!

JeremyBYU avatar Apr 27 '18 14:04 JeremyBYU

Another idea for extension detection:

Scan all activated addons and check if the addon exposes a specific variable in __init__.py, for instance: blender_osm_extension = True

There is no need to set anything in the bpy namespace.

vvoovv avatar Apr 28 '18 22:04 vvoovv

Integration with bpyproj is finished.

vvoovv avatar May 10 '18 15:05 vvoovv