Loading...
 
Blender Assets        

Blender Assets

Each Blender scene can contain Grit classes, Grit objects, Grit meshes, and Grit collision meshes. Each of these are represented with a Blender Object. All these Blender objects live in the same space in Blender, but when exported to Grit, only the subset of them that represent Grit Objects will be visible. The Blender objects that represent Grit classes are typically moved under the map in Blender so that they do not get in the way. One can also use Blender's "layer" functionality, i.e. placing all the Grit class, mesh, and collision Blender Objects into one layer, and having the map in another layer. This allows easy viewing of the map, everything else, or both together.

Image

Grit classes are represented with Blender empty objects, in which certain attributes (such as rendering distance) can be specified. Each Grit class has a Grit mesh for its graphical representation, and usually also a Grit collision mesh for its physical interactions. This is represented by making the Grit class (a Blender object) a parent of the Grit mesh (another Blender Object) that it is using.

Image

Interacting with a Grit class within the Grit engine is only possible if the Grit class has been instantiated as a Grit object on a map. A Grit object is therefore simply a location / orientation in a map where a particular Grit class has been instantiated. In Blender's 3d view, the graphical representation of the Grit class (the Grit .mesh) is used to help visualise the placed Grit objects on the map. The idea is that Blender's 3d view should closely mimic the appearance of the map in the Grit engine. However, in Grit terms, an object is just a class name, position, rotation, and other simple attributes.

Exporting


Grit classes, objects, meshes, and collision meshes can be exported by selecting them and clicking on 'Export Selected', or the whole scene can also be exported. The content can then be reloaded in a running Grit engine. The scene export function may be slow for large scenes, but it guarantees that everything on disk is complete and up-to-date.

Grit meshes and Grit collision meshes are exported to individual files (.mesh and .gcol) in the .blend file's directory.

The Grit classes and Grit objects are exported to a pair of Lua files in the .blend file's directory that contain all the definitions from that scene (or the selected subset). These Lua files are named classes.lua and map.lua by default, but this is customisable for a given Blender scene. Additional Blender scenes within a .blend file (or other .blend files) can be used to output to other Lua files. Note that in order to export assets into a directory structure, at least one .blend file is needed per directory. However, using many .blend files is a good idea because people can work on different files without stepping on each others' toes.

Note that when exporting a selection of Grit classes, the Lua file will be overwritten to contain only these Grit classes, so when loaded in the engine you might not have all your Grit classes available. The export selected button is more useful for exporting Grit .mesh and Grit .gcol assets.