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
This commit is contained in:
Tibo Stans 2026-07-16 22:22:55 +02:00 • committed by Hans Goudey
parent 92f6b2d466
commit 7847f65137
4 changed files with 49 additions and 5 deletions

View file

@ -687,6 +687,12 @@ if(TEST_SRC_DIR_EXISTS)
--run-all-tests
)
add_blender_test(
physics_particle_legacy_texture_uv
${TEST_SRC_DIR}/physics/particle_legacy_texture_uv.blend
--python ${TEST_PYTHON_DIR}/physics_particle_legacy_texture_uv.py
)
add_blender_test(
physics_particle_instance
${TEST_SRC_DIR}/physics/physics_particle_instance.blend

View file

@ -0,0 +1,30 @@
# 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()