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:
authorDalai Felinto <dfelinto@gmail.com>2014-06-17 19:16:02 +0400
committerDalai Felinto <dfelinto@gmail.com>2014-06-17 19:16:43 +0400
commitfd0b74280e05025d99195bc1ea73815551ecba8a (patch)
tree1059e65814c20e3469a7c04365092c20840c3775 /source/blender/render
parentfa257adf9644b7c3da28bf4041b77f49f497fb86 (diff)
Bake-API: allow custom UV to be baked
Note: the custom UV option is only available when calling the operator via a script. It's currently not exposed in the UI since it's intended to be used by scripters To test it: bpy.ops.object.bake(type='UV', use_clear=True, uv_layer='MyNewUV') Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D546
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/extern/include/RE_bake.h2
-rw-r--r--source/blender/render/intern/source/bake_api.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/render/extern/include/RE_bake.h b/source/blender/render/extern/include/RE_bake.h
index 961ca3fdd6d..8f2a0e382a4 100644
--- a/source/blender/render/extern/include/RE_bake.h
+++ b/source/blender/render/extern/include/RE_bake.h
@@ -87,7 +87,7 @@ bool RE_bake_pixels_populate_from_objects(
void RE_bake_pixels_populate(
struct Mesh *me, struct BakePixel *pixel_array,
- const int num_pixels, const struct BakeImages *bake_images);
+ const int num_pixels, const struct BakeImages *bake_images, const char *uv_layer);
void RE_bake_mask_fill(const BakePixel pixel_array[], const int num_pixels, char *mask);
diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c
index 713f7b8f808..28cb916dca1 100644
--- a/source/blender/render/intern/source/bake_api.c
+++ b/source/blender/render/intern/source/bake_api.c
@@ -594,7 +594,7 @@ static void bake_differentials(BakeDataZSpan *bd, const float *uv1, const float
void RE_bake_pixels_populate(
Mesh *me, BakePixel pixel_array[],
- const int num_pixels, const BakeImages *bake_images)
+ const int num_pixels, const BakeImages *bake_images, const char *uv_layer)
{
BakeDataZSpan bd;
int i, a;
@@ -619,7 +619,14 @@ void RE_bake_pixels_populate(
zbuf_alloc_span(&bd.zspan[i], bake_images->data[i].width, bake_images->data[i].height, R.clipcrop);
}
- mtface = CustomData_get_layer(&me->fdata, CD_MTFACE);
+ if (uv_layer == NULL) {
+ mtface = CustomData_get_layer(&me->fdata, CD_MTFACE);
+ }
+ else {
+ int uv_id = CustomData_get_named_layer(&me->fdata, CD_MTFACE, uv_layer);
+ mtface = CustomData_get_layer_n(&me->fdata, CD_MTFACE, uv_id);
+ }
+
mface = CustomData_get_layer(&me->fdata, CD_MFACE);
if (mtface == NULL)