fix: tool scripts were causing havoc on inherited scene editing§
This commit is contained in:
parent
f9655a47e6
commit
6b9a338a20
|
|
@ -47,6 +47,7 @@ func _update_events():
|
|||
# TODO: Find a cleaner way to cast these values
|
||||
var tmp: Array = []
|
||||
if Engine.is_editor_hint():
|
||||
print("reading project settings")
|
||||
tmp = ProjectSettings.get_setting("input/" + action)["events"]
|
||||
else:
|
||||
tmp = InputMap.action_get_events(action)
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ import/blender/enabled=false
|
|||
interactables=""
|
||||
signage2=""
|
||||
signage1=""
|
||||
prompts="All PromptButton inheritors."
|
||||
|
||||
[gui]
|
||||
|
||||
|
|
|
|||
|
|
@ -4,35 +4,34 @@ extends Button
|
|||
class_name PromptButton
|
||||
|
||||
var _action : StringName
|
||||
var _override : String
|
||||
|
||||
@export_custom(PROPERTY_HINT_INPUT_NAME, "show_builtin") var action : StringName = &"ui_accept":
|
||||
set(value):
|
||||
_action = value
|
||||
if is_node_ready():
|
||||
_set_action(value)
|
||||
_update_action()
|
||||
else:
|
||||
_set_action.call_deferred(value)
|
||||
_update_action.call_deferred()
|
||||
|
||||
get: return _action
|
||||
|
||||
|
||||
func _set_action(value: StringName):
|
||||
if _action == text or not text or not _action:
|
||||
text = value
|
||||
_action = value
|
||||
func _update_action():
|
||||
text = _action
|
||||
$ActionPrompt.action = _action
|
||||
|
||||
func appear(prompt: String = "") -> void:
|
||||
assert(not _override, "Prompt is already in use, overridden from '" + _override + "' to '" + text + "'")
|
||||
|
||||
func _override_prompt(prompt: String):
|
||||
if prompt:
|
||||
_override = text
|
||||
text = prompt
|
||||
else:
|
||||
text = action
|
||||
|
||||
|
||||
func appear(prompt: String = "") -> void:
|
||||
_override_prompt(prompt)
|
||||
show()
|
||||
|
||||
|
||||
func vanish() -> void:
|
||||
hide()
|
||||
if _override:
|
||||
text = _override
|
||||
_override = ""
|
||||
else:
|
||||
text = action # TODO: this is a bit backwards and doesn't allow manual overrides in editor
|
||||
|
|
|
|||
|
|
@ -16,23 +16,25 @@ unicode = 4194310
|
|||
device = -1
|
||||
pressed = true
|
||||
|
||||
[node name="PromptButton" type="Button"]
|
||||
[node name="PromptButton" type="Button" groups=["prompts"]]
|
||||
text = "ui_accept"
|
||||
script = ExtResource("1_j4nun")
|
||||
|
||||
[node name="ActionPrompt" type="TextureRect" parent="."]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(58, 58)
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -90.0
|
||||
offset_top = -50.0
|
||||
offset_right = 10.0
|
||||
offset_bottom = 50.0
|
||||
offset_left = -64.0
|
||||
offset_top = -29.0
|
||||
offset_right = -6.0
|
||||
offset_bottom = 29.0
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource("2_3b7la")
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
script = ExtResource("3_flaeu")
|
||||
action = "ui_accept"
|
||||
|
|
|
|||
|
|
@ -4,3 +4,11 @@ class_name Prompter
|
|||
|
||||
|
||||
signal action_performed(action: String)
|
||||
|
||||
var _prompts : Dictionary[StringName, Control] = {}
|
||||
|
||||
func _ready() -> void:
|
||||
for prompt in get_tree().get_nodes_in_group("prompts"):
|
||||
_prompts[prompt.name] = prompt
|
||||
prompt.get_parent().remove_child(prompt)
|
||||
print(prompt)
|
||||
|
|
|
|||
Loading…
Reference in New Issue