I’ve changed some codes Want to implement “materials[0] OR textures[‘new.001’]”.
But I failed for use strings-key-index to access in the textures tuple. (check comment note in codes)
Good news is materials[0] (array[<int>]) is working.
@ line 118 -> changing begin
def obj_prop_get(obj, attr_string):
"""return a pair (rna_base, "rna_property") to give to the rna UI property function"""
attrs = attr_string.split(".", 2)
#import re
#attrs = re.findall('(.*?[])}]?)\.', attr_string+'.')
val_new = obj
for i, attr in enumerate(attrs):
val_old = val_new
if '[' not in attr:
val_new = getattr(val_old, attr, Ellipsis)
else:
attr, index = attr.replace(']','').split('[')
val_new = getattr(val_old, attr, Ellipsis)
try:
index = int(index)
val_new = val_new[index]
except:
print('Don\'t support string index')
val_new = None
"""
# Why my 'text' not in ['text'] ?
index = str(index).strip()
if index in val_new.keys():
val_new = val_new[index]
else:
print("%s not in %s" % (index, val_new.keys()))
val_new = None
"""
if val_new == Ellipsis:
return None, None
return val_old, attrs[-1]