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>2018-10-19 01:07:40 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-19 01:18:22 +0300
commita30c9f710a64d0adca1597c0d0404713a26a401e (patch)
tree40fc7724b8a362dc08745ad766e6ee7e025479db /source/blender/blenkernel
parent642b77e874e787b04e28dc68af3ac4bd7aed5b2e (diff)
Partial revert '#if 0' cleanup
Partially revert 41216d5ad4c722e2ad9f15c968af454fc7566d5e Some of this code had comments to be left as is for readability, or comment the code should be kept. Other functions were only for debugging.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c25
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c14
-rw-r--r--source/blender/blenkernel/intern/multires.c13
-rw-r--r--source/blender/blenkernel/intern/particle_child.c2
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c104
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c5
-rw-r--r--source/blender/blenkernel/intern/sequencer.c31
-rw-r--r--source/blender/blenkernel/intern/softbody.c146
-rw-r--r--source/blender/blenkernel/intern/text.c172
9 files changed, 510 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index fc1412c1baa..ecdd30edc36 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -1200,6 +1200,17 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
/* functions that run inside the sampling thread (keep fast!) */
/* --------------------------------------------------------------------- */
+/* 2D ray test */
+#if 0
+static float maskrasterize_layer_z_depth_tri(const float pt[2],
+ const float v1[3], const float v2[3], const float v3[3])
+{
+ float w[3];
+ barycentric_weights_v2(v1, v2, v3, pt, w);
+ return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]);
+}
+#endif
+
static float maskrasterize_layer_z_depth_quad(const float pt[2],
const float v1[3], const float v2[3], const float v3[3], const float v4[3])
{
@@ -1214,10 +1225,24 @@ static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], cons
/* we always cast from same place only need xy */
if (face[3] == TRI_VERT) {
/* --- tri --- */
+
+#if 0
+ /* not essential but avoids unneeded extra lookups */
+ if ((cos[0][2] < dist_orig) ||
+ (cos[1][2] < dist_orig) ||
+ (cos[2][2] < dist_orig))
+ {
+ if (isect_point_tri_v2_cw(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
+ /* we know all tris are close for now */
+ return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[1]], cos[face[2]]);
+ }
+ }
+#else
/* we know all tris are close for now */
if (isect_point_tri_v2_cw(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
return 0.0f;
}
+#endif
}
else {
/* --- quad --- */
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index e40336cd4bd..fd117734aaf 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -982,6 +982,10 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
const MLoop *ml_curr = data->ml_curr;
const MLoop *ml_prev = data->ml_prev;
const int ml_curr_index = data->ml_curr_index;
+#if 0 /* Not needed for 'single' loop. */
+ const int ml_prev_index = data->ml_prev_index;
+ const int *e2l_prev = data->e2l_prev;
+#endif
const int mp_index = data->mp_index;
/* Simple case (both edges around that vertex are sharp in current polygon),
@@ -1032,6 +1036,9 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
const float (*polynors)[3] = common_data->polynors;
MLoopNorSpace *lnor_space = data->lnor_space;
+#if 0 /* Not needed for 'fan' loops. */
+ float (*lnor)[3] = data->lnor;
+#endif
const MLoop *ml_curr = data->ml_curr;
const MLoop *ml_prev = data->ml_prev;
const int ml_curr_index = data->ml_curr_index;
@@ -1416,6 +1423,10 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
data->ml_curr = ml_curr;
data->ml_prev = ml_prev;
data->ml_curr_index = ml_curr_index;
+#if 0 /* Not needed for 'single' loop. */
+ data->ml_prev_index = ml_prev_index;
+ data->e2l_prev = NULL; /* Tag as 'single' task. */
+#endif
data->mp_index = mp_index;
if (lnors_spacearr) {
data->lnor_space = BKE_lnor_space_create(lnors_spacearr);
@@ -1430,6 +1441,9 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
* All this due/thanks to link between normals and loop ordering (i.e. winding).
*/
else {
+#if 0 /* Not needed for 'fan' loops. */
+ data->lnor = lnors;
+#endif
data->ml_curr = ml_curr;
data->ml_prev = ml_prev;
data->ml_curr_index = ml_curr_index;
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 8f5354a501c..2aa3b3f79a3 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -2373,6 +2373,19 @@ int mdisp_rot_face_to_crn(struct MVert *UNUSED(mvert), struct MPoly *mpoly, stru
* the barycentric coordinates and finally find the closest vertex
* should work reliably for convex cases only but better than nothing */
+#if 0
+ int minS, i;
+ float mindist = FLT_MAX;
+
+ for (i = 0; i < mpoly->totloop; i++) {
+ float len = len_v3v3(NULL, mvert[mloop[mpoly->loopstart + i].v].co);
+ if (len < mindist) {
+ mindist = len;
+ minS = i;
+ }
+ }
+ S = minS;
+#endif
/* temp not implemented yet and also not working properly in current master.
* (was worked around by subdividing once) */
S = 0;
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c
index 339c8533e51..0cba5f5a2fc 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -299,6 +299,8 @@ void psys_apply_child_modifiers(ParticleThreadContext *ctx, struct ListBase *mod
int totkeys, k;
float max_length;
+ /* TODO for the future: use true particle modifiers that work on the whole curve */
+
(void)modifiers;
(void)mod;
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index b58a35e9841..e32a5d0681e 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -413,6 +413,45 @@ static bool pbvh_bmesh_node_limit_ensure(PBVH *bvh, int node_index)
/**********************************************************************/
+#if 0
+static int pbvh_bmesh_node_offset_from_elem(PBVH *bvh, BMElem *ele)
+{
+ switch (ele->head.htype) {
+ case BM_VERT:
+ return bvh->cd_vert_node_offset;
+ default:
+ BLI_assert(ele->head.htype == BM_FACE);
+ return bvh->cd_face_node_offset;
+ }
+
+}
+
+static int pbvh_bmesh_node_index_from_elem(PBVH *bvh, void *key)
+{
+ const int cd_node_offset = pbvh_bmesh_node_offset_from_elem(bvh, key);
+ const int node_index = BM_ELEM_CD_GET_INT((BMElem *)key, cd_node_offset);
+
+ BLI_assert(node_index != DYNTOPO_NODE_NONE);
+ BLI_assert(node_index < bvh->totnode);
+ (void)bvh;
+
+ return node_index;
+}
+
+static PBVHNode *pbvh_bmesh_node_from_elem(PBVH *bvh, void *key)
+{
+ return &bvh->nodes[pbvh_bmesh_node_index_from_elem(bvh, key)];
+}
+
+/* typecheck */
+#define pbvh_bmesh_node_index_from_elem(bvh, key) ( \
+ CHECK_TYPE_ANY(key, BMFace *, BMVert *), \
+ pbvh_bmesh_node_index_from_elem(bvh, key))
+#define pbvh_bmesh_node_from_elem(bvh, key) ( \
+ CHECK_TYPE_ANY(key, BMFace *, BMVert *), \
+ pbvh_bmesh_node_from_elem(bvh, key))
+#endif
+
BLI_INLINE int pbvh_bmesh_node_index_from_vert(PBVH *bvh, const BMVert *key)
{
const int node_index = BM_ELEM_CD_GET_INT((const BMElem *)key, bvh->cd_vert_node_offset);
@@ -496,6 +535,25 @@ static BMFace *pbvh_bmesh_face_create(
return f;
}
+/* Return the number of faces in 'node' that use vertex 'v' */
+#if 0
+static int pbvh_bmesh_node_vert_use_count(PBVH *bvh, PBVHNode *node, BMVert *v)
+{
+ BMFace *f;
+ int count = 0;
+
+ BM_FACES_OF_VERT_ITER_BEGIN(f, v) {
+ PBVHNode *f_node = pbvh_bmesh_node_from_face(bvh, f);
+ if (f_node == node) {
+ count++;
+ }
+ }
+ BM_FACES_OF_VERT_ITER_END;
+
+ return count;
+}
+#endif
+
#define pbvh_bmesh_node_vert_use_count_is_equal(bvh, node, v, n) \
(pbvh_bmesh_node_vert_use_count_at_most(bvh, node, v, (n) + 1) == n)
@@ -1197,7 +1255,12 @@ static bool pbvh_bmesh_subdivide_long_edges(
/* At the moment edges never get shorter (subdiv will make new edges)
* unlike collapse where edges can become longer. */
+#if 0
+ if (len_squared_v3v3(v1->co, v2->co) <= eq_ctx->q->limit_len_squared)
+ continue;
+#else
BLI_assert(len_squared_v3v3(v1->co, v2->co) > eq_ctx->q->limit_len_squared);
+#endif
/* Check that the edge's vertices are still in the PBVH. It's
* possible that an edge collapse has deleted adjacent faces
@@ -1273,12 +1336,25 @@ static void pbvh_bmesh_collapse_edge(
/* Get vertices, replace use of v_del with v_conn */
// BM_iter_as_array(NULL, BM_VERTS_OF_FACE, f, (void **)v_tri, 3);
BMFace *f = l->f;
+#if 0
+ BMVert *v_tri[3];
+ BM_face_as_array_vert_tri(f, v_tri);
+ for (int i = 0; i < 3; i++) {
+ if (v_tri[i] == v_del) {
+ v_tri[i] = v_conn;
+ }
+ }
+#endif
/* Check if a face using these vertices already exists. If so,
* skip adding this face and mark the existing one for
* deletion as well. Prevents extraneous "flaps" from being
* created. */
+#if 0
+ if (UNLIKELY(existing_face = BM_face_exists(v_tri, 3)))
+#else
if (UNLIKELY(existing_face = bm_face_exists_tri_from_loop_vert(l->next, v_conn)))
+#endif
{
BLI_buffer_append(deleted_faces, BMFace *, existing_face);
}
@@ -1967,7 +2043,17 @@ void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node)
if (BM_elem_flag_test(f, BM_ELEM_HIDDEN))
continue;
+#if 0
+ BMIter bm_iter;
+ BMVert *v;
+ int j = 0;
+ BM_ITER_ELEM (v, &bm_iter, f, BM_VERTS_OF_FACE) {
+ node->bm_ortri[i][j] = BM_elem_index_get(v);
+ j++;
+ }
+#else
bm_face_as_array_index_tri(f, node->bm_ortri[i]);
+#endif
i++;
}
node->bm_tot_ortri = i;
@@ -2190,6 +2276,24 @@ static void pbvh_bmesh_verify(PBVH *bvh)
}
}
+#if 0
+ /* check that every vert belongs somewhere */
+ /* Slow */
+ BM_ITER_MESH (vi, &iter, bvh->bm, BM_VERTS_OF_MESH) {
+ bool has_unique = false;
+ for (int i = 0; i < bvh->totnode; i++) {
+ PBVHNode *n = &bvh->nodes[i];
+ if ((n->bm_unique_verts != NULL) && BLI_gset_haskey(n->bm_unique_verts, vi))
+ has_unique = true;
+ }
+ BLI_assert(has_unique);
+ vert_count++;
+ }
+
+ /* if totvert differs from number of verts inside the hash. hash-totvert is checked above */
+ BLI_assert(vert_count == bvh->bm->totvert);
+#endif
+
/* Check that node elements are recorded in the top level */
for (int i = 0; i < bvh->totnode; i++) {
PBVHNode *n = &bvh->nodes[i];
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index 70d24718e5a..4a483d439e4 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -212,11 +212,14 @@ static void whiteBalance_apply_threaded(int width, int height, unsigned char *re
}
copy_v4_v4(result, rgba);
-
+#if 0
+ mul_v3_v3(result, multiplier);
+#else
/* similar to division without the clipping */
for (int i = 0; i < 3; i++) {
result[i] = 1.0f - powf(1.0f - rgba[i], multiplier[i]);
}
+#endif
if (mask_rect_float) {
copy_v3_v3(mask, mask_rect_float + pixel_index);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 416e0ad59c1..0d506effae6 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -120,6 +120,19 @@ ListBase seqbase_clipboard;
int seqbase_clipboard_frame;
SequencerDrawView sequencer_view3d_cb = NULL; /* NULL in background mode */
+#if 0 /* unused function */
+static void printf_strip(Sequence *seq)
+{
+ fprintf(stderr, "name: '%s', len:%d, start:%d, (startofs:%d, endofs:%d), "
+ "(startstill:%d, endstill:%d), machine:%d, (startdisp:%d, enddisp:%d)\n",
+ seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine,
+ seq->startdisp, seq->enddisp);
+
+ fprintf(stderr, "\tseq_tx_set_final_left: %d %d\n\n", seq_tx_get_final_left(seq, 0),
+ seq_tx_get_final_right(seq, 0));
+}
+#endif
+
static void sequencer_state_init(SeqRenderState *state)
{
state->scene_parents = NULL;
@@ -3732,6 +3745,14 @@ static ImBuf *seq_render_strip_stack(
return NULL;
}
+#if 0 /* commentind since this breaks keyframing, since it resets the value on draw */
+ if (scene->r.cfra != cfra) {
+ /* XXX for prefetch and overlay offset!..., very bad!!! */
+ AnimData *adt = BKE_animdata_from_id(&scene->id);
+ BKE_animsys_evaluate_animdata(scene, &scene->id, adt, cfra, ADT_RECALC_ANIM);
+ }
+#endif
+
out = BKE_sequencer_cache_get(context, seq_arr[count - 1], cfra, SEQ_STRIPELEM_IBUF_COMP);
if (out) {
@@ -4350,6 +4371,16 @@ void BKE_sequence_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
if (BKE_sequence_tx_get_final_left(seq, false) >= seq_tx_get_end(seq)) {
BKE_sequence_tx_set_final_left(seq, seq_tx_get_end(seq) - 1);
}
+
+ /* dosnt work now - TODO */
+#if 0
+ if (seq_tx_get_start(seq) >= seq_tx_get_final_right(seq, 0)) {
+ int ofs;
+ ofs = seq_tx_get_start(seq) - seq_tx_get_final_right(seq, 0);
+ seq->start -= ofs;
+ seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) + ofs);
+ }
+#endif
}
}
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index e4ea839770a..e3bd6f9860f 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -972,6 +972,9 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), struct Object
GHashIterator *ihash;
float aabbmin[3], aabbmax[3];
int deflected=0;
+#if 0
+ int a;
+#endif
if ((sb == NULL) || (sb->scratch ==NULL)) return 0;
copy_v3_v3(aabbmin, sb->scratch->aabbmin);
@@ -1804,6 +1807,45 @@ static int sb_deflect_face(Object *ob, float *actpos, float *facenormal, float *
return(deflected);
}
+/* hiding this for now .. but the jacobian may pop up on other tasks .. so i'd like to keep it */
+#if 0
+static void dfdx_spring(int ia, int ic, int op, float dir[3], float L, float len, float factor)
+{
+ float m, delta_ij;
+ int i, j;
+ if (L < len) {
+ for (i=0;i<3;i++) {
+ for (j=0;j<3;j++) {
+ delta_ij = (i==j ? (1.0f): (0.0f));
+ m=factor*(dir[i]*dir[j] + (1-L/len)*(delta_ij - dir[i]*dir[j]));
+ EIG_linear_solver_matrix_add(ia+i, op+ic+j, m);
+ }
+ }
+ }
+ else {
+ for (i=0;i<3;i++) {
+ for (j=0;j<3;j++) {
+ m=factor*dir[i]*dir[j];
+ EIG_linear_solver_matrix_add(ia+i, op+ic+j, m);
+ }
+ }
+ }
+}
+
+
+static void dfdx_goal(int ia, int ic, int op, float factor)
+{
+ int i;
+ for (i=0;i<3;i++) EIG_linear_solver_matrix_add(ia+i, op+ic+i, factor);
+}
+
+static void dfdv_goal(int ia, int ic, float factor)
+{
+ int i;
+ for (i=0;i<3;i++) EIG_linear_solver_matrix_add(ia+i, ic+i, factor);
+}
+#endif /* if 0 */
+
static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, float UNUSED(forcetime))
{
SoftBody *sb= ob->soft; /* is supposed to be there */
@@ -1811,15 +1853,25 @@ static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, floa
float dir[3], dvel[3];
float distance, forcefactor, kd, absvel, projvel, kw;
-
+#if 0 /* UNUSED */
+ int ia, ic;
+#endif
/* prepare depending on which side of the spring we are on */
if (bpi == bs->v1) {
bp1 = &sb->bpoint[bs->v1];
bp2 = &sb->bpoint[bs->v2];
+#if 0 /* UNUSED */
+ ia =3*bs->v1;
+ ic =3*bs->v2;
+#endif
}
else if (bpi == bs->v2) {
bp1 = &sb->bpoint[bs->v2];
bp2 = &sb->bpoint[bs->v1];
+#if 0 /* UNUSED */
+ ia =3*bs->v2;
+ ic =3*bs->v1;
+#endif
}
else {
/* TODO make this debug option */
@@ -2444,6 +2496,13 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
aabbmin[0]=aabbmin[1]=aabbmin[2] = 1e20f;
aabbmax[0]=aabbmax[1]=aabbmax[2] = -1e20f;
+ /* old one with homogeneous masses */
+ /* claim a minimum mass for vertex */
+#if 0
+ if (sb->nodemass > 0.009999f) timeovermass = forcetime / sb->nodemass;
+ else timeovermass = forcetime / 0.009999f;
+#endif
+
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
/* now we have individual masses */
/* claim a minimum mass for vertex */
@@ -2488,6 +2547,16 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
/* x(t + dt) = x(t) + v(t~) * dt */
mul_v3_fl(dx, forcetime);
+ /* the freezer coming sooner or later */
+#if 0
+ if ((dot_v3v3(dx, dx)<freezeloc )&&(dot_v3v3(bp->force, bp->force)<freezeforce )) {
+ bp->frozen /=2;
+ }
+ else {
+ bp->frozen = min_ff(bp->frozen*1.05f, 1.0f);
+ }
+ mul_v3_fl(dx, bp->frozen);
+#endif
/* again some nasty if's to have heun in here too */
if (mode ==1) {
copy_v3_v3(bp->prevpos, bp->pos);
@@ -2552,6 +2621,81 @@ static void softbody_restore_prev_step(Object *ob)
}
}
+#if 0
+static void softbody_store_step(Object *ob)
+{
+ SoftBody *sb= ob->soft; /* is supposed to be there*/
+ BodyPoint *bp;
+ int a;
+
+ for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+ copy_v3_v3(bp->prevvec, bp->vec);
+ copy_v3_v3(bp->prevpos, bp->pos);
+ }
+}
+
+
+/* used by predictors and correctors */
+static void softbody_store_state(Object *ob, float *ppos, float *pvel)
+{
+ SoftBody *sb= ob->soft; /* is supposed to be there*/
+ BodyPoint *bp;
+ int a;
+ float *pp=ppos, *pv=pvel;
+
+ for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+
+ copy_v3_v3(pv, bp->vec);
+ pv+=3;
+
+ copy_v3_v3(pp, bp->pos);
+ pp+=3;
+ }
+}
+
+/* used by predictors and correctors */
+static void softbody_retrieve_state(Object *ob, float *ppos, float *pvel)
+{
+ SoftBody *sb= ob->soft; /* is supposed to be there*/
+ BodyPoint *bp;
+ int a;
+ float *pp=ppos, *pv=pvel;
+
+ for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+
+ copy_v3_v3(bp->vec, pv);
+ pv+=3;
+
+ copy_v3_v3(bp->pos, pp);
+ pp+=3;
+ }
+}
+
+/* used by predictors and correctors */
+static void softbody_swap_state(Object *ob, float *ppos, float *pvel)
+{
+ SoftBody *sb= ob->soft; /* is supposed to be there*/
+ BodyPoint *bp;
+ int a;
+ float *pp=ppos, *pv=pvel;
+ float temp[3];
+
+ for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+
+ copy_v3_v3(temp, bp->vec);
+ copy_v3_v3(bp->vec, pv);
+ copy_v3_v3(pv, temp);
+ pv+=3;
+
+ copy_v3_v3(temp, bp->pos);
+ copy_v3_v3(bp->pos, pp);
+ copy_v3_v3(pp, temp);
+ pp+=3;
+ }
+}
+#endif
+
+
/* care for bodypoints taken out of the 'ordinary' solver step
* because they are screwed to goal by bolts
* they just need to move along with the goal in time
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 5dc8d6133eb..d512c4ac78e 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -1472,6 +1472,178 @@ static void txt_undo_end(Text *UNUSED(text), TextUndoBuf *utxt)
utxt->buf[undo_pos_end] = '\0';
}
+/* Call once undo is done. */
+#ifndef NDEBUG
+
+#endif
+
+#if 0 /* UNUSED */
+static void dump_buffer(TextUndoBuf *utxt)
+{
+ int i = 0;
+
+ while (i++ < utxt->undo_pos) printf("%d: %d %c\n", i, utxt->buf[i], utxt->buf[i]);
+}
+
+/* Note: this function is outdated and must be updated if needed for future use */
+void txt_print_undo(Text *text)
+{
+ int i = 0;
+ int op;
+ const char *ops;
+ int linep, charp;
+
+ dump_buffer(text);
+
+ printf("---< Undo Buffer >---\n");
+
+ printf("UndoPosition is %d\n", utxt->pos);
+
+ while (i <= utxt->pos) {
+ op = utxt->buf[i];
+
+ if (op == UNDO_INSERT_1) {
+ ops = "Insert ascii ";
+ }
+ else if (op == UNDO_INSERT_2) {
+ ops = "Insert 2 bytes ";
+ }
+ else if (op == UNDO_INSERT_3) {
+ ops = "Insert 3 bytes ";
+ }
+ else if (op == UNDO_INSERT_4) {
+ ops = "Insert unicode ";
+ }
+ else if (op == UNDO_BS_1) {
+ ops = "Backspace for ascii ";
+ }
+ else if (op == UNDO_BS_2) {
+ ops = "Backspace for 2 bytes ";
+ }
+ else if (op == UNDO_BS_3) {
+ ops = "Backspace for 3 bytes ";
+ }
+ else if (op == UNDO_BS_4) {
+ ops = "Backspace for unicode ";
+ }
+ else if (op == UNDO_DEL_1) {
+ ops = "Delete ascii ";
+ }
+ else if (op == UNDO_DEL_2) {
+ ops = "Delete 2 bytes ";
+ }
+ else if (op == UNDO_DEL_3) {
+ ops = "Delete 3 bytes ";
+ }
+ else if (op == UNDO_DEL_4) {
+ ops = "Delete unicode ";
+ }
+ else if (op == UNDO_DBLOCK) {
+ ops = "Delete text block";
+ }
+ else if (op == UNDO_IBLOCK) {
+ ops = "Insert text block";
+ }
+ else if (op == UNDO_INDENT) {
+ ops = "Indent ";
+ }
+ else if (op == UNDO_UNINDENT) {
+ ops = "Unindent ";
+ }
+ else if (op == UNDO_COMMENT) {
+ ops = "Comment ";
+ }
+ else if (op == UNDO_UNCOMMENT) {
+ ops = "Uncomment ";
+ }
+ else {
+ ops = "Unknown";
+ }
+
+ printf("Op (%o) at %d = %s", op, i, ops);
+ if (op >= UNDO_INSERT_1 && op <= UNDO_DEL_4) {
+ i++;
+ printf(" - Char is ");
+ switch (op) {
+ case UNDO_INSERT_1: case UNDO_BS_1: case UNDO_DEL_1:
+ printf("%c", utxt->buf[i]);
+ i++;
+ break;
+ case UNDO_INSERT_2: case UNDO_BS_2: case UNDO_DEL_2:
+ printf("%c%c", utxt->buf[i], utxt->buf[i + 1]);
+ i += 2;
+ break;
+ case UNDO_INSERT_3: case UNDO_BS_3: case UNDO_DEL_3:
+ printf("%c%c%c", utxt->buf[i], utxt->buf[i + 1], utxt->buf[i + 2]);
+ i += 3;
+ break;
+ case UNDO_INSERT_4: case UNDO_BS_4: case UNDO_DEL_4:
+ {
+ unsigned int uc;
+ char c[BLI_UTF8_MAX + 1];
+ size_t c_len;
+ uc = utxt->buf[i]; i++;
+ uc = uc + (utxt->buf[i] << 8); i++;
+ uc = uc + (utxt->buf[i] << 16); i++;
+ uc = uc + (utxt->buf[i] << 24); i++;
+ c_len = BLI_str_utf8_from_unicode(uc, c);
+ c[c_len] = '\0';
+ puts(c);
+ break;
+ }
+ }
+ }
+ else if (op == UNDO_DBLOCK || op == UNDO_IBLOCK) {
+ i++;
+
+ linep = utxt->buf[i]; i++;
+ linep = linep + (utxt->buf[i] << 8); i++;
+ linep = linep + (utxt->buf[i] << 16); i++;
+ linep = linep + (utxt->buf[i] << 24); i++;
+
+ printf(" (length %d) <", linep);
+
+ while (linep > 0) {
+ putchar(utxt->buf[i]);
+ linep--; i++;
+ }
+
+ linep = utxt->buf[i]; i++;
+ linep = linep + (utxt->buf[i] << 8); i++;
+ linep = linep + (utxt->buf[i] << 16); i++;
+ linep = linep + (utxt->buf[i] << 24); i++;
+ printf("> (%d)", linep);
+ }
+ else if (op == UNDO_INDENT || op == UNDO_UNINDENT) {
+ i++;
+
+ charp = utxt->buf[i]; i++;
+ charp = charp + (utxt->buf[i] << 8); i++;
+
+ linep = utxt->buf[i]; i++;
+ linep = linep + (utxt->buf[i] << 8); i++;
+ linep = linep + (utxt->buf[i] << 16); i++;
+ linep = linep + (utxt->buf[i] << 24); i++;
+
+ printf("to <%d, %d> ", linep, charp);
+
+ charp = utxt->buf[i]; i++;
+ charp = charp + (utxt->buf[i] << 8); i++;
+
+ linep = utxt->buf[i]; i++;
+ linep = linep + (utxt->buf[i] << 8); i++;
+ linep = linep + (utxt->buf[i] << 16); i++;
+ linep = linep + (utxt->buf[i] << 24); i++;
+
+ printf("from <%d, %d>", linep, charp);
+ }
+
+ printf(" %d\n", i);
+ i++;
+ }
+}
+#endif
+
static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value)
{
undo_buf[*undo_pos] = (value) & 0xff;