feat: 草坪新增一些草
This commit is contained in:
@@ -250,6 +250,11 @@ def make_export_material(material):
|
||||
def unwrap_mesh(obj):
|
||||
if obj.type != "MESH" or not obj.data.polygons:
|
||||
return
|
||||
# Imported assets ship authored UVs that map onto their own texture atlas;
|
||||
# smart_project would scramble the leaves. Only the procedurally built
|
||||
# meshes arrive without a UV layer, so that is the reliable discriminator.
|
||||
if obj.data.uv_layers:
|
||||
return
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
@@ -281,6 +286,7 @@ def export(args):
|
||||
|
||||
material_map = {}
|
||||
meshes = []
|
||||
unwrapped = set()
|
||||
for obj in bpy.context.scene.objects:
|
||||
if obj.type != "MESH":
|
||||
continue
|
||||
@@ -290,7 +296,11 @@ def export(args):
|
||||
continue
|
||||
meshes.append(obj)
|
||||
apply_mesh_modifiers(obj)
|
||||
unwrap_mesh(obj)
|
||||
# Hundreds of grass tufts share four mesh datablocks; unwrapping is a
|
||||
# property of the mesh, so doing it once per datablock is enough.
|
||||
if obj.data.name not in unwrapped:
|
||||
unwrapped.add(obj.data.name)
|
||||
unwrap_mesh(obj)
|
||||
for slot in obj.material_slots:
|
||||
if not slot.material:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user