Registering New Object types like PowerUp,Armour, Spawns etc

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Fri Feb 11, 2011 5:03 pm

Registering New Object types like PowerUp,Armour, Spawns etc

Post by CoreDumped »

Hi, Im trying to use blender as a level editor for my custom game engine.
Right now i have a python script that exports the spatial information of the meshes in the scene and load it in the engine.

However, i would also like to define custom objects in blender. i.e., from the Shift+A menu (or programatically), i want to place custom types of objects like PowerUp, Armour, along side other objects like Mesh, Curve etc

so from my export script when i do

Code: Select all

I would like to see it returns 'PowerUp' (just like how i see 'Mesh' when i select a mesh)

As for the representation of these custom objects in the 3D view, i can draw something like a cube or a sphere in the screen.

Is this possible to do this using python? If not, can you point where I should look at to modify in C?

Thanks in advance.

Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing »

Either use mesh objects or empty objects, and tag them with extra information (idprops or custom props).

In your exporter you can then look for this extra info and export accordingly.

See ... for an example how to add a new mesh type and have it show in the mesh menu.

Do something similar for your object type (add to correct menu), and have your operator tag the object with the necessary info too.


Post Reply