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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-12-12 15:48:36 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-04-20 13:24:00 +0300
commit48a86af3887c3d93e1a8cf34033e86b23d1edd12 (patch)
treefdef17d96173b9e3f35150055bd0cdfbb51c0552 /source/blender/bmesh/intern/bmesh_strands.h
parenteacc24ccf1f758597adbdd33c830229737e5839d (diff)
IK solver for hair strands that provides a better solution for keeping
consistent segment lengths when transforming vertices. Warning: The implementation is not correct yet, but all the steps should be there. The main idea is to treat strands as a sequence of joints that are displaced out of their original locations by a transform or other tool. The solver then tries to find a global per-strand solution that keeps the segment lengths unmodified, with a minimum change in angles from the original starting shape. Such a solution is much more usable and efficient than the current O(n^2) attempt of "spreading the error" across the strand. The inverse kinematics method is very flexible. It can also include stretching, which would be very welcome for features like the length tool. Different parts of the strand could be weighted separately using scaling factors for the angle/stretch parameters. Conflicts: source/blender/physics/intern/implicit.h
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_strands.h')
-rw-r--r--source/blender/bmesh/intern/bmesh_strands.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_strands.h b/source/blender/bmesh/intern/bmesh_strands.h
index a0b0cfbbf7d..f32633196e3 100644
--- a/source/blender/bmesh/intern/bmesh_strands.h
+++ b/source/blender/bmesh/intern/bmesh_strands.h
@@ -87,16 +87,24 @@ typedef enum BMStrandsIterType {
} BMStrandsIterType;
#define BM_ITER_STRANDS(ele, iter, bm, itype) \
- for (ele = BM_strand_iter_new(iter, bm, itype, NULL); ele; ele = BM_iter_step(iter))
+ for (BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_strand_iter_new(iter, bm, itype, NULL); \
+ ele; \
+ BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_iter_step(iter))
#define BM_ITER_STRANDS_INDEX(ele, iter, bm, itype, indexvar) \
- for (ele = BM_strand_iter_new(iter, bm, itype, NULL), indexvar = 0; ele; ele = BM_iter_step(iter), (indexvar)++)
+ for (BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_strand_iter_new(iter, bm, itype, NULL), indexvar = 0; \
+ ele; \
+ BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_iter_step(iter), (indexvar)++)
#define BM_ITER_STRANDS_ELEM(ele, iter, data, itype) \
- for (ele = BM_strand_iter_new(iter, NULL, itype, data); ele; ele = BM_iter_step(iter))
+ for (BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_strand_iter_new(iter, NULL, itype, data); \
+ ele; \
+ BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_iter_step(iter))
#define BM_ITER_STRANDS_ELEM_INDEX(ele, iter, data, itype, indexvar) \
- for (ele = BM_strand_iter_new(iter, NULL, itype, data), indexvar = 0; ele; ele = BM_iter_step(iter), (indexvar)++)
+ for (BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_strand_iter_new(iter, NULL, itype, data), indexvar = 0; \
+ ele; \
+ BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_iter_step(iter), (indexvar)++)
typedef struct BMIter__vert_of_strand {
BMVert *v_next;