@@ -125,6 +125,10 @@ def _main(argv):
125125 hidden_surface_removal = dtu_dict ["Hidden Surface Removal" ]
126126 else :
127127 hidden_surface_removal = False
128+ if "Remove Scalp Material" in dtu_dict :
129+ remove_scalp_material = dtu_dict ["Remove Scalp Material" ]
130+ else :
131+ remove_scalp_material = False
128132
129133 if "Has Animation" in dtu_dict :
130134 bHasAnimation = dtu_dict ["Has Animation" ]
@@ -279,6 +283,34 @@ def _main(argv):
279283 else :
280284 main_item .name = roblox_asset_name
281285
286+ if remove_scalp_material :
287+ hair_obj_list = []
288+ for obj in bpy .data .objects :
289+ if obj .type == 'MESH' and "StudioPresentationType" in obj :
290+ if "hair" in obj ["StudioPresentationType" ].lower ():
291+ hair_obj_list .append (obj )
292+ for obj in hair_obj_list :
293+ bpy .ops .object .select_all (action = 'DESELECT' )
294+ obj .select_set (True )
295+ bpy .context .view_layer .objects .active = obj
296+ bpy .ops .object .mode_set (mode = 'EDIT' )
297+ bpy .ops .mesh .select_all (action = 'DESELECT' )
298+ bpy .ops .object .mode_set (mode = 'OBJECT' )
299+ for face in obj .data .polygons :
300+ material_name = obj .material_slots [face .material_index ].material .name
301+ # fuzzy match scalp and skullcap
302+ # exact match for "Cap"
303+ if ("scalp" in material_name .lower () or
304+ "skullcap" in material_name .lower () or
305+ "Cap" == material_name
306+ ):
307+ print ("DEBUG: SCALP REMOVER: material_name=" + material_name )
308+ for vert_index in face .vertices :
309+ obj .data .vertices [vert_index ].select = True
310+ bpy .ops .object .mode_set (mode = 'EDIT' )
311+ bpy .ops .mesh .delete (type = 'VERT' )
312+ bpy .ops .object .mode_set (mode = 'OBJECT' )
313+
282314 # convert to texture atlas
283315 safe_material_names_list = []
284316 for obj in bpy .data .objects :
0 commit comments