multimesh2d component
Godot's MultiMeshInstance2D: the multimesh asset in source, its mesh drawn flat once per instance in one call, each instance tinted over color. The node…
En esta página
2d · render · 14 properties · 2D
Godot's MultiMeshInstance2D: the multimesh asset in source, its mesh drawn flat once per instance in one call, each instance tinted over color. The node keeps its own copy of the instances, so a script's edits stay on it; children draw once.
In a scene, multimesh2d is the node key that applies it. A script reaches each property below as a field on node.multimesh2d: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.multimesh2d.get() and node.multimesh2d.set(table).
Properties
| property | type | default | description |
|---|---|---|---|
blend_mode |
enum | auto |
How the surface lands on what is under it: straight alpha, a colour that already carries its alpha, added light, multiplied shade, screen, or opaque. auto is premultiplied for a texture uploaded with premultiply, else alpha One of auto, alpha, premultiplied, add, multiply, screen, opaque. |
color |
color | [1,1,1,1] |
Tint under every instance's own colour, as channel floats or #rrggbb / #rrggbbaa |
cull_back_faces |
bool | false |
Skip a triangle whose back faces the viewer, as a negative scale turns one |
dot_color |
color | [1,1,1,1] |
The dots' colour. Not drawn on a skinned polygon, which a rig poses in Balaur's own vertex stage |
dot_size |
float | 0 |
Size of a dot drawn on every vertex; zero draws none. Not drawn on a skinned polygon, which a rig poses in Balaur's own vertex stage At least 0. |
dot_sizing |
enum | world |
What dot_size counts: world is world units, which the camera's zoom scales, screen is pixels One of world, screen. |
draw_surface |
bool | true |
Whether the surface draws; off leaves the wireframe and the dots alone |
material |
asset · material |
— | The material this draws with; empty takes an inherited material component, else the built-in one |
pixels_per_unit |
float | 100 |
Texture pixels per world unit, for a mesh that carries no UVs of its own At least 0.01. |
source |
asset · multimesh |
— | The multimesh asset: the mesh and the instances it is drawn at |
texture |
asset · texture |
— | Image file, project-relative, or a texture asset; empty draws the colour alone |
wireframe_color |
color | [1,1,1,1] |
The wireframe's colour. Not drawn on a skinned polygon, which a rig poses in Balaur's own vertex stage |
wireframe_sizing |
enum | world |
What wireframe_width counts: world is world units, which the camera's zoom scales, screen is pixels One of world, screen. |
wireframe_width |
float | 0 |
Width of a line drawn along every triangle edge, not the outline; zero draws none. Not drawn on a skinned polygon, which a rig poses in Balaur's own vertex stage At least 0. |
Asset types this component references: material, multimesh, texture.
Script functions
Methods of node.multimesh2d, the handle a node carrying this component exposes. Every handle also has get(), set(table), patch(table), has() and remove().
From render:
| method | what it does |
|---|---|
buffer() -> any |
Every instance as one flat list of floats in Godot's MultiMesh.buffer layout: 12 of transform in 3D or 8 in 2D, then 4 of colour and 4 of custom data. |
instance_color(int) -> any |
The colour one instance draws in. |
instance_count() -> int |
How many instances the node holds. |
instance_custom_data(int) -> any |
One instance's four floats of custom data, as a colour. |
instance_region(int) -> any |
One instance's texture rectangle as [x, y, w, h] in pixels, or nil when it draws the whole texture. |
instance_transform(int) -> any |
One instance's transform: a Transform3d, or a Transform2d on a 2D node. |
instances() -> any |
Every instance as the multimesh asset spells it, so assets.save writes a scripted layout into a file. |
populate(any) -> any |
Godot's Populate Surface, and a row, a ring or a grid: the instances a layout would write, worked out from seed, returned in the multimesh asset's shape rather than set. kind is render.POPULATE_SURFACE with a surface node, POPULATE_ROW (count, step), POPULATE_RING (count, radius) or POPULATE_GRID (counts, step); rotation, tilt and random_scale vary each instance, as fractions, around scale. |
set_buffer(any) |
Replace every instance from one flat list in the layout buffer answers in, for a Godot port that sets buffer. Building the list in a script costs more than one set_instance_transform per instance. |
set_instance_color(int, any) |
The colour one instance draws in. |
set_instance_count(int) |
How many instances the node holds. Those below the count keep where they were; new ones are plain, at the node. |
set_instance_custom_data(int, any) |
Four floats a material's shader reads for one instance, as a colour or a list. |
set_instance_region(int, any, any) |
The rectangle of the texture one instance draws, as an origin and a size in texture pixels; a zero size draws all of it. Not drawn yet: multimesh2d draws through Balaur's own pipeline, which binds no rectangle per instance. |
set_instance_transform(int, any) |
Place one instance with a Transform3d, or a Transform2d on a 2D node. A shear is kept, as the instance's basis. |
set_instances(any) |
Replace every instance with a list in the multimesh asset's shape. |
set_visible_instance_count(int) |
How many instances draw, from the first; -1 draws them all. |
visible_instance_count() -> int |
How many instances draw; -1 is all of them. |