Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-05-24 16:14:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-05-24 16:38:15 +0300
commit7a9ad029dd1d1afe42d54c9c181de887636db7c0 (patch)
treee9281cbe8bb01365a699ffd6f4bbd09a6a91015f /source/blender/modifiers
parent707340edd703ff1fd7c8157eb3cc811913698c8d (diff)
Remove TexFace, per-face images
TexFace complicates the now more popular shading pipeline by having per-face images, see: T51382 for details. To keep the ability to select a per-material edit-image (used with UV-mapping workflow), the material now stores an image which will be set when changing images in edit-mode. This is used as a bake-target when not using Cycles too.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 1e6de0fb52b..10e174415e5 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -46,6 +46,7 @@
#include "BKE_camera.h"
#include "BKE_library_query.h"
+#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_DerivedMesh.h"
@@ -59,7 +60,7 @@ static void initData(ModifierData *md)
{
UVProjectModifierData *umd = (UVProjectModifierData *) md;
- umd->flags = 0;
+
umd->num_projectors = 1;
umd->aspectx = umd->aspecty = 1.0f;
umd->scalex = umd->scaley = 1.0f;
@@ -136,7 +137,6 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
Image *image = umd->image;
MPoly *mpoly, *mp;
MLoop *mloop;
- const bool override_image = (umd->flags & MOD_UVPROJECT_OVERRIDEIMAGE) != 0;
Projector projectors[MOD_UVPROJECT_MAXPROJECTORS];
int num_projectors = 0;
char uvname[MAX_CUSTOMDATA_LAYER_NAME];
@@ -243,9 +243,14 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
mpoly = dm->getPolyArray(dm);
mloop = dm->getLoopArray(dm);
+ Image **ob_image_array = NULL;
+ if (image) {
+ ob_image_array = BKE_object_material_edit_image_get_array(ob);
+ }
+
/* apply coords as UVs, and apply image if tfaces are new */
for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp, ++mt) {
- if (override_image || !image || (mtexpoly == NULL || mt->tpage == image)) {
+ if (!image || (mtexpoly == NULL || (mp->mat_nr < ob->totcol ? ob_image_array[mp->mat_nr] : NULL) == image)) {
if (num_projectors == 1) {
if (projectors[0].uci) {
unsigned int fidx = mp->totloop - 1;
@@ -308,13 +313,13 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
}
}
}
-
- if (override_image && mtexpoly) {
- mt->tpage = image;
- }
}
MEM_freeN(coords);
+
+ if (ob_image_array) {
+ MEM_freeN(ob_image_array);
+ }
if (free_uci) {
int j;