Level editor add-on for Blender

I’ve been trying to create a level editor add-on for Blender, mimicking the workflow of old BSP-based level editors. I’ve been creating maps for Quake and Half-Life engines for quite some time now, and it’s incredible how fast you can prototype a map in them. Today, my workflow consists of laying out the level in one of those tools, exporting an OBJ, and then unwrapping/painting/etc inside Blender. I wanted to add some “brush-style” editing to Blender, but i’m having some issues with creating such add-on.

The first issue was: how can i catch the mouse click’n’drag from the Python API in order to make a “brush draw” command like the one seen in this video:

Should i subdivide the 3D space into small cubes to allow the ease of drawing?

Another issue is: How can i do boolean operations on the brushes? I want to mark a brush as either additive or subtractive, so i can easily make doors and such. Is this available from the Python API?

Examples of editors:

Not much source or docs on those links, but thanks for the attention! Trying to contact the authors. :slight_smile:

Does anyone know any good material on the creation of new tools in the Blender “workspace”? I mean, most of those examples you sent are from in-game tools using BGE. I’m trying to create some kind of new tool, using the Python API, that allows me to draw meshes easily. While i’m able to programmatically create meshes and perform operations (i’ve made a rock generator, auto UV tool, etc), those are just scripts, configurable functions. I wasn’t able to find any further info on the creation of tool addons.

Just some info on how to grab mouse events in the viewport and how to translate the mouse position to the 3D worldspace would be enough.

Get this addon from this youtube video.
[Blender 3D] Level Editor Addon
You will have to study snap in the object and edit modes.
There is a menue for snaping vertexes to the cursor in edit mode.And you can snap objects to the cursor in object mode.

Pull the hidden console down from the top of blender and see how the snap tool does it.Here is a picture of the code i think.
stc=1

Attachments