Add cap sprite to child scene and update project configuration
This commit is contained in:
57
addons/guide/editor/action_slot/action_slot.gd
Normal file
57
addons/guide/editor/action_slot/action_slot.gd
Normal file
@@ -0,0 +1,57 @@
|
||||
@tool
|
||||
extends LineEdit
|
||||
|
||||
signal action_changed()
|
||||
|
||||
var index:int
|
||||
|
||||
var action:GUIDEAction:
|
||||
set(value):
|
||||
if is_instance_valid(action):
|
||||
action.changed.disconnect(_refresh)
|
||||
|
||||
action = value
|
||||
|
||||
if is_instance_valid(action):
|
||||
action.changed.connect(_refresh)
|
||||
|
||||
# action_changed can only be emitted by
|
||||
# dragging an action into this, not when setting
|
||||
# the property
|
||||
_refresh()
|
||||
|
||||
|
||||
func _refresh():
|
||||
if not is_instance_valid(action):
|
||||
text = "<none>"
|
||||
tooltip_text = ""
|
||||
else:
|
||||
text = action._editor_name()
|
||||
tooltip_text = action.resource_path
|
||||
|
||||
func _can_drop_data(at_position, data) -> bool:
|
||||
if not data is Dictionary:
|
||||
return false
|
||||
|
||||
if data.has("files"):
|
||||
for file in data["files"]:
|
||||
if ResourceLoader.load(file) is GUIDEAction:
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
|
||||
func _drop_data(at_position, data) -> void:
|
||||
|
||||
for file in data["files"]:
|
||||
var item = ResourceLoader.load(file)
|
||||
if item is GUIDEAction:
|
||||
action = item
|
||||
action_changed.emit()
|
||||
|
||||
func _gui_input(event):
|
||||
if event is InputEventMouseButton:
|
||||
if event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if is_instance_valid(action):
|
||||
EditorInterface.edit_resource(action)
|
||||
|
16
addons/guide/editor/action_slot/action_slot.tscn
Normal file
16
addons/guide/editor/action_slot/action_slot.tscn
Normal file
@@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://du4x7ng6ntuk4"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/guide/editor/action_slot/action_slot.gd" id="1_w5nxd"]
|
||||
|
||||
[node name="ActionSlot" type="LineEdit"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
text = "Name"
|
||||
editable = false
|
||||
selecting_enabled = false
|
||||
script = ExtResource("1_w5nxd")
|
Reference in New Issue
Block a user