You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Add docs for editor viewport drawing methods
(cherry picked from commit 5d8b60ac3d)
This commit is contained in:
committed by
Rémi Verschelde
parent
31cdf8d9b4
commit
da2ac44d77
@@ -192,6 +192,19 @@
|
|||||||
<argument index="0" name="overlay" type="Control">
|
<argument index="0" name="overlay" type="Control">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
|
Called by the engine when the 2D editor's viewport is updated. Use the [code]overlay[/code] [Control] for drawing. You can update the viewport manually by calling [method update_overlays].
|
||||||
|
[codeblock]
|
||||||
|
func forward_canvas_draw_over_viewport(overlay):
|
||||||
|
# Draw a circle at cursor position.
|
||||||
|
overlay.draw_circle(overlay.get_local_mouse_position(), 64)
|
||||||
|
|
||||||
|
func forward_canvas_gui_input(event):
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
# Redraw viewport when cursor is moved.
|
||||||
|
update_overlays()
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="forward_canvas_force_draw_over_viewport" qualifiers="virtual">
|
<method name="forward_canvas_force_draw_over_viewport" qualifiers="virtual">
|
||||||
@@ -200,6 +213,8 @@
|
|||||||
<argument index="0" name="overlay" type="Control">
|
<argument index="0" name="overlay" type="Control">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
|
This method is the same as [method forward_canvas_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
|
||||||
|
You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="forward_canvas_gui_input" qualifiers="virtual">
|
<method name="forward_canvas_gui_input" qualifiers="virtual">
|
||||||
@@ -475,6 +490,7 @@
|
|||||||
<return type="void">
|
<return type="void">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
|
Enables calling of [method forward_canvas_force_draw_over_viewport] when the 2D editor's viewport is updated. You need to call this method only once and it will work permanently for this plugin.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_input_event_forwarding_always_enabled">
|
<method name="set_input_event_forwarding_always_enabled">
|
||||||
@@ -506,7 +522,7 @@
|
|||||||
<return type="int">
|
<return type="int">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Updates the overlays of the editor (2D/3D) viewport.
|
Updates the overlays of the 2D and 3D editor viewport. Causes [method forward_canvas_draw_over_viewport] and [method forward_canvas_force_draw_over_viewport] to be called.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
|||||||
Reference in New Issue
Block a user