Substitute is checks with is_class so they'll work in editor and export builds.

This commit is contained in:
Nolan Darilek 2019-10-14 09:36:08 -05:00
parent fdd5f1a5f6
commit dced450b46

View File

@ -28,9 +28,9 @@ func guess_label():
var tokens = PoolStringArray([]) var tokens = PoolStringArray([])
var to_check = node var to_check = node
while to_check: while to_check:
if to_check.get_class() == "EditorProperty" and to_check.label: if to_check.is_class("EditorProperty") and to_check.label:
tokens.append(to_check.label) tokens.append(to_check.label)
if (to_check.get_class() == "EditorProperty" or to_check.get_class() == "EditorInspectorCategory") and to_check.get_tooltip_text(): if (to_check.is_class("EditorProperty") or to_check.is_class("EditorInspectorCategory")) and to_check.get_tooltip_text():
tokens.append(to_check.get_tooltip_text()) tokens.append(to_check.get_tooltip_text())
var label = tokens.join(": ") var label = tokens.join(": ")
if label: if label:
@ -421,7 +421,7 @@ func focused():
checkbox_focused() checkbox_focused()
elif node is Button: elif node is Button:
button_focused() button_focused()
elif node.get_class() == "EditorInspectorSection": elif node.is_class("EditorInspectorSection"):
editor_inspector_section_focused() editor_inspector_section_focused()
elif node is ItemList: elif node is ItemList:
item_list_focused() item_list_focused()
@ -479,7 +479,7 @@ func gui_input(event):
if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_down") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_right"): if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_down") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_right"):
node.accept_event() node.accept_event()
return tree_input(event) return tree_input(event)
elif node.get_class() == "EditorInspectorSection": elif node.is_class("EditorInspectorSection"):
return editor_inspector_section_input(event) return editor_inspector_section_input(event)
elif event.is_action_pressed("ui_left"): elif event.is_action_pressed("ui_left"):
return node.accept_event() return node.accept_event()
@ -500,23 +500,23 @@ func is_in_bar():
return false return false
func is_focusable(node): func is_focusable(node):
if node.get_class() == "SceneTreeEditor": if node.is_class("SceneTreeEditor"):
return false return false
if node.get_class() == "MultiMeshEditor": if node.is_class("MultiMeshEditor"):
return false return false
if node.get_class() == "MeshInstanceEditor": if node.is_class("MeshInstanceEditor"):
return false return false
if node.get_class() == "SpriteEditor": if node.is_class("SpriteEditor"):
return false return false
if node.get_class() == "Skeleton2DEditor": if node.is_class("Skeleton2DEditor"):
return false return false
if node.get_class() == "CollisionShape2DEditor": if node.is_class("CollisionShape2DEditor"):
return false return false
if node is Panel: if node is Panel:
return false return false
if node is TabContainer: if node is TabContainer:
return true return true
if node.get_class() == "EditorInspectorSection": if node.is_class("EditorInspectorSection"):
return true return true
if node is Container or node is Separator or node is ScrollBar or node is Popup or node.get_class() == "Control": if node is Container or node is Separator or node is ScrollBar or node is Popup or node.get_class() == "Control":
return false return false