Skip to content

Commit

Permalink
Add workaround for intermittent resource script errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Sep 10, 2024
1 parent ecf08c3 commit 92a9934
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions addons/imgui-godot/scripts/ImGuiConfig.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
@tool
class_name ImGuiConfig extends Resource

@export_category("Font Settings")
@export var Fonts: Array[ImGuiFont]
@export var AddDefaultFont: bool = true

@export_category("Other")
@export_range(0.25, 4.0, 0.001, "or_greater") var Scale: float = 1.0
@export var IniFilename: String = "user://imgui.ini"
@export_enum("RenderingDevice", "Canvas", "Dummy") var Renderer: String = "RenderingDevice"
@export_range(-128, 128) var Layer: int = 128

@export_category("Font Settings")
#@export var Fonts: Array[ImGuiFont]
@export var AddDefaultFont: bool = true

# HACK: workaround for intermittent Godot bug
var _fonts: Array

func _get_property_list() -> Array[Dictionary]:
return [
{
"name": "Fonts",
"class_name": &"",
"type": TYPE_ARRAY,
"hint": PROPERTY_HINT_TYPE_STRING,
"hint_string": "24/17:ImGuiFont",
"usage": PROPERTY_USAGE_SCRIPT_VARIABLE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE
}
]

func _get(property: StringName) -> Variant:
if property == &"Fonts":
return _fonts
return null

func _set(property: StringName, value: Variant) -> bool:
if property == &"Fonts":
_fonts = value
return true
return false

0 comments on commit 92a9934

Please sign in to comment.