|
|
@ -17,6 +17,8 @@ func _make_visible(visible: bool) -> void: |
|
|
|
remove_control_from_container(CONTAINER, controls) |
|
|
|
remove_control_from_container(CONTAINER, controls) |
|
|
|
|
|
|
|
|
|
|
|
func _forward_3d_gui_input(camera: Camera3D, event: InputEvent) -> int: |
|
|
|
func _forward_3d_gui_input(camera: Camera3D, event: InputEvent) -> int: |
|
|
|
|
|
|
|
var position := Vector3.ZERO |
|
|
|
|
|
|
|
|
|
|
|
if event is InputEventMouse: |
|
|
|
if event is InputEventMouse: |
|
|
|
var previous_terrain := current_terrain |
|
|
|
var previous_terrain := current_terrain |
|
|
|
current_terrain = null |
|
|
|
current_terrain = null |
|
|
@ -33,17 +35,18 @@ func _forward_3d_gui_input(camera: Camera3D, event: InputEvent) -> int: |
|
|
|
var result := space.intersect_ray(query) |
|
|
|
var result := space.intersect_ray(query) |
|
|
|
var terrain := result.get("collider") as StaticBody3D |
|
|
|
var terrain := result.get("collider") as StaticBody3D |
|
|
|
if is_terrain(terrain): |
|
|
|
if is_terrain(terrain): |
|
|
|
# Allow terrain access to editor undo redo functionality. |
|
|
|
|
|
|
|
terrain.EditorUndoRedo = get_undo_redo() |
|
|
|
|
|
|
|
if terrain.EditorInput(event, result["position"], controls): |
|
|
|
|
|
|
|
return AFTER_GUI_INPUT_STOP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
current_terrain = terrain |
|
|
|
current_terrain = terrain |
|
|
|
return AFTER_GUI_INPUT_PASS |
|
|
|
position = result["position"] |
|
|
|
|
|
|
|
|
|
|
|
if previous_terrain and previous_terrain != current_terrain: |
|
|
|
if previous_terrain and previous_terrain != current_terrain: |
|
|
|
previous_terrain.EditorUnfocus() |
|
|
|
previous_terrain.EditorUnfocus() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if current_terrain: |
|
|
|
|
|
|
|
# Allow terrain access to editor undo redo functionality. |
|
|
|
|
|
|
|
current_terrain.EditorUndoRedo = get_undo_redo() |
|
|
|
|
|
|
|
if current_terrain.EditorInput(event, controls, position): |
|
|
|
|
|
|
|
return AFTER_GUI_INPUT_STOP |
|
|
|
|
|
|
|
|
|
|
|
return AFTER_GUI_INPUT_PASS |
|
|
|
return AFTER_GUI_INPUT_PASS |
|
|
|
|
|
|
|
|
|
|
|
func is_terrain(object: Object) -> bool: |
|
|
|
func is_terrain(object: Object) -> bool: |
|
|
|