blender/tests/python/physics_particle_legacy_texture_uv.py
Tibo Stans 7847f65137 Fix #161194: Restore implicit UV map selection for legacy textures
Legacy texture evaluation falls back to the active tessface UV layer
when no UV map is explicitly specified.

After active and default UV map state moved to `Mesh`, legacy tessface
conversion still tried to copy the corresponding indices from corner
`CustomData`. This left the generated `CD_MTFACE` layers using index 0,
so textures with an empty UV map name could sample the wrong UV map.

Resolve the active and default UV map names from the mesh when
generating legacy tessface data, restoring the previous implicit
active-UV fallback.

Pull Request: https://projects.blender.org/blender/blender/pulls/161347
2026-07-16 22:22:55 +02:00

30 lines
859 B
Python

# SPDX-FileCopyrightText: 2026 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
import bpy
import sys
def main():
bpy.context.scene.frame_set(1)
depsgraph = bpy.context.evaluated_depsgraph_get()
depsgraph.update()
obj = bpy.data.objects["testParticleLegacyTextureUV"].evaluated_get(depsgraph)
particles = obj.particle_systems[0].particles
existing_particles = sum(1 for particle in particles if particle.is_exist)
if len(particles) != 1:
print(f"Expected exactly one deterministic parent hair particle, got {len(particles)}")
sys.exit(1)
if existing_particles != 1:
print(
"Expected the empty legacy texture UV name to use the active UV map, "
f"got {existing_particles} existing particles"
)
sys.exit(1)
if __name__ == "__main__":
main()