Allow model metadata to change which color is tied to the hands/mouth/brows/casual hair
@@ -168,6 +168,10 @@ def change_player_clothes_color(self):
replaced_any = False
custom_colors = custom_model_metadata.get(prefix + "_custom_colors", {})
has_colored_eyebrows = custom_model_metadata.get("has_colored_eyebrows", False)
+ hands_color_name = custom_model_metadata.get(prefix + "_hands_color_name", "Skin")
+ mouth_color_name = custom_model_metadata.get(prefix + "_mouth_color_name", "Skin")
+ eyebrow_color_name = custom_model_metadata.get(prefix + "_eyebrow_color_name", "Hair")
+ casual_hair_color_name = custom_model_metadata.get("casual_hair_color_name", "Hair")
for custom_color_basename, base_color in custom_colors.items():
custom_color = self.options.get("custom_colors", {}).get(custom_color_basename, None)
if custom_color is None:
@@ -183,7 +187,7 @@ def change_player_clothes_color(self):
replaced_any = True
# Recolor the eyebrows.
- if has_colored_eyebrows and custom_color_basename == "Hair":
+ if has_colored_eyebrows and custom_color_basename == eyebrow_color_name:
for i in range(1, 6+1):
eyebrow_textures = link_main_model.tex1.textures_by_name["mayuh.%d" % i]
eyebrow_image = eyebrow_textures[0].render()
@@ -192,7 +196,7 @@ def change_player_clothes_color(self):
eyebrow_texture.replace_image(eyebrow_image)
# Recolor the back hair for casual Link.
- if is_casual and custom_color_basename == "Hair":
+ if is_casual and custom_color_basename == casual_hair_color_name:
link_hair_model = link_arc.get_file("katsura.bdl")
link_hair_textures = link_hair_model.tex1.textures_by_name["katsuraS3TC"]
first_texture = link_hair_textures[0]
@@ -204,8 +208,8 @@ def change_player_clothes_color(self):
link_hair_texture.replace_image(back_hair_image)
link_hair_model.save_changes()
- # Recolor the mouth and hands.
- if custom_color_basename == "Skin":
+ # Recolor the mouth.
+ if custom_color_basename == mouth_color_name:
for i in range(1, 9+1):
mouth_textures = link_main_model.tex1.textures_by_name["mouthS3TC.%d" % i]
mouth_image = mouth_textures[0].render()
@@ -213,6 +217,8 @@ def change_player_clothes_color(self):
for mouth_texture in mouth_textures:
mouth_texture.replace_image(mouth_image)
+ # Recolor the hands.
+ if custom_color_basename == hands_color_name:
hands_model = link_arc.get_file("hands.bdl")
hands_textures = hands_model.tex1.textures_by_name["handsS3TC"]
hands_image = hands_textures[0].render()
