[Bf-blender-cvs] [1668f883fbe] master: Fix T59376: UV project modifier not working after modifiers that dont provide a UVMap

Philipp Oeser noreply at git.blender.org
Thu Mar 4 20:24:59 CET 2021


Commit: 1668f883fbe555bebf992bc77fd1c78203b23b14
Author: Philipp Oeser
Date:   Thu Mar 4 15:27:10 2021 +0100
Branches: master
https://developer.blender.org/rB1668f883fbe555bebf992bc77fd1c78203b23b14

Fix T59376: UV project modifier not working after modifiers that dont provide a UVMap

This was reported for remesh and skin modifiers.
These dont preserve UV layers (and probably cannot in a reasonable way),
so instead let the UV Project modifier create a new (equally named) UV
layer (as was suggested by @brecht in T59376).

Maniphest Tasks: T59376

Differential Revision: https://developer.blender.org/D10617

===================================================================

M	source/blender/modifiers/intern/MOD_uvproject.c

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 8122f4617c1..2d4618b15df 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -135,10 +135,11 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd,
     return mesh;
   }
 
-  /* make sure there are UV Maps available */
-
+  /* Create a new layer if no UV Maps are available (e.g. if a preceeding modifier could not
+   * preserve it). */
   if (!CustomData_has_layer(&mesh->ldata, CD_MLOOPUV)) {
-    return mesh;
+    CustomData_add_layer_named(
+        &mesh->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, mesh->totloop, umd->uvlayer_name);
   }
 
   /* make sure we're using an existing layer */



More information about the Bf-blender-cvs mailing list