Skip to content

ScenePaint2DEditor

Inherits: Control < CanvasItem < Entity < Object

Class for interacting with the 2D editor’s Scene Paint Mode.

This class is available only in the editor and cannot be instantiated. Access it using EditorInterface.get_scene_paint_2d().

It provides methods for editor plugins to interact with the scene painting tool.

Plugins can register custom scene providers, and set the scene to be painted.

Returns Method
Entity2D get_painted_scene() const
void register_scene_provider(control: Control, callback: Callable)
void set_painted_scene(scene: Entity2D)
void unregister_scene_provider(control: Control)

scene_painted

scene_painted(node: Entity2D)

Emitted for each new node created during drawing.

Example:

get_painted_scene

Entity2D get_painted_scene() const

Returns the painted scene, or null if none is selected. The returned scene’s properties can be edited.

Warning: Removing and freeing this node will render the editor useless and may cause a crash.

register_scene_provider

void register_scene_provider(control: Control, callback: Callable)

Registers a custom scene provider.

When the scene picker tool is active and the user clicks on control, the callback is invoked and must return a Entity2D.

The returned scene becomes the new painting sample.

set_painted_scene

void set_painted_scene(scene: Entity2D)

Sets the scene sample to be painted.

unregister_scene_provider

void unregister_scene_provider(control: Control)

Removes a previously registered scene provider.