hello,
i have plugIN node, with a set of vars, one of them is an array.
On the other side in this node inspector i have an instance with an itemList node.
iam trying to set the item names in the itemList but i always get a Nil value ?
res://inspector/inspector.gd:61 - Invalid get index '0' (on base: 'Nil').
editor plugIn node
@export var layers = {
'Lnum': [ {} ]
}
#-----------------------------------------------
#-----------//--inspector--//-------------------
#-----------------------------------------------
var sav_tl_W: int = 32;
var sav_tl_H: int = 32;
var sav_cv_W: int = 1024;
var sav_cv_H: int = 768;
var layerName: Array = ["background " , "panel", "layer1"]; #-----here
func _get_property_list():
return[
{
"name": "sav_tl_W",
"type": TYPE_INT,
"usage": PROPERTY_USAGE_STORAGE
},
{
"name": "sav_tl_H",
"type": TYPE_INT,
"usage": PROPERTY_USAGE_STORAGE
},
{
"name": "sav_cv_W",
"type": TYPE_INT,
"usage": PROPERTY_USAGE_STORAGE
},
{
"name": "sav_cv_H",
"type": TYPE_INT,
"usage": PROPERTY_USAGE_STORAGE
},
{
"name": "layerName", #-----here
"type": TYPE_ARRAY, #-----here
"usage": PROPERTY_USAGE_STORAGE #-----here
}
]
inspector.tscn
#-PlugTileDrawNode2 equal the node above
func _ready():
fliterPopUP.tlDrawNode = PlugTileDrawNode2;
if ( PlugTileDrawNode2 != null ):
tl_W.value = PlugTileDrawNode2.sav_tl_W;
tl_H.value = PlugTileDrawNode2.sav_tl_H;
cv_W.value = PlugTileDrawNode2.sav_cv_W;
cv_H.value = PlugTileDrawNode2.sav_cv_H;
var listSize = itemList.get_item_count();
var layerMax = PlugTileDrawNode2.layers.Lnum.size();
for n in range( 0, layerMax ):
#itemList.add_item(" layer " + str(n) );
itemList.add_item( PlugTileDrawNode2.layerName[n] );
Is there a way to pass the names in the array on the other side ?
this line of code works -> #itemList.add_item(" layer " + str(n) );
however when i try to put the array in there -> itemList.add_item( PlugTileDrawNode2.layerName[n] );
Iam always getting an error ?
res://inspector/inspector.gd:61 - Invalid get index '0' (on base: 'Nil').