|
|
@ -3,24 +3,23 @@ extends EditorPlugin |
|
|
|
|
|
|
|
|
|
|
|
const CONTAINER := CustomControlContainer.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT |
|
|
|
const CONTAINER := CustomControlContainer.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT |
|
|
|
|
|
|
|
|
|
|
|
var controls_scene := preload("res://terrain/editing/TerrainEditingControls.tscn") |
|
|
|
var controls: Control = null; |
|
|
|
var controls_script := preload("res://terrain/editing/TerrainEditingControls.cs") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var controls : Control; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _handles(object: Object) -> bool: |
|
|
|
func _handles(object: Object) -> bool: |
|
|
|
return object.get_script() == controls_script |
|
|
|
var script := object.get_script() as CSharpScript |
|
|
|
|
|
|
|
return script and script.resource_path.ends_with("/Terrain.cs") |
|
|
|
func _enter_tree() -> void: |
|
|
|
|
|
|
|
controls = controls_scene.instantiate() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _exit_tree() -> void: |
|
|
|
func _exit_tree() -> void: |
|
|
|
|
|
|
|
if not controls: return |
|
|
|
if controls.get_parent(): |
|
|
|
if controls.get_parent(): |
|
|
|
remove_control_from_container(CONTAINER, controls) |
|
|
|
remove_control_from_container(CONTAINER, controls) |
|
|
|
controls.free() |
|
|
|
controls.free() |
|
|
|
|
|
|
|
|
|
|
|
func _make_visible(visible: bool) -> void: |
|
|
|
func _make_visible(visible: bool) -> void: |
|
|
|
if visible: |
|
|
|
if visible: |
|
|
|
|
|
|
|
if not controls: |
|
|
|
|
|
|
|
var controls_scene = load("res://terrain/editing/TerrainEditingControls.tscn") |
|
|
|
|
|
|
|
controls = controls_scene.instantiate() |
|
|
|
add_control_to_container(CONTAINER, controls) |
|
|
|
add_control_to_container(CONTAINER, controls) |
|
|
|
elif controls.get_parent(): |
|
|
|
elif controls and controls.get_parent(): |
|
|
|
remove_control_from_container(CONTAINER, controls) |
|
|
|
remove_control_from_container(CONTAINER, controls) |
|
|
|