You can read more about decals here, below you will find how to create decals from scripts, access them and modify their parameters.

Creating Decals

To create a decal you need a mesh object to put it on, then you simply call addDecal(from, to, image) method of that mesh object to place image as the decal:

var m = scene.root.addMesh("sphere", "generator.simple.sphere");
var d = m.addDecal(vec3(0, -100, 10), vec3(0, 0, 10), ":/textures/decals/Zombies 1.png");

Parameters from and to are in world coordinates and specify a ray used to trace against the mesh to find the decal placement point. The reason of using ray instead of simply a point on a mesh is that shapes may change in Boxshot and it needs to display decals as close to their original position, as possible. By having a ray, Boxshot can trace it against a new shape to find new decal position.

Accessing Mesh Decals

To access existing decals, you again need a mesh object, then you can get decals using its decals property:

var s = scene.selection[0];
var decals = s.decals;
print(decals.length);

Here’s how to print decals' names:

var s = scene.selection[0];
var decals = s.decals;
for (var i = 0; i < decals.length; i++)
    print(decals[i].name);

This decals property is JavaScript array of decal objects, so you can get its length with length property and iterate it as any other array.

Deleting Decals

To delete a decal simply pass its object to deleteDecal(decal) method of its mesh object:

var m = scene.root.addMesh("sphere", "generator.simple.sphere");
var d = m.addDecal(vec3(0, -100, 10), vec3(0, 0, 10), ":/textures/decals/Zombies 1.png");
m.deleteDecal(d);

The code above creates and immediately deletes a decal.

Accessing Decal Properties

The code below shows how to access and modify decal properties:

var m = scene.root.addMesh("sphere", "generator.simple.sphere");
var d = m.addDecal(vec3(0, -100, 10), vec3(0, 0, 10), ":/textures/decals/Zombies 1.png");
d.name = "My Decal";
d.width = 5; // cm
d.height = 4; // cm
d.scale = 1.2;
d.rotation = 45; // degrees
d.fitToImage(); // updates width and height
d.image = ":/textures/decals/Zombies 2.png";
d.tint = color(1, 0.5, 0, 1);
d.opacity = 0.8;
d.reflectionLevel = 0.2;
d.reflectionLevelMask = "/path/to/mask1.png";
d.reflectionBlur = 0.1;
d.reflectionBlurMask = "/path/to/mask2.png";
d.reflectionTint = color(0.5, 0.2, 0, 1);

The scripting properties are very similar to the user interface ones, so refer here for more details.