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 [method 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 the painted scene, or [code]null[/code] if none is selected. The returned scene's properties can be edited.
[b]Warning:[/b] Removing and freeing this node will render the editor useless and may cause a crash.
Registers a custom scene provider.
When the scene picker tool is active and the user clicks on [param control], the [param callback] is invoked and must return a [Node2D].
The returned scene becomes the new painting sample.
Sets the scene sample to be painted.
Removes a previously registered scene provider.
Emitted for each new node created during drawing.
[b]Example:[/b]
[codeblocks]
[gdscript]
@tool
extends EditorPlugin
func _enter_tree():
EditorInterface.get_scene_paint_2d().scene_painted.connect(_on_scene_painted)
func _on_scene_painted(node: Node2D):
# Set random rotation when drawing nodes.
node.rotation = randf_range(0, 360)
[/gdscript]
[/codeblocks]