Fixed a bug in material selection

Previously the addon would never choose the last material in a material list, and would not change the material if the first in the list was chosen randomly.
This was caused by a missing "+1" because the original author chose 0 as an error when returned. Without the +1 the script could return 0 randomly when choosing a random element from the list
pull/144/head
Øivin F 2022-08-31 18:44:51 +02:00 zatwierdzone przez GitHub
rodzic a68ce46883
commit 5b01447f64
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -119,7 +119,10 @@ def apply_materials(hierarchy, single_dna, materials_file, enable_rarity):
material_name, material_list, = select_material(materials_file[b]['Material List'], b, enable_rarity)
# Gets the Order Number of the Material
material_order_num = list(material_list.keys()).index(material_name)
# We add 1 to the index because 0 is what we return on an invalid lookup.
# If we don't add 1 then when material index 0 is chosen randomly we will not change materials,
# and conversly the last material in the list will never show up
material_order_num = (list(material_list.keys()).index(material_name))+1
deconstructed_material_dna[a] = str(material_order_num)
complete = True