diff options
author | Jacques Lucke <mail@jlucke.com> | 2018-10-18 16:43:06 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2018-10-18 16:43:06 +0300 |
commit | 41216d5ad4c722e2ad9f15c968af454fc7566d5e (patch) | |
tree | f68fe3e1dd32a2d651b6678a1783e165ce2e70c8 /source | |
parent | cfdd902d2d5d560262d1218861ad1a4469c5259f (diff) |
Cleanup: Remove more #if 0 blocks
Continuation of https://developer.blender.org/D3802
Reviewers: brecht
Differential Revision: https://developer.blender.org/D3808
Diffstat (limited to 'source')
48 files changed, 12 insertions, 1880 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index b7885e08a60..723d485ea0f 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2670,11 +2670,6 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal) ima->name[0] = '\0'; } -#if 0 - /* force reload on first use, but not for multilayer, that makes nodes and buttons in ui drawing fail */ - if (ima->type != IMA_TYPE_MULTILAYER) - BKE_image_free_buffers(ima); -#else /* image buffers for non-sequence multilayer will share buffers with RenderResult, * however sequence multilayer will own buffers. Such logic makes switching from * single multilayer file to sequence completely unstable @@ -2683,7 +2678,6 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal) * sequences behave stable */ BKE_image_free_buffers(ima); -#endif ima->ok = 1; if (iuser) @@ -4468,15 +4462,6 @@ bool BKE_image_is_dirty(Image *image) void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions *options) { -#if 0 - ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL); - if (ibuf) { - ibuf->ftype = ftype; - ibuf->foptions = options; - } - BKE_image_release_ibuf(image, ibuf, NULL); -#endif - BLI_spin_lock(&image_spin); if (image->cache != NULL) { struct MovieCacheIter *iter = IMB_moviecacheIter_new(image->cache); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 84aa0ed962b..a34ebcd9fde 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1982,15 +1982,6 @@ bool new_id(ListBase *lb, ID *id, const char *tname) result = check_for_dupid(lb, id, name); strcpy(id->name + 2, name); - /* This was in 2.43 and previous releases - * however all data in blender should be sorted, not just duplicate names - * sorting should not hurt, but noting just incase it alters the way other - * functions work, so sort every time */ -#if 0 - if (result) - id_sort_by_name(lb, id); -#endif - id_sort_by_name(lb, id); return result; diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 7938d82eb80..e82e1cf2d6b 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -1064,14 +1064,8 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used) return (ELEM(id_type_used, ID_OB, ID_WO, ID_SCE, ID_MC, ID_MA, ID_GR, ID_TXT, ID_LS, ID_MSK, ID_SO, ID_GD, ID_BR, ID_PAL, ID_IM, ID_NT)); case ID_OB: - /* Could be the following, but simpler to just always say 'yes' here. */ -#if 0 - return ELEM(id_type_used, ID_ME, ID_CU, ID_MB, ID_LT, ID_SPK, ID_AR, ID_LA, ID_CA, /* obdata */ - ID_OB, ID_MA, ID_GD, ID_GR, ID_TE, ID_PA, ID_TXT, ID_SO, ID_MC, ID_IM, ID_AC - /* + constraints and modifiers ... */); -#else + /* Could be more specific, but simpler to just always say 'yes' here. */ return true; -#endif case ID_ME: return ELEM(id_type_used, ID_ME, ID_KE, ID_MA, ID_IM); case ID_CU: @@ -1099,12 +1093,8 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used) case ID_GR: return ELEM(id_type_used, ID_OB, ID_GR); case ID_NT: - /* Could be the following, but node.id has no type restriction... */ -#if 0 - return ELEM(id_type_used, ID_GD /* + node.id types... */); -#else + /* Could be more specific, but node.id has no type restriction... */ return true; -#endif case ID_BR: return ELEM(id_type_used, ID_BR, ID_IM, ID_PC, ID_TE, ID_MA); case ID_PA: diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index ba5a6a25048..97058467fd9 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1419,34 +1419,6 @@ void BKE_mask_evaluate(Mask *mask, const float ctime, const bool do_newframe) * for now re-evaluate all. eventually this might work differently */ void BKE_mask_update_display(Mask *mask, float ctime) { -#if 0 - MaskLayer *masklay; - - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - MaskSpline *spline; - - for (spline = masklay->splines.first; spline; spline = spline->next) { - if (spline->points_deform) { - int i = 0; - - for (i = 0; i < spline->tot_point; i++) { - MaskSplinePoint *point; - - if (spline->points_deform) { - point = &spline->points_deform[i]; - BKE_mask_point_free(point); - } - } - if (spline->points_deform) { - MEM_freeN(spline->points_deform); - } - - spline->points_deform = NULL; - } - } - } -#endif - BKE_mask_evaluate(mask, ctime, false); } @@ -1657,19 +1629,6 @@ MaskLayerShape *BKE_mask_layer_shape_verify_frame(MaskLayer *masklay, const int BKE_mask_layer_shape_sort(masklay); } -#if 0 - { - MaskLayerShape *masklay_shape; - int i = 0; - for (masklay_shape = masklay->splines_shapes.first; - masklay_shape; - masklay_shape = masklay_shape->next) - { - printf("mask %d, %d\n", i++, masklay_shape->frame); - } - } -#endif - return masklay_shape; } diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 2f2b82a00eb..fc1412c1baa 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -749,12 +749,6 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas for (j = 0; j < tot_diff_feather_points; j++) { copy_v2_v2(co_feather, diff_feather_points[j]); sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather); - - /* no need for these attrs */ -#if 0 - sf_vert->tmp.u = sf_vert_tot; - sf_vert->keyindex = sf_vert_tot + tot_diff_point; /* absolute index of feather vert */ -#endif sf_vert->keyindex = SF_KEYINDEX_TEMP_ID; sf_vert_tot++; } @@ -1206,18 +1200,6 @@ 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 - -#if 1 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]) { @@ -1226,33 +1208,16 @@ static float maskrasterize_layer_z_depth_quad(const float pt[2], //return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]) + (v4[2] * w[3]); return w[2] + w[3]; /* we can make this assumption for small speedup */ } -#endif static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], const float dist_orig, const float xy[2]) { /* 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 (1) { - if (isect_point_tri_v2_cw(xy, cos[face[0]], cos[face[1]], cos[face[2]])) { - return 0.0f; - } + 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/material.c b/source/blender/blenkernel/intern/material.c index a46f7bf26dc..d5558f64be8 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -653,14 +653,6 @@ void assign_material_id(Main *bmain, ID *id, Material *ma, short act) if (act > MAXMAT) return; if (act < 1) act = 1; - /* this is needed for Python overrides, - * we just have to take care that the UI can't do this */ -#if 0 - /* prevent crashing when using accidentally */ - BLI_assert(id->lib == NULL); - if (id->lib) return; -#endif - /* test arraylens */ totcolp = give_totcolp_id(id); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 5e4f5614370..9b2c2e938d4 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -224,15 +224,7 @@ void BKE_mball_texspace_calc(Object *ob) min[0] = min[1] = min[2] = -1.0f; max[0] = max[1] = max[2] = 1.0f; } -#if 0 - loc[0] = (min[0] + max[0]) / 2.0f; - loc[1] = (min[1] + max[1]) / 2.0f; - loc[2] = (min[2] + max[2]) / 2.0f; - - size[0] = (max[0] - min[0]) / 2.0f; - size[1] = (max[1] - min[1]) / 2.0f; - size[2] = (max[2] - min[2]) / 2.0f; -#endif + BKE_boundbox_init_from_minmax(bb, min, max); bb->flag &= ~BOUNDBOX_DIRTY; diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index 7e26a0f7713..436f5cc8afd 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -839,27 +839,6 @@ static void vnormal(PROCESS *process, const float point[3], float r_no[3]) r_no[0] = metaball(process, point[0] + delta, point[1], point[2]) - f; r_no[1] = metaball(process, point[0], point[1] + delta, point[2]) - f; r_no[2] = metaball(process, point[0], point[1], point[2] + delta) - f; - -#if 0 - f = normalize_v3(r_no); - - if (0) { - float tvec[3]; - - delta *= 2.0f; - - f = process->function(process, point[0], point[1], point[2]); - - tvec[0] = process->function(process, point[0] + delta, point[1], point[2]) - f; - tvec[1] = process->function(process, point[0], point[1] + delta, point[2]) - f; - tvec[2] = process->function(process, point[0], point[1], point[2] + delta) - f; - - if (normalize_v3(tvec) != 0.0f) { - add_v3_v3(r_no, tvec); - normalize_v3(r_no); - } - } -#endif } #endif /* USE_ACCUM_NORMAL */ diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 81214f3bb9c..8e1ea219ee3 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -503,11 +503,6 @@ void BKE_mesh_init(Mesh *me) me->size[0] = me->size[1] = me->size[2] = 1.0; me->smoothresh = DEG2RADF(30); me->texflag = ME_AUTOSPACE; - - /* disable because its slow on many GPU's, see [#37518] */ -#if 0 - me->flag = ME_TWOSIDED; -#endif me->drawflag = 0; CustomData_reset(&me->vdata); @@ -1253,10 +1248,6 @@ int poly_get_adj_loops_from_vert( vert); if (corner != -1) { -#if 0 /* unused - this loop */ - const MLoop *ml = &mloop[poly->loopstart + corner]; -#endif - /* vertex was found */ r_adj[0] = ME_POLY_LOOP_PREV(mloop, poly, corner)->v; r_adj[1] = ME_POLY_LOOP_NEXT(mloop, poly, corner)->v; diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index f9ced904536..e40336cd4bd 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -982,10 +982,6 @@ 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), @@ -1036,9 +1032,6 @@ 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; @@ -1423,10 +1416,6 @@ 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); @@ -1441,9 +1430,6 @@ 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; @@ -2165,30 +2151,6 @@ static float mesh_calc_poly_area_centroid( return total_area; } -#if 0 /* slow version of the function below */ -void BKE_mesh_calc_poly_angles( - MPoly *mpoly, MLoop *loopstart, - MVert *mvarray, float angles[]) -{ - MLoop *ml; - MLoop *mloop = &loopstart[-mpoly->loopstart]; - - int j; - for (j = 0, ml = loopstart; j < mpoly->totloop; j++, ml++) { - MLoop *ml_prev = ME_POLY_LOOP_PREV(mloop, mpoly, j); - MLoop *ml_next = ME_POLY_LOOP_NEXT(mloop, mpoly, j); - - float e1[3], e2[3]; - - sub_v3_v3v3(e1, mvarray[ml_next->v].co, mvarray[ml->v].co); - sub_v3_v3v3(e2, mvarray[ml_prev->v].co, mvarray[ml->v].co); - - angles[j] = (float)M_PI - angle_v3v3(e1, e2); - } -} - -#else /* equivalent the function above but avoid multiple subtractions + normalize */ - void BKE_mesh_calc_poly_angles( const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float angles[]) @@ -2213,7 +2175,6 @@ void BKE_mesh_calc_poly_angles( i_next++; } } -#endif void BKE_mesh_poly_edgehash_insert(EdgeHash *ehash, const MPoly *mp, const MLoop *mloop) { diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index bfb3b107084..dd9d6fa448a 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -618,62 +618,6 @@ bool BKE_mesh_validate_arrays( } /* Test same polys. */ -#if 0 - { - bool p1_sub = true, p2_sub = true; - - /* NOTE: This performs a sub-set test. */ - /* XXX This (and the sort of verts list) is better than systematic - * search of all verts of one list into the other if lists have - * a fair amount of elements. - * Not sure however it's worth it in this case? - * But as we also need sorted vert list to check verts multi-used - * (in first pass of checks)... */ - /* XXX If we consider only "equal" polys (i.e. using exactly same set of verts) - * as invalid, better to replace this by a simple memory cmp... */ - while ((p1_nv && p2_nv) && (p1_sub || p2_sub)) { - if (*p1_v < *p2_v) { - if (p1_sub) - p1_sub = false; - p1_nv--; - p1_v++; - } - else if (*p2_v < *p1_v) { - if (p2_sub) - p2_sub = false; - p2_nv--; - p2_v++; - } - else { - /* Equality, both next verts. */ - p1_nv--; - p2_nv--; - p1_v++; - p2_v++; - } - } - if (p1_nv && p1_sub) - p1_sub = false; - else if (p2_nv && p2_sub) - p2_sub = false; - - if (p1_sub && p2_sub) { - PRINT("\tPolys %u and %u use same vertices, considering poly %u as invalid.\n", - prev_sp->index, sp->index, sp->index); - sp->invalid = true; - } - /* XXX In fact, these might be valid? :/ */ - else if (p1_sub) { - PRINT("\t%u is a sub-poly of %u, considering it as invalid.\n", sp->index, prev_sp->index); - sp->invalid = true; - } - else if (p2_sub) { - PRINT("\t%u is a sub-poly of %u, considering it as invalid.\n", prev_sp->index, sp->index); - prev_sp->invalid = true; - prev_sp = sp; /* sp is new reference poly. */ - } - } -#else if ((p1_nv == p2_nv) && (memcmp(p1_v, p2_v, p1_nv * sizeof(*p1_v)) == 0)) { if (do_verbose) { PRINT_ERR("\tPolys %u and %u use same vertices (%d", @@ -687,7 +631,6 @@ bool BKE_mesh_validate_arrays( } sp->invalid = true; } -#endif else { prev_sp = sp; } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index d63ac7df3ce..4d70c2a7c94 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1155,16 +1155,6 @@ bool BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user) void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, int *height) { -#if 0 - /* originally was needed to support image sequences with different image dimensions, - * which might be useful for such things as reconstruction of unordered image sequence, - * or painting/rotoscoping of non-equal-sized images, but this ended up in unneeded - * cache lookups and even unwanted non-proxied files loading when doing mask parenting, - * so let's disable this for now and assume image sequence consists of images with - * equal sizes (sergey) - */ - if (user->framenr == clip->lastframe) { -#endif if (clip->lastsize[0] != 0 && clip->lastsize[1] != 0) { *width = clip->lastsize[0]; *height = clip->lastsize[1]; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 2aa3b3f79a3..8f5354a501c 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -2373,19 +2373,6 @@ 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/node.c b/source/blender/blenkernel/intern/node.c index b5fbec65d94..8e17d63af3f 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1642,54 +1642,6 @@ void BKE_node_preview_set_pixel(bNodePreview *preview, const float col[4], int x } } -#if 0 -static void nodeClearPreview(bNode *node) -{ - if (node->preview && node->preview->rect) - memset(node->preview->rect, 0, MEM_allocN_len(node->preview->rect)); -} - -/* use it to enforce clear */ -void ntreeClearPreview(bNodeTree *ntree) -{ - bNode *node; - - if (ntree == NULL) - return; - - for (node = ntree->nodes.first; node; node = node->next) { - if (node->typeinfo->flag & NODE_PREVIEW) - nodeClearPreview(node); - if (node->type == NODE_GROUP) - ntreeClearPreview((bNodeTree *)node->id); - } -} - -/* hack warning! this function is only used for shader previews, and - * since it gets called multiple times per pixel for Ztransp we only - * add the color once. Preview gets cleared before it starts render though */ -void nodeAddToPreview(bNode *node, const float col[4], int x, int y, int do_manage) -{ - bNodePreview *preview = node->preview; - if (preview) { - if (x >= 0 && y >= 0) { - if (x < preview->xsize && y < preview->ysize) { - unsigned char *tar = preview->rect + 4 * ((preview->xsize * y) + x); - - if (do_manage) { - linearrgb_to_srgb_uchar4(tar, col); - } - else { - rgba_float_to_uchar(tar, col); - } - } - //else printf("prv out bound x y %d %d\n", x, y); - } - //else printf("prv out bound x y %d %d\n", x, y); - } -} -#endif - /* ************** Free stuff ********** */ /* goes over entire tree */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index fdb2e3a1180..f73e61f56e6 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1976,21 +1976,7 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, if (where_on_path(par, ctime, vec, dir, (cu->flag & CU_FOLLOW) ? quat : NULL, &radius, NULL)) { if (cu->flag & CU_FOLLOW) { -#if 0 - float si, q[4]; - vec_to_quat(quat, dir, ob->trackflag, ob->upflag); - - /* the tilt */ - normalize_v3(dir); - q[0] = cosf(0.5 * vec[3]); - si = sinf(0.5 * vec[3]); - q[1] = -si * dir[0]; - q[2] = -si * dir[1]; - q[3] = -si * dir[2]; - mul_qt_qtqt(quat, q, quat); -#else quat_apply_track(quat, ob->trackflag, ob->upflag); -#endif normalize_qt(quat); quat_to_mat4(mat, quat); } diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index ab0130019b8..adbe1a7f889 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -242,14 +242,6 @@ static void init_complex(fftw_complex cmpl, float real, float image) cmpl[1] = image; } -#if 0 /* unused */ -static void add_complex_f(fftw_complex res, fftw_complex cmpl, float f) -{ - res[0] = cmpl[0] + f; - res[1] = cmpl[1]; -} -#endif - static void add_comlex_c(fftw_complex res, fftw_complex cmpl1, fftw_complex cmpl2) { res[0] = cmpl1[0] + cmpl2[0]; @@ -775,15 +767,6 @@ void BKE_ocean_simulate(struct Ocean *o, float t, float scale, float chop_amount if (o->_do_normals) { BLI_task_pool_push(pool, ocean_compute_normal_x, NULL, false, TASK_PRIORITY_HIGH); BLI_task_pool_push(pool, ocean_compute_normal_z, NULL, false, TASK_PRIORITY_HIGH); - -#if 0 - for (i = 0; i < o->_M; ++i) { - for (j = 0; j < o->_N; ++j) { - o->_N_y[i * o->_N + j] = 1.0f / scale; - } - } - (MEM01) -#endif o->_N_y = 1.0f / scale; } @@ -1257,30 +1240,12 @@ void BKE_ocean_simulate_cache(struct OceanCache *och, int frame) cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_DISPLACE); och->ibufs_disp[f] = IMB_loadiffname(string, 0, NULL); -#if 0 - if (och->ibufs_disp[f] == NULL) - printf("error loading %s\n", string); - else - printf("loaded cache %s\n", string); -#endif cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_FOAM); och->ibufs_foam[f] = IMB_loadiffname(string, 0, NULL); -#if 0 - if (och->ibufs_foam[f] == NULL) - printf("error loading %s\n", string); - else - printf("loaded cache %s\n", string); -#endif cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_NORMAL); och->ibufs_norm[f] = IMB_loadiffname(string, 0, NULL); -#if 0 - if (och->ibufs_norm[f] == NULL) - printf("error loading %s\n", string); - else - printf("loaded cache %s\n", string); -#endif } @@ -1355,13 +1320,6 @@ void BKE_ocean_bake(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v * break up the foam where height (Y) is low (wave valley), and X and Z displacement is greatest */ -#if 0 - vec[0] = ocr.disp[0]; - vec[1] = ocr.disp[2]; - hor_stretch = len_v2(vec); - CLAMP(hor_stretch, 0.0, 1.0); -#endif - neg_disp = ocr.disp[1] < 0.0f ? 1.0f + ocr.disp[1] : 1.0f; neg_disp = neg_disp < 0.0f ? 0.0f : neg_disp; @@ -1369,15 +1327,6 @@ void BKE_ocean_bake(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v neg_eplus = ocr.Eplus[2] < 0.0f ? 1.0f + ocr.Eplus[2] : 1.0f; neg_eplus = neg_eplus < 0.0f ? 0.0f : neg_eplus; -#if 0 - if (ocr.disp[1] < 0.0 || r > och->foam_fade) - pr *= och->foam_fade; - - - pr = pr * (1.0 - hor_stretch) * ocr.disp[1]; - pr = pr * neg_disp * neg_eplus; -#endif - if (pr < 1.0f) pr *= pr; diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 0637fc4f00c..8d7a832671f 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -264,33 +264,6 @@ void packAll(Main *bmain, ReportList *reports, bool verbose) BKE_report(reports, RPT_INFO, "No new files have been packed"); } - -#if 0 - -// attempt to create a function that generates an unique filename -// this will work when all functions in fileops.c understand relative filenames... - -static char *find_new_name(char *name) -{ - char tempname[FILE_MAX]; - char *newname; - size_t len; - - if (fop_exists(name)) { - for (number = 1; number <= 999; number++) { - BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", name, number); - if (!fop_exists(tempname)) { - break; - } - } - } - len = strlen(tempname) + 1; - newname = MEM_mallocN(len, "find_new_name"); - memcpy(newname, tempname, len * sizeof(char)); - return newname; -} -#endif - int writePackedFile( ReportList *reports, const char *ref_file_name, const char *filename, PackedFile *pf, const bool guimode) { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 7a217f59536..cec27b8f187 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -232,23 +232,6 @@ void psys_set_current_num(Object *ob, int index) } } -#if 0 /* UNUSED */ -Object *psys_find_object(Scene *scene, ParticleSystem *psys) -{ - Base *base; - ParticleSystem *tpsys; - - for (base = scene->base.first; base; base = base->next) { - for (tpsys = base->object->particlesystem.first; psys; psys = psys->next) { - if (tpsys == psys) - return base->object; - } - } - - return NULL; -} -#endif - struct LatticeDeformData *psys_create_lattice_deform_data(ParticleSimulationData *sim) { struct LatticeDeformData *lattice_deform_data = NULL; @@ -2927,22 +2910,6 @@ void psys_get_from_key(ParticleKey *key, float loc[3], float vel[3], float rot[4 if (rot) copy_qt_qt(rot, key->rot); if (time) *time = key->time; } -/*-------changing particle keys from space to another-------*/ -#if 0 -static void key_from_object(Object *ob, ParticleKey *key) -{ - float q[4]; - - add_v3_v3(key->vel, key->co); - - mul_m4_v3(ob->obmat, key->co); - mul_m4_v3(ob->obmat, key->vel); - mat4_to_quat(q, ob->obmat); - - sub_v3_v3v3(key->vel, key->vel, key->co); - mul_qt_qtqt(key->rot, q, key->rot); -} -#endif static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat[4][4]) { @@ -3850,14 +3817,6 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * } } - /* correct child ipo timing */ -#if 0 // XXX old animation system - if ((part->flag & PART_ABS_TIME) == 0 && part->ipo) { - calc_ipo(part->ipo, 100.0f * t); - execute_ipo((ID *)part, part->ipo); - } -#endif // XXX old animation system - /* get different child parameters from textures & vgroups */ memset(&ctx, 0, sizeof(ParticleThreadContext)); ctx.sim = *sim; diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index f21b3a74fea..339c8533e51 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -299,11 +299,6 @@ void psys_apply_child_modifiers(ParticleThreadContext *ctx, struct ListBase *mod int totkeys, k; float max_length; -#if 0 /* TODO for the future: use true particle modifiers that work on the whole curve */ - for (mod = modifiers->first; mod; mod = mod->next) { - mod->apply(keys, totkeys, parent_keys); - } -#else (void)modifiers; (void)mod; @@ -379,7 +374,6 @@ void psys_apply_child_modifiers(ParticleThreadContext *ctx, struct ListBase *mod } } } -#endif } /* ------------------------------------------------------------------------- */ diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 25d86851618..c363d9f29c2 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -4068,9 +4068,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_ sim->courant_num = 0.0f; dynamics_step(sim, cfra+dframe+t_frac - 1.f); psys->cfra = cfra+dframe+t_frac - 1.f; -#if 0 - printf("%f,%f,%f,%f\n", cfra+dframe+t_frac - 1.f, t_frac, dt_frac, sim->courant_num); -#endif + if (part->time_flag & PART_TIME_AUTOSF) update_timestep(psys, sim); /* Even without AUTOSF dt_frac may not add up to 1.0 due to float precision. */ diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index e32a5d0681e..b58a35e9841 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -413,45 +413,6 @@ 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); @@ -535,25 +496,6 @@ 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) @@ -1255,12 +1197,7 @@ 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 @@ -1336,25 +1273,12 @@ 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); } @@ -2043,17 +1967,7 @@ 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; @@ -2276,24 +2190,6 @@ 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/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 8f8926545c6..7fc36c423c1 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -3170,19 +3170,6 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (startframe && endframe) { *startframe= cache->startframe; *endframe= cache->endframe; - - /* TODO: time handling with object offsets and simulated vs. cached - * particles isn't particularly easy, so for now what you see is what - * you get. In the future point cache could handle the whole particle - * system timing. */ -#if 0 - if ((ob->partype & PARSLOW)==0) { - offset= ob->sf; - - *startframe += (int)(offset+0.5f); - *endframe += (int)(offset+0.5f); - } -#endif } /* verify cached_frames array is up to date */ @@ -3288,12 +3275,6 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) sbFreeSimulation(pid->calldata); else if (pid->type == PTCACHE_TYPE_PARTICLES) psys_reset(pid->calldata, PSYS_RESET_DEPSGRAPH); -#if 0 - else if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN) - smokeModifier_reset(pid->calldata); - else if (pid->type == PTCACHE_TYPE_SMOKE_HIGHRES) - smokeModifier_reset_turbulence(pid->calldata); -#endif else if (pid->type == PTCACHE_TYPE_DYNAMICPAINT) dynamicPaint_clearSurface(scene, (DynamicPaintSurface*)pid->calldata); } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 3f9f6f15892..68bc6c407ac 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -567,12 +567,6 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol) } break; } - -#if 0 // XXX: not defined yet - case RB_SHAPE_COMPOUND: - volume = 0.0f; - break; -#endif } /* return the volume calculated */ @@ -640,12 +634,6 @@ void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3]) } break; } - -#if 0 // XXX: not defined yet - case RB_SHAPE_COMPOUND: - volume = 0.0f; - break; -#endif } } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 44406714771..c16adabbc8c 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1126,12 +1126,6 @@ int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter, } } -#if 0 - if (ob && *ob) { - printf("Scene: '%s', '%s'\n", (*scene)->id.name + 2, (*ob)->id.name + 2); - } -#endif - return iter->phase; } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 8820340d6dc..ba2d2ef0d46 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1767,76 +1767,6 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f if (output != output) output = 1; if (wipe->forward) output = 1 - output; break; - /* BOX WIPE IS NOT WORKING YET */ - /* case DO_CROSS_WIPE: */ - /* BOX WIPE IS NOT WORKING YET */ -#if 0 - case DO_BOX_WIPE: - if (!wipe->forward) { - facf0 = 1.0f - facf0; /* Go the other direction */ - } - - width = (int)(wipe->edgeWidth * ((xo + yo) / 2.0)); - hwidth = (float)width / 2.0; - if (angle == 0) angle = 0.000001; - b1 = posy / 2 - (-angle) * posx / 2; - b3 = (yo - posy / 2) - (-angle) * (xo - posx / 2); - b2 = y - (-angle) * x; - - hyp = abs(angle * x + y + (-posy / 2 - angle * posx / 2)) * wipezone->pythangle; - hyp2 = abs(angle * x + y + (-(yo - posy / 2) - angle * (xo - posx / 2))) * wipezone->pythangle; - - temp1 = xo * (1 - facf0 / 2) - xo * facf0 / 2; - temp2 = yo * (1 - facf0 / 2) - yo * facf0 / 2; - pointdist = hypot(temp1, temp2); - - if (b2 < b1 && b2 < b3) { - if (hwidth < pointdist) - output = in_band(hwidth, hyp, 0, 1); - } - else if (b2 > b1 && b2 > b3) { - if (hwidth < pointdist) - output = in_band(hwidth, hyp2, 0, 1); - } - else { - if (hyp < hwidth && hyp2 > hwidth) - output = in_band(hwidth, hyp, 1, 1); - else if (hyp > hwidth && hyp2 < hwidth) - output = in_band(hwidth, hyp2, 1, 1); - else - output = in_band(hwidth, hyp2, 1, 1) * in_band(hwidth, hyp, 1, 1); - } - - if (!wipe->forward) { - facf0 = 1.0f - facf0; /* Go the other direction */ - } - angle = -1 / angle; - b1 = posy / 2 - (-angle) * posx / 2; - b3 = (yo - posy / 2) - (-angle) * (xo - posx / 2); - b2 = y - (-angle) * x; - - hyp = abs(angle * x + y + (-posy / 2 - angle * posx / 2)) * wipezone->pythangle; - hyp2 = abs(angle * x + y + (-(yo - posy / 2) - angle * (xo - posx / 2))) * wipezone->pythangle; - - if (b2 < b1 && b2 < b3) { - if (hwidth < pointdist) - output *= in_band(hwidth, hyp, 0, 1); - } - else if (b2 > b1 && b2 > b3) { - if (hwidth < pointdist) - output *= in_band(hwidth, hyp2, 0, 1); - } - else { - if (hyp < hwidth && hyp2 > hwidth) - output *= in_band(hwidth, hyp, 1, 1); - else if (hyp > hwidth && hyp2 < hwidth) - output *= in_band(hwidth, hyp2, 1, 1); - else - output *= in_band(hwidth, hyp2, 1, 1) * in_band(hwidth, hyp, 1, 1); - } - - break; -#endif case DO_IRIS_WIPE: if (xo > yo) yo = xo; else xo = yo; diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c index 4a483d439e4..70d24718e5a 100644 --- a/source/blender/blenkernel/intern/seqmodifier.c +++ b/source/blender/blenkernel/intern/seqmodifier.c @@ -212,14 +212,11 @@ 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 e5aa9b4915e..416e0ad59c1 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -120,19 +120,6 @@ 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; @@ -1596,12 +1583,8 @@ static void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile) } if (sanim->anim) { -#if 0 - seq_anim_add_suffix(scene, sanim->anim, i); -#else /* we already have the suffix */ IMB_suffix_anim(sanim->anim, suffix); -#endif } else { if (openfile) { @@ -3749,14 +3732,6 @@ 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) { @@ -4375,16 +4350,6 @@ 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 } } @@ -5253,11 +5218,6 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad if (sound->playback_handle == NULL) { BKE_libblock_free(bmain, sound); -#if 0 - if (op) - BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); -#endif - return NULL; } @@ -5265,10 +5225,6 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad if (info.specs.channels == AUD_CHANNELS_INVALID) { BKE_libblock_free(bmain, sound); -#if 0 - if (op) - BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); -#endif return NULL; } diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index f5dd7ef794b..be3a025a96f 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -2608,15 +2608,6 @@ static void step( float gravity[3] = {0.0f, 0.0f, -1.0f}; float gravity_mag; -#if 0 /* UNUSED */ - /* get max velocity and lower the dt value if it is too high */ - size_t size = sds->res[0] * sds->res[1] * sds->res[2]; - float *velX = smoke_get_velocity_x(sds->fluid); - float *velY = smoke_get_velocity_y(sds->fluid); - float *velZ = smoke_get_velocity_z(sds->fluid); - size_t i; -#endif - /* update object state */ invert_m4_m4(sds->imat, ob->obmat); copy_m4_m4(sds->obmat, ob->obmat); @@ -2639,14 +2630,6 @@ static void step( // maximum timestep/"CFL" constraint: dt < 5.0 *dx / maxVel maxVel = (sds->dx * 5.0f); -#if 0 - for (i = 0; i < size; i++) { - float vtemp = (velX[i] * velX[i] + velY[i] * velY[i] + velZ[i] * velZ[i]); - if (vtemp > maxVelMag) - maxVelMag = vtemp; - } -#endif - maxVelMag = sqrtf(maxVelMag) * dt * sds->time_scale; totalSubsteps = (int)((maxVelMag / maxVel) + 1.0f); /* always round up */ totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index e3bd6f9860f..e4ea839770a 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -972,9 +972,6 @@ 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); @@ -1807,45 +1804,6 @@ 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 */ @@ -1853,25 +1811,15 @@ 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 */ @@ -2496,13 +2444,6 @@ 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 */ @@ -2547,16 +2488,6 @@ 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); @@ -2621,81 +2552,6 @@ 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/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index f803956d6f6..bba3e97cad7 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1045,43 +1045,6 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) int gridSideEdges; int gridInternalEdges; - /* code added in bmesh but works correctly without, commenting - campbell */ -#if 0 - int lasti, previ; - i = lastface; - lasti = 0; - while (1) { - previ = i; - if (ccgdm->faceMap[i].startEdge >= edgeNum) { - i -= fabsf(i - lasti) / 2.0f; - } - else if (ccgdm->faceMap[i].startEdge < edgeNum) { - i += fabsf(i - lasti) / 2.0f; - } - else { - break; - } - - if (i < 0) { - i = 0; - break; - } - - if (i > lastface) { - i = lastface; - break; - - } - - if (i == lasti) - break; - - lasti = previ; - } - - i = i > 0 ? i - 1 : i; -#endif - i = 0; while (i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge) { i++; @@ -2555,14 +2518,6 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, has_edge_cd = ((ccgdm->dm.edgeData.totlayer - (edgeOrigIndex ? 1 : 0)) != 0); -#if 0 - /* this is not in trunk, can gives problems because colors initialize - * as black, just don't do it!, it works fine - campbell */ - if (!CustomData_has_layer(&ccgdm->dm.faceData, CD_MCOL)) - DM_add_tessface_layer(&ccgdm->dm, CD_MCOL, CD_CALLOC, NULL); - mcol = DM_get_tessface_data_layer(&ccgdm->dm, CD_MCOL); -#endif - loopindex = loopindex2 = 0; /* current loop index */ for (index = 0; index < totface; index++) { CCGFace *f = ccgdm->faceMap[index].face; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index d512c4ac78e..5dc8d6133eb 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1472,178 +1472,6 @@ 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; diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 3663ccd6513..e2a0837b938 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -412,17 +412,6 @@ static size_t unit_as_string(char *str, int len_max, double value, int prec, con while (unit->name_short[j] && (i < len_max)) { str[i++] = unit->name_short[j++]; } -#if 0 - if (pad) { - /* this loop only runs if so many zeros were removed that - * the unit name only used padded chars, - * In that case add padding for the name. */ - - while (i <= len + j && (i < len_max)) { - str[i++] = pad; - } - } -#endif } /* terminate no matter what's done with padding above */ diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 9cdb48998a0..d53cba184ad 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -607,14 +607,6 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int } } -#if 0 - /* this options are not set in ffmpeg.c and leads to artifacts with MPEG-4 - * see #33586: Encoding to mpeg4 makes first frame(s) blocky - */ - c->rc_initial_buffer_occupancy = rd->ffcodecdata.rc_buffer_size * 3 / 4; - c->rc_buffer_aggressivity = 1.0; -#endif - /* Deprecated and not doing anything since July 2015, deleted in recent ffmpeg */ //c->me_method = ME_EPZS; @@ -670,14 +662,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int } } - if ((of->oformat->flags & AVFMT_GLOBALHEADER) -#if 0 - || STREQ(of->oformat->name, "mp4") - || STREQ(of->oformat->name, "mov") - || STREQ(of->oformat->name, "3gp") -#endif - ) - { + if ((of->oformat->flags & AVFMT_GLOBALHEADER)) { PRINT("Using global header\n"); c->flags |= CODEC_FLAG_GLOBAL_HEADER; } @@ -1295,12 +1280,6 @@ static void end_ffmpeg_impl(FFMpegContext *context, int is_autosplit) { PRINT("Closing ffmpeg...\n"); -#if 0 - if (context->audio_stream) { /* SEE UPPER */ - write_audio_frames(context); - } -#endif - #ifdef WITH_AUDASPACE if (is_autosplit == false) { if (context->audio_mixdown_device) { diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h index 3c1cb90937d..4352779d9ee 100644 --- a/source/blender/blenlib/BLI_math_solvers.h +++ b/source/blender/blenlib/BLI_math_solvers.h @@ -53,13 +53,6 @@ void BLI_svd_m3(const float m3[3][3], float r_U[3][3], float r_S[], float r_V[3] bool BLI_tridiagonal_solve(const float *a, const float *b, const float *c, const float *d, float *r_x, const int count); bool BLI_tridiagonal_solve_cyclic(const float *a, const float *b, const float *c, const float *d, float *r_x, const int count); -/**************************** Inline Definitions ******************************/ -#if 0 /* None so far. */ -# if BLI_MATH_DO_INLINE -# include "intern/math_geom_inline.c" -# endif -#endif - #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic pop #endif diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h index 210d41bcf59..40641c05e08 100644 --- a/source/blender/blenlib/BLI_math_statistics.h +++ b/source/blender/blenlib/BLI_math_statistics.h @@ -51,12 +51,6 @@ void BLI_covariance_m3_v3n( const float (*cos_v3)[3], const int nbr_cos_v3, const bool use_sample_correction, float r_covmat[3][3], float r_center[3]); -/**************************** Inline Definitions ******************************/ -#if 0 /* None so far. */ -# if BLI_MATH_DO_INLINE -# include "intern/math_geom_inline.c" -# endif -#endif #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic pop diff --git a/source/blender/blenlib/intern/BLI_array.c b/source/blender/blenlib/intern/BLI_array.c index d16dd36763d..0380656a33a 100644 --- a/source/blender/blenlib/intern/BLI_array.c +++ b/source/blender/blenlib/intern/BLI_array.c @@ -90,9 +90,4 @@ void _bli_array_grow_func( } *arr_p = arr_tmp; - - /* caller must do */ -#if 0 - arr_len += num; -#endif } diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index ec75c140159..071a7e2dc0e 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -1108,57 +1108,6 @@ void BLI_ghashIterator_free(GHashIterator *ghi) MEM_freeN(ghi); } -/* inline functions now */ -#if 0 -/** - * Retrieve the key from an iterator. - * - * \param ghi The iterator. - * \return The key at the current index, or NULL if the - * iterator is done. - */ -void *BLI_ghashIterator_getKey(GHashIterator *ghi) -{ - return ghi->curEntry->key; -} - -/** - * Retrieve the value from an iterator. - * - * \param ghi The iterator. - * \return The value at the current index, or NULL if the - * iterator is done. - */ -void *BLI_ghashIterator_getValue(GHashIterator *ghi) -{ - return ghi->curEntry->val; -} - -/** - * Retrieve the value from an iterator. - * - * \param ghi The iterator. - * \return The value at the current index, or NULL if the - * iterator is done. - */ -void **BLI_ghashIterator_getValue_p(GHashIterator *ghi) -{ - return &ghi->curEntry->val; -} - -/** - * Determine if an iterator is done (has reached the end of - * the hash table). - * - * \param ghi The iterator. - * \return True if done, False otherwise. - */ -bool BLI_ghashIterator_done(GHashIterator *ghi) -{ - return ghi->curEntry == NULL; -} -#endif - /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/blenlib/intern/BLI_ghash_utils.c b/source/blender/blenlib/intern/BLI_ghash_utils.c index 953ceb3442b..6b8c9b5226c 100644 --- a/source/blender/blenlib/intern/BLI_ghash_utils.c +++ b/source/blender/blenlib/intern/BLI_ghash_utils.c @@ -47,13 +47,7 @@ /** \name Generic Key Hash & Comparison Functions * \{ */ -#if 0 -/* works but slower */ -uint BLI_ghashutil_ptrhash(const void *key) -{ - return (uint)(intptr_t)key; -} -#else + /* based python3.3's pointer hashing function */ uint BLI_ghashutil_ptrhash(const void *key) { @@ -63,7 +57,7 @@ uint BLI_ghashutil_ptrhash(const void *key) y = (y >> 4) | (y << (8 * sizeof(void *) - 4)); return (uint)y; } -#endif + bool BLI_ghashutil_ptrcmp(const void *a, const void *b) { return (a != b); diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index 5658c1fd103..97605640be4 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -87,11 +87,6 @@ struct Heap { BLI_INLINE void heap_swap(Heap *heap, const uint i, const uint j) { - -#if 0 - SWAP(uint, heap->tree[i]->index, heap->tree[j]->index); - SWAP(HeapNode *, heap->tree[i], heap->tree[j]); -#else HeapNode **tree = heap->tree; union { uint index; @@ -99,7 +94,6 @@ BLI_INLINE void heap_swap(Heap *heap, const uint i, const uint j) } tmp; SWAP_TVAL(tmp.index, tree[i]->index, tree[j]->index); SWAP_TVAL(tmp.node, tree[i], tree[j]); -#endif } static void heap_down(Heap *heap, uint i) diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index ddfb75fc2ce..45198af0515 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -213,74 +213,6 @@ MINLINE axis_t max_axis(axis_t a, axis_t b) } #endif -#if 0 - -/* - * Generic push and pop heap - */ -#define PUSH_HEAP_BODY(HEAP_TYPE, PRIORITY, heap, heap_size) \ - { \ - HEAP_TYPE element = heap[heap_size - 1]; \ - int child = heap_size - 1; \ - while (child != 0) { \ - int parent = (child - 1) / 2; \ - if (PRIORITY(element, heap[parent])) { \ - heap[child] = heap[parent]; \ - child = parent; \ - } \ - else { \ - break; \ - } \ - } \ - heap[child] = element; \ - } (void)0 - -#define POP_HEAP_BODY(HEAP_TYPE, PRIORITY, heap, heap_size) \ - { \ - HEAP_TYPE element = heap[heap_size - 1]; \ - int parent = 0; \ - while (parent < (heap_size - 1) / 2) { \ - int child2 = (parent + 1) * 2; \ - if (PRIORITY(heap[child2 - 1], heap[child2])) { \ - child2--; \ - } \ - if (PRIORITY(element, heap[child2])) { \ - break; \ - } \ - heap[parent] = heap[child2]; \ - parent = child2; \ - } \ - heap[parent] = element; \ - } (void)0 - -static bool ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_size, int size_per_item) -{ - int new_max_size = *max_size * 2; - void *new_memblock = NULL; - - if (new_size <= *max_size) { - return true; - } - - if (*memblock == local_memblock) { - new_memblock = malloc(size_per_item * new_max_size); - memcpy(new_memblock, *memblock, size_per_item * *max_size); - } - else { - new_memblock = realloc(*memblock, size_per_item * new_max_size); - } - - if (new_memblock) { - *memblock = new_memblock; - *max_size = new_max_size; - return true; - } - else { - return false; - } -} -#endif - /** * Introsort * with permission deriven from the following Java code: @@ -288,17 +220,7 @@ static bool ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, i * and he derived it from the SUN STL */ -//static int size_threshold = 16; -#if 0 -/** - * Common methods for all algorithms - */ -static int floor_lg(int a) -{ - return (int)(floor(log(a) / log(2))); -} -#endif static void node_minmax_init(const BVHTree *tree, BVHNode *node) { @@ -356,39 +278,6 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode *x, int axis) } } -#if 0 -/** - * Heapsort algorithm - */ -static void bvh_downheap(BVHNode **a, int i, int n, int lo, int axis) -{ - BVHNode *d = a[lo + i - 1]; - int child; - while (i <= n / 2) { - child = 2 * i; - if ((child < n) && ((a[lo + child - 1])->bv[axis] < (a[lo + child])->bv[axis])) { - child++; - } - if (!(d->bv[axis] < (a[lo + child - 1])->bv[axis])) break; - a[lo + i - 1] = a[lo + child - 1]; - i = child; - } - a[lo + i - 1] = d; -} - -static void bvh_heapsort(BVHNode **a, int lo, int hi, int axis) -{ - int n = hi - lo, i; - for (i = n / 2; i >= 1; i = i - 1) { - bvh_downheap(a, i, n, lo, axis); - } - for (i = n; i > 1; i = i - 1) { - SWAP(BVHNode *, a[lo], a[lo + i - 1]); - bvh_downheap(a, 1, i - 1, lo, axis); - } -} -#endif - static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) /* returns Sortable */ { if ((a[mid])->bv[axis] < (a[lo])->bv[axis]) { @@ -413,41 +302,6 @@ static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) / } } -#if 0 -/* - * Quicksort algorithm modified for Introsort - */ -static void bvh_introsort_loop(BVHNode **a, int lo, int hi, int depth_limit, int axis) -{ - int p; - - while (hi - lo > size_threshold) { - if (depth_limit == 0) { - bvh_heapsort(a, lo, hi, axis); - return; - } - depth_limit = depth_limit - 1; - p = bvh_partition(a, lo, hi, bvh_medianof3(a, lo, lo + ((hi - lo) / 2) + 1, hi - 1, axis), axis); - bvh_introsort_loop(a, p, hi, depth_limit, axis); - hi = p; - } -} - -static void sort(BVHNode **a0, int begin, int end, int axis) -{ - if (begin < end) { - BVHNode **a = a0; - bvh_introsort_loop(a, begin, end, 2 * floor_lg(end - begin), axis); - bvh_insertionsort(a, begin, end, axis); - } -} - -static void sort_along_axis(BVHTree *tree, int start, int end, int axis) -{ - sort(tree->nodes, start, end, axis); -} -#endif - /** * \note after a call to this function you can expect one of: * - every node to left of a[n] are smaller or equal to it @@ -1420,23 +1274,6 @@ static float calc_nearest_point_squared(const float proj[3], BVHNode *node, floa nearest[i] = proj[i]; } -#if 0 - /* nearest on a general hull */ - copy_v3_v3(nearest, data->co); - for (i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv += 2) { - float proj = dot_v3v3(nearest, bvhtree_kdop_axes[i]); - float dl = bv[0] - proj; - float du = bv[1] - proj; - - if (dl > 0) { - madd_v3_v3fl(nearest, bvhtree_kdop_axes[i], dl); - } - else if (du < 0) { - madd_v3_v3fl(nearest, bvhtree_kdop_axes[i], du); - } - } -#endif - return len_squared_v3v3(proj, nearest); } @@ -1484,101 +1321,6 @@ static void dfs_find_nearest_begin(BVHNearestData *data, BVHNode *node) dfs_find_nearest_dfs(data, node); } - -#if 0 - -typedef struct NodeDistance { - BVHNode *node; - float dist; - -} NodeDistance; - -#define DEFAULT_FIND_NEAREST_HEAP_SIZE 1024 - -#define NodeDistance_priority(a, b) ((a).dist < (b).dist) - -static void NodeDistance_push_heap(NodeDistance *heap, int heap_size) -PUSH_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size) - -static void NodeDistance_pop_heap(NodeDistance *heap, int heap_size) -POP_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size) - -/* NN function that uses an heap.. this functions leads to an optimal number of min-distance - * but for normal tri-faces and BV 6-dop.. a simple dfs with local heuristics (as implemented - * in source/blender/blenkernel/intern/shrinkwrap.c) works faster. - * - * It may make sense to use this function if the callback queries are very slow.. or if its impossible - * to get a nice heuristic - * - * this function uses "malloc/free" instead of the MEM_* because it intends to be thread safe */ -static void bfs_find_nearest(BVHNearestData *data, BVHNode *node) -{ - int i; - NodeDistance default_heap[DEFAULT_FIND_NEAREST_HEAP_SIZE]; - NodeDistance *heap = default_heap, current; - int heap_size = 0, max_heap_size = sizeof(default_heap) / sizeof(default_heap[0]); - float nearest[3]; - - int callbacks = 0, push_heaps = 0; - - if (node->totnode == 0) { - dfs_find_nearest_dfs(data, node); - return; - } - - current.node = node; - current.dist = calc_nearest_point(data->proj, node, nearest); - - while (current.dist < data->nearest.dist) { -// printf("%f : %f\n", current.dist, data->nearest.dist); - for (i = 0; i < current.node->totnode; i++) { - BVHNode *child = current.node->children[i]; - if (child->totnode == 0) { - callbacks++; - dfs_find_nearest_dfs(data, child); - } - else { - /* adjust heap size */ - if ((heap_size >= max_heap_size) && - ADJUST_MEMORY(default_heap, (void **)&heap, - heap_size + 1, &max_heap_size, sizeof(heap[0])) == false) - { - printf("WARNING: bvh_find_nearest got out of memory\n"); - - if (heap != default_heap) - free(heap); - - return; - } - - heap[heap_size].node = current.node->children[i]; - heap[heap_size].dist = calc_nearest_point(data->proj, current.node->children[i], nearest); - - if (heap[heap_size].dist >= data->nearest.dist) continue; - heap_size++; - - NodeDistance_push_heap(heap, heap_size); - // PUSH_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size); - push_heaps++; - } - } - - if (heap_size == 0) break; - - current = heap[0]; - NodeDistance_pop_heap(heap, heap_size); -// POP_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size); - heap_size--; - } - -// printf("hsize=%d, callbacks=%d, pushs=%d\n", heap_size, callbacks, push_heaps); - - if (heap != default_heap) - free(heap); -} -#endif - - int BLI_bvhtree_find_nearest( BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata) @@ -1768,35 +1510,6 @@ static void dfs_raycast_all(BVHRayCastData *data, BVHNode *node) } } -#if 0 -static void iterative_raycast(BVHRayCastData *data, BVHNode *node) -{ - while (node) { - float dist = fast_ray_nearest_hit(data, node); - if (dist >= data->hit.dist) { - node = node->skip[1]; - continue; - } - - if (node->totnode == 0) { - if (data->callback) { - data->callback(data->userdata, node->index, &data->ray, &data->hit); - } - else { - data->hit.index = node->index; - data->hit.dist = dist; - madd_v3_v3v3fl(data->hit.co, data->ray.origin, data->ray.direction, dist); - } - - node = node->skip[1]; - } - else { - node = node->children[0]; - } - } -} -#endif - static void bvhtree_ray_cast_data_precalc(BVHRayCastData *data, int flag) { int i; diff --git a/source/blender/blenlib/intern/array_store_utils.c b/source/blender/blenlib/intern/array_store_utils.c index 83cd28ddf11..97e4207328b 100644 --- a/source/blender/blenlib/intern/array_store_utils.c +++ b/source/blender/blenlib/intern/array_store_utils.c @@ -43,9 +43,6 @@ BArrayStore *BLI_array_store_at_size_ensure( BArrayStore **bs_p = &bs_stride->stride_table[stride - 1]; if ((*bs_p) == NULL) { -#if 0 - unsigned int chunk_count = chunk_size; -#else /* calculate best chunk-count to fit a power of two */ unsigned int chunk_count = chunk_size; { @@ -54,7 +51,6 @@ BArrayStore *BLI_array_store_at_size_ensure( size = MEM_SIZE_OPTIMAL(size); chunk_count = size / stride; } -#endif (*bs_p) = BLI_array_store_create(stride, chunk_count); } diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index 7074a776aaf..1ba26b06c18 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -659,49 +659,6 @@ void BLI_edgehashIterator_free(EdgeHashIterator *ehi) MEM_freeN(ehi); } -/* inline functions now */ -#if 0 -/** - * Retrieve the key from an iterator. - */ -void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, uint *r_v0, uint *r_v1) -{ - *r_v0 = ehi->curEntry->v0; - *r_v1 = ehi->curEntry->v1; -} - -/** - * Retrieve the value from an iterator. - */ -void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) -{ - return ehi->curEntry->val; -} - -/** - * Retrieve the pointer to the value from an iterator. - */ -void **BLI_edgehashIterator_getValue_p(EdgeHashIterator *ehi) -{ - return &ehi->curEntry->val; -} - -/** - * Set the value for an iterator. - */ -void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) -{ - ehi->curEntry->val = val; -} - -/** - * Determine if an iterator is done. - */ -bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) -{ - return (ehi->curEntry == NULL); -} -#endif /** \} */ diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 9045012af00..0bed7d42e9f 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -291,14 +291,6 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile *pf) const char *fontname; VFontData *vfd; -#if 0 - FT_CharMap found = 0; - FT_CharMap charmap; - FT_UShort my_platform_id = TT_PLATFORM_MICROSOFT; - FT_UShort my_encoding_id = TT_MS_ID_UNICODE_CS; - int n; -#endif - /* load the freetype font */ err = FT_New_Memory_Face(library, pf->data, @@ -308,25 +300,6 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile *pf) if (err) return NULL; -#if 0 - for (n = 0; n < face->num_charmaps; n++) - { - charmap = face->charmaps[n]; - if (charmap->platform_id == my_platform_id && - charmap->encoding_id == my_encoding_id) - { - found = charmap; - break; - } - } - - if (!found) { return NULL; } - - /* now, select the charmap for the face object */ - err = FT_Set_Charmap(face, found); - if (err) { return NULL; } -#endif - /* allocate blender font */ vfd = MEM_callocN(sizeof(*vfd), "FTVFontData"); @@ -410,13 +383,6 @@ static int check_freetypefont(PackedFile *pf) FT_Face face; FT_GlyphSlot glyph; FT_UInt glyph_index; -#if 0 - FT_CharMap charmap; - FT_CharMap found; - FT_UShort my_platform_id = TT_PLATFORM_MICROSOFT; - FT_UShort my_encoding_id = TT_MS_ID_UNICODE_CS; - int n; -#endif int success = 0; err = FT_New_Memory_Face(library, @@ -429,23 +395,6 @@ static int check_freetypefont(PackedFile *pf) //XXX error("This is not a valid font"); } else { - -#if 0 - for (n = 0; n < face->num_charmaps; n++) { - charmap = face->charmaps[n]; - if (charmap->platform_id == my_platform_id && charmap->encoding_id == my_encoding_id) { - found = charmap; - break; - } - } - - if (!found) { return 0; } - - /* now, select the charmap for the face object */ - err = FT_Set_Charmap(face, found); - if (err) { return 0; } -#endif - glyph_index = FT_Get_Char_Index(face, 'A'); err = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP); if (err) { @@ -550,22 +499,6 @@ VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag)) return vchar_dst; } -#if 0 - -/* Freetype2 Outline struct */ - -typedef struct FT_Outline_ { - short n_contours; /* number of contours in glyph */ - short n_points; /* number of points in the glyph */ - - FT_Vector *points; /* the outline's points */ - char *tags; /* the points flags */ - short *contours; /* the contour end points */ - - int flags; /* outline masks */ -} FT_Outline; - -#endif /* * from: http://www.freetype.org/freetype2/docs/glyphs/glyphs-6.html#section-1 diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index a5c84ed7645..d59d7b4fe6a 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -534,21 +534,11 @@ float dist_signed_squared_to_corner_v3v3v3( cross_v3_v3v3(plane_a, dir_a, axis); cross_v3_v3v3(plane_b, axis, dir_b); -#if 0 - plane_from_point_normal_v3(plane_a, v2, plane_a); - plane_from_point_normal_v3(plane_b, v2, plane_b); - - dist_a = dist_signed_squared_to_plane_v3(p, plane_a); - dist_b = dist_signed_squared_to_plane_v3(p, plane_b); -#else /* calculate without the planes 4th component to avoid float precision issues */ sub_v3_v3v3(s_p_v2, p, v2); dist_a = dist_signed_squared_to_plane3_v3(s_p_v2, plane_a); dist_b = dist_signed_squared_to_plane3_v3(s_p_v2, plane_b); -#endif - - if (flip) { return min_ff(dist_a, dist_b); @@ -1456,90 +1446,6 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2], } /* point in polygon (keep float and int versions in sync) */ -#if 0 -bool isect_point_poly_v2(const float pt[2], const float verts[][2], const unsigned int nr, - const bool use_holes) -{ - /* we do the angle rule, define that all added angles should be about zero or (2 * PI) */ - float angletot = 0.0; - float fp1[2], fp2[2]; - unsigned int i; - const float *p1, *p2; - - p1 = verts[nr - 1]; - - /* first vector */ - fp1[0] = (float)(p1[0] - pt[0]); - fp1[1] = (float)(p1[1] - pt[1]); - - for (i = 0; i < nr; i++) { - p2 = verts[i]; - - /* second vector */ - fp2[0] = (float)(p2[0] - pt[0]); - fp2[1] = (float)(p2[1] - pt[1]); - - /* dot and angle and cross */ - angletot += angle_signed_v2v2(fp1, fp2); - - /* circulate */ - copy_v2_v2(fp1, fp2); - p1 = p2; - } - - angletot = fabsf(angletot); - if (use_holes) { - const float nested = floorf((angletot / (float)(M_PI * 2.0)) + 0.00001f); - angletot -= nested * (float)(M_PI * 2.0); - return (angletot > 4.0f) != ((int)nested % 2); - } - else { - return (angletot > 4.0f); - } -} -bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], const unsigned int nr, - const bool use_holes) -{ - /* we do the angle rule, define that all added angles should be about zero or (2 * PI) */ - float angletot = 0.0; - float fp1[2], fp2[2]; - unsigned int i; - const int *p1, *p2; - - p1 = verts[nr - 1]; - - /* first vector */ - fp1[0] = (float)(p1[0] - pt[0]); - fp1[1] = (float)(p1[1] - pt[1]); - - for (i = 0; i < nr; i++) { - p2 = verts[i]; - - /* second vector */ - fp2[0] = (float)(p2[0] - pt[0]); - fp2[1] = (float)(p2[1] - pt[1]); - - /* dot and angle and cross */ - angletot += angle_signed_v2v2(fp1, fp2); - - /* circulate */ - copy_v2_v2(fp1, fp2); - p1 = p2; - } - - angletot = fabsf(angletot); - if (use_holes) { - const float nested = floorf((angletot / (float)(M_PI * 2.0)) + 0.00001f); - angletot -= nested * (float)(M_PI * 2.0); - return (angletot > 4.0f) != ((int)nested % 2); - } - else { - return (angletot > 4.0f); - } -} - -#else - bool isect_point_poly_v2(const float pt[2], const float verts[][2], const unsigned int nr, const bool UNUSED(use_holes)) { @@ -1569,8 +1475,6 @@ bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], const unsign return isect; } -#endif - /* point in tri */ /* only single direction */ @@ -2592,18 +2496,6 @@ bool isect_axial_line_segment_tri_v3( float u, v, f; int a0 = axis, a1 = (axis + 1) % 3, a2 = (axis + 2) % 3; -#if 0 - return isect_line_segment_tri_v3(p1, p2, v0, v1, v2, lambda); - - /* first a simple bounding box test */ - if (min_fff(v0[a1], v1[a1], v2[a1]) > p1[a1]) return false; - if (min_fff(v0[a2], v1[a2], v2[a2]) > p1[a2]) return false; - if (max_fff(v0[a1], v1[a1], v2[a1]) < p1[a1]) return false; - if (max_fff(v0[a2], v1[a2], v2[a2]) < p1[a2]) return false; - - /* then a full intersection test */ -#endif - sub_v3_v3v3(e1, v1, v0); sub_v3_v3v3(e2, v2, v0); sub_v3_v3v3(p, v0, p1); @@ -2920,13 +2812,10 @@ float line_point_factor_v3_ex( float dot; sub_v3_v3v3(u, l2, l1); sub_v3_v3v3(h, p, l1); -#if 0 - return (dot_v3v3(u, h) / dot_v3v3(u, u)); -#else + /* better check for zero */ dot = len_squared_v3(u); return (dot > epsilon) ? (dot_v3v3(u, h) / dot) : fallback; -#endif } float line_point_factor_v3( const float p[3], const float l1[3], const float l2[3]) @@ -2942,13 +2831,9 @@ float line_point_factor_v2_ex( float dot; sub_v2_v2v2(u, l2, l1); sub_v2_v2v2(h, p, l1); -#if 0 - return (dot_v2v2(u, h) / dot_v2v2(u, u)); -#else /* better check for zero */ dot = len_squared_v2(u); return (dot > epsilon) ? (dot_v2v2(u, h) / dot) : fallback; -#endif } float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]) @@ -3063,18 +2948,6 @@ bool point_in_slice_seg(float p[3], float l1[3], float l2[3]) return point_in_slice_as(p, l1, normal); } -#if 0 -/*mama (knowing the squared length of the normal) */ -static int point_in_slice_m(float p[3], float origin[3], float normal[3], float lns) -{ - float h, rp[3]; - sub_v3_v3v3(rp, p, origin); - h = dot_v3v3(normal, rp) / lns; - if (h < 0.0f || h > 1.0f) return 0; - return 1; -} -#endif - bool isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]) { if (!point_in_slice(p, v1, v2, v3)) return false; diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index b93a7f55821..71da270e1f2 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -57,19 +57,6 @@ static float P(float k) return (float)(1.0f / 6.0f) * (p1 * p1 * p1 - 4.0f * p2 * p2 * p2 + 6.0f * p3 * p3 * p3 - 4.0f * p4 * p4 * p4); } - -#if 0 -/* older, slower function, works the same as above */ -static float P(float k) -{ - return (float)(1.0f / 6.0f) * - (pow(MAX2(k + 2.0f, 0), 3.0f) - 4.0f * - pow(MAX2(k + 1.0f, 0), 3.0f) + 6.0f * - pow(MAX2(k, 0), 3.0f) - 4.0f * - pow(MAX2(k - 1.0f, 0), 3.0f)); -} -#endif - static void vector_from_float(const float *data, float vector[4], int components) { if (components == 1) { @@ -179,45 +166,6 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl /* Done with optimized part */ -#if 0 - /* older, slower function, works the same as above */ - for (n = -1; n <= 2; n++) { - for (m = -1; m <= 2; m++) { - x1 = i + n; - y1 = j + m; - if (x1 > 0 && x1 < width && y1 > 0 && y1 < height) { - float data[4]; - - if (float_output) { - const float *float_data = float_buffer + width * y1 * components + components * x1; - - vector_from_float(float_data, data, components); - } - else { - const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1; - - vector_from_byte(byte_data, data, components); - } - - if (components == 1) { - out[0] += data[0] * P(n - a) * P(b - m); - } - else if (components == 3) { - out[0] += data[0] * P(n - a) * P(b - m); - out[1] += data[1] * P(n - a) * P(b - m); - out[2] += data[2] * P(n - a) * P(b - m); - } - else { - out[0] += data[0] * P(n - a) * P(b - m); - out[1] += data[1] * P(n - a) * P(b - m); - out[2] += data[2] * P(n - a) * P(b - m); - out[3] += data[3] * P(n - a) * P(b - m); - } - } - } - } -#endif - if (float_output) { if (components == 1) { float_output[0] = out[0]; diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 075ae2f5357..8ee99544ca5 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1092,26 +1092,6 @@ static float noise3_perlin(float vec[3]) #undef SURVE } -#if 0 -static float turbulence_perlin(const float point[3], float lofreq, float hifreq) -{ - float freq, t, p[3]; - - p[0] = point[0] + 123.456; - p[1] = point[1]; - p[2] = point[2]; - - t = 0; - for (freq = lofreq; freq < hifreq; freq *= 2.0) { - t += fabsf(noise3_perlin(p)) / freq; - p[0] *= 2.0f; - p[1] *= 2.0f; - p[2] *= 2.0f; - } - return t - 0.3; /* readjust to make mean value = 0.0 */ -} -#endif - /* for use with BLI_gNoise/gTurbulence, returns signed noise */ static float orgPerlinNoise(float x, float y, float z) { @@ -1147,19 +1127,6 @@ float BLI_hnoisep(float noisesize, float x, float y, float z) return noise3_perlin(vec); } -#if 0 -static float turbulencep(float noisesize, float x, float y, float z, int nr) -{ - float vec[3]; - - vec[0] = x / noisesize; - vec[1] = y / noisesize; - vec[2] = z / noisesize; - nr++; - return turbulence_perlin(vec, 1.0, (float)(1 << nr)); -} -#endif - /******************/ /* VORONOI/WORLEY */ /******************/ diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 52bc27caa1f..a7118a583b5 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1343,16 +1343,6 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir, c return; /* string is NULL, probably shouldnt happen but return anyway */ } - - /* we first push all slashes into unix mode, just to make sure we don't get - * any mess with slashes later on. -jesterKing */ - /* constant strings can be passed for those parameters - don't change them - elubie */ -#if 0 - BLI_str_replace_char(relabase, '\\', '/'); - BLI_str_replace_char(dir, '\\', '/'); - BLI_str_replace_char(file, '\\', '/'); -#endif - /* Resolve relative references */ if (relabase && dir[0] == '/' && dir[1] == '/') { char *lslash; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index f1564d132e3..427a3eb1edb 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -811,38 +811,6 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const } #endif -#if 0 - if (flag & BLI_SCANFILL_CALC_QUADTRI_FASTPATH) { - const int totverts = BLI_listbase_count(&sf_ctx->fillvertbase); - - if (totverts == 3) { - eve = sf_ctx->fillvertbase.first; - - addfillface(sf_ctx, eve, eve->next, eve->next->next); - return 1; - } - else if (totverts == 4) { - float vec1[3], vec2[3]; - - eve = sf_ctx->fillvertbase.first; - /* no need to check 'eve->next->next->next' is valid, already counted */ - /* use shortest diagonal for quad */ - sub_v3_v3v3(vec1, eve->co, eve->next->next->co); - sub_v3_v3v3(vec2, eve->next->co, eve->next->next->next->co); - - if (dot_v3v3(vec1, vec1) < dot_v3v3(vec2, vec2)) { - addfillface(sf_ctx, eve, eve->next, eve->next->next); - addfillface(sf_ctx, eve->next->next, eve->next->next->next, eve); - } - else { - addfillface(sf_ctx, eve->next, eve->next->next, eve->next->next->next); - addfillface(sf_ctx, eve->next->next->next, eve, eve->next); - } - return 2; - } - } -#endif - /* first test vertices if they are in edges */ /* including resetting of flags */ for (eed = sf_ctx->filledgebase.first; eed; eed = eed->next) { |