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:
authorAlexander Gavrilov <angavrilov@gmail.com>2016-04-18 18:45:34 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2016-05-06 11:40:18 +0300
commit7ecc159f378e5bddfdb7aae8ac7784d3ca3f87fc (patch)
treedce90019fdc45623d02b5260f0f5d6f96eb77907 /source/blender/blenkernel/intern/effect.c
parent8cc4f3f52ae6b6b2b74cf7a2e3e72221982b317b (diff)
Force Fields: Fix Texture with both Use Coordinates and 2D enabled.
From description, Use Coordinates evaluates the texture using target coordinates in the local space of the force field object. 2D is supposed to ignore the Z coordinate. Thus one would assume that if both are enabled, the force field effect would move with the force field object, and Z would be 0. However, instead first the 2D option projects points onto a plane passing through the global zero and orthogonal to the local Z, and only then the resulting point is transformed into local space. Z is not locked at 0, so procedural textures like Spherical Blend don't work as expected. To fix this, apply local transform first, and then just clear Z if 2D.
Diffstat (limited to 'source/blender/blenkernel/intern/effect.c')
-rw-r--r--source/blender/blenkernel/intern/effect.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 12bce70594b..6284b3a46fb 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -746,13 +746,15 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
copy_v3_v3(tex_co, point->loc);
- if (eff->pd->flag & PFIELD_TEX_2D) {
- float fac=-dot_v3v3(tex_co, efd->nor);
- madd_v3_v3fl(tex_co, efd->nor, fac);
- }
-
if (eff->pd->flag & PFIELD_TEX_OBJECT) {
mul_m4_v3(eff->ob->imat, tex_co);
+
+ if (eff->pd->flag & PFIELD_TEX_2D)
+ tex_co[2] = 0.0f;
+ }
+ else if (eff->pd->flag & PFIELD_TEX_2D) {
+ float fac=-dot_v3v3(tex_co, efd->nor);
+ madd_v3_v3fl(tex_co, efd->nor, fac);
}
scene_color_manage = BKE_scene_check_color_management_enabled(eff->scene);