diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-05 09:15:30 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-05 12:38:33 +0300 |
commit | a3815f87773c7d45740c98c888718424d736870b (patch) | |
tree | 4cd46cb327fe76e1dfcde04dcdd99d1cc4a2e9b5 /source/blender/draw/engines/workbench/workbench_data.c | |
parent | ade710500df4f333077daa96e3ab72eb2cdc3b94 (diff) |
Workbench: Matcaps T55291
- users can use their own matcaps
.config/blender/2.80/datafiles/studiolights/matcap/ folder
- upto 100 matcaps can be loaded
- color of the matcap is influenced by the color of the material/single
color etc. To show the plain matcap use single color at 1.0
- chosing a matcap is at lighting level (flat/studio/matcap)
- matcap only possible in solid mode
- also works for X-Ray mode
As the old matcaps are still in used by the clay engine I didn't remove
it yet.
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_data.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_data.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c index 4ee12a692f5..4eca3acf238 100644 --- a/source/blender/draw/engines/workbench/workbench_data.c +++ b/source/blender/draw/engines/workbench/workbench_data.c @@ -15,7 +15,11 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd) if (v3d) { wpd->shading = v3d->shading; wpd->drawtype = v3d->drawtype; - wpd->studio_light = BKE_studiolight_find(wpd->shading.studio_light, 0); + if (wpd->shading.light == V3D_LIGHTING_MATCAP) { + wpd->studio_light = BKE_studiolight_find(wpd->shading.matcap, STUDIOLIGHT_ORIENTATION_VIEWNORMAL); + } else { + wpd->studio_light = BKE_studiolight_find(wpd->shading.studio_light, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD); + } } else { memset(&wpd->shading, 0, sizeof(wpd->shading)); @@ -23,7 +27,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd) wpd->shading.shadow_intensity = 0.5; copy_v3_fl(wpd->shading.single_color, 0.8f); wpd->drawtype = OB_SOLID; - wpd->studio_light = BKE_studiolight_findindex(0); + wpd->studio_light = BKE_studiolight_find_first(STUDIOLIGHT_INTERNAL); } wpd->shadow_multiplier = 1.0 - wpd->shading.shadow_intensity; @@ -71,7 +75,7 @@ void workbench_private_data_get_light_direction(WORKBENCH_PrivateData *wpd, floa wd->num_lights = 1; } - if (STUDIOLIGHT_ORIENTATION_CAMERA_ENABLED(wpd)) { + if (!STUDIOLIGHT_ORIENTATION_WORLD_ENABLED(wpd)) { int light_index = 0; for (int index = 0 ; index < 3; index++) { SolidLight *sl = &U.light[index]; |