Godot Version
4.3 stable
Question
(Solved by adding the “hint” and “hint_string” for the property list)
I can see the 2 items in the inspector, Item 01 and Item 02. One is preloaded and the second one is un-assigned(empty).
In _get_property_list(),
I use
“type” : TYPE_OBJECT
for appending into the property list.
Is any way to specify loading type from inspector,
or create a new type about TYPE_XXXX when appending into property list?
Just like using @export to specify the data type
@export var _item_03 : InvItem
only InvItem in the list.
Can do this in the inspector in the property list?
file 1
extends Resource
class_name InvItem
@export var name : String
@export var texture : Texture2D
@export var amount : int
file 2
@tool
extends Node2D
var _open : bool = true:
get: return _open
set(value):
_open = value
notify_property_list_changed()
var _item_name : String = "default name":
get: return _item_name
set(value):
_item_name = value
notify_property_list_changed()
var _item_01 : InvItem = preload("res://inventory/items/item01.tres"):
get: return _item_01
set(value):
_item_01 = value
notify_property_list_changed()
var _item_02 : InvItem
@export var _item_03 : InvItem
func _get_property_list():
var plist = []
plist.append({
"name" : "_open",
"type" : TYPE_BOOL,
})
plist.append({
"name" : "_item_name",
"type" : TYPE_STRING,
})
plist.append({
"name" : "_item_01",
"type" : TYPE_OBJECT,
})
plist.append({
"name" : "_item_02",
"type" : TYPE_,
})
return plist