[Bf-blender-cvs] [2ba9572d9ee] master: Cleanup: remove unused statvis code & struct members
Campbell Barton
noreply at git.blender.org
Tue Dec 24 12:40:42 CET 2019
Commit: 2ba9572d9ee7bd028254578183b751ba5496b979
Author: Campbell Barton
Date: Tue Dec 24 22:32:43 2019 +1100
Branches: master
https://developer.blender.org/rB2ba9572d9ee7bd028254578183b751ba5496b979
Cleanup: remove unused statvis code & struct members
This code has been moved into the draw manager.
===================================================================
M source/blender/blenkernel/BKE_editmesh.h
M source/blender/blenkernel/CMakeLists.txt
M source/blender/blenkernel/intern/DerivedMesh.c
D source/blender/blenkernel/intern/editderivedmesh.c
M source/blender/blenkernel/intern/editmesh.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h
index 1b9e318146e..7c27362e244 100644
--- a/source/blender/blenkernel/BKE_editmesh.h
+++ b/source/blender/blenkernel/BKE_editmesh.h
@@ -65,10 +65,6 @@ typedef struct BMEditMesh {
/*derivedmesh stuff*/
CustomData_MeshMasks lastDataMask;
- unsigned char (*derivedVertColor)[4];
- int derivedVertColorLen;
- unsigned char (*derivedFaceColor)[4];
- int derivedFaceColorLen;
/*selection mode*/
short selectmode;
@@ -96,20 +92,11 @@ BMEditMesh *BKE_editmesh_from_object(struct Object *ob);
void BKE_editmesh_free_derivedmesh(BMEditMesh *em);
void BKE_editmesh_free(BMEditMesh *em);
-void BKE_editmesh_color_free(BMEditMesh *em);
-void BKE_editmesh_color_ensure(BMEditMesh *em, const char htype);
+float (*BKE_editmesh_vert_coords_alloc(
+ struct Depsgraph *depsgraph, struct BMEditMesh *em, struct Scene *scene, int *r_vert_len))[3];
float (*BKE_editmesh_vert_coords_alloc_orco(BMEditMesh *em, int *r_vert_len))[3];
void BKE_editmesh_lnorspace_update(BMEditMesh *em);
void BKE_editmesh_ensure_autosmooth(BMEditMesh *em);
struct BoundBox *BKE_editmesh_cage_boundbox_get(BMEditMesh *em);
-/* editderivedmesh.c */
-/* should really be defined in editmesh.c, but they use 'EditDerivedBMesh' */
-void BKE_editmesh_statvis_calc(BMEditMesh *em,
- struct EditMeshData *emd,
- const struct MeshStatVis *statvis);
-
-float (*BKE_editmesh_vert_coords_alloc(
- struct Depsgraph *depsgraph, struct BMEditMesh *em, struct Scene *scene, int *r_vert_len))[3];
-
#endif /* __BKE_EDITMESH_H__ */
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 65e709c8941..3db878ab95f 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -106,7 +106,6 @@ set(SRC
intern/deform.c
intern/displist.c
intern/dynamicpaint.c
- intern/editderivedmesh.c
intern/editlattice.c
intern/editmesh.c
intern/editmesh_bvh.c
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8be7a947a67..df4582267b5 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -789,14 +789,6 @@ static void add_orco_mesh(Object *ob, BMEditMesh *em, Mesh *mesh, Mesh *mesh_orc
}
}
-static void editmesh_update_statvis_color(const Scene *scene, Object *ob)
-{
- BMEditMesh *em = BKE_editmesh_from_object(ob);
- Mesh *me = ob->data;
- BKE_mesh_runtime_ensure_edit_data(me);
- BKE_editmesh_statvis_calc(em, me->runtime.edit_data, &scene->toolsettings->statvis);
-}
-
static void mesh_calc_modifier_final_normals(const Mesh *mesh_input,
const CustomData_MeshMasks *final_datamask,
const bool sculpt_dyntopo,
@@ -1494,7 +1486,6 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph,
/* Modifier evaluation modes. */
const int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
- const bool do_init_statvis = false; /* FIXME: use V3D_OVERLAY_EDIT_STATVIS. */
/* Modifier evaluation contexts for different types of modifiers. */
const ModifierEvalContext mectx = {depsgraph, ob, MOD_APPLY_USECACHE};
@@ -1703,22 +1694,12 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph,
else if (!deformed_verts && mesh_cage) {
/* cage should already have up to date normals */
mesh_final = mesh_cage;
-
- /* In this case, we should never have weight-modifying modifiers in stack... */
- if (do_init_statvis) {
- editmesh_update_statvis_color(scene, ob);
- }
}
else {
/* this is just a copy of the editmesh, no need to calc normals */
mesh_final = BKE_mesh_from_editmesh_with_coords_thin_wrap(
em_input, &final_datamask, deformed_verts, mesh_input);
deformed_verts = NULL;
-
- /* In this case, we should never have weight-modifying modifiers in stack... */
- if (do_init_statvis) {
- editmesh_update_statvis_color(scene, ob);
- }
}
if (deformed_verts) {
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
deleted file mode 100644
index 2df3d2f0fe9..00000000000
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- */
-
-/** \file
- * \ingroup bke
- *
- * basic design:
- *
- * the bmesh derivedmesh exposes the mesh as triangles. it stores pointers
- * to three loops per triangle. the derivedmesh stores a cache of tessellations
- * for each face. this cache will smartly update as needed (though at first
- * it'll simply be more brute force). keeping track of face/edge counts may
- * be a small problem.
- *
- * this won't be the most efficient thing, considering that internal edges and
- * faces of tessellations are exposed. looking up an edge by index in particular
- * is likely to be a little slow.
- */
-
-#include "atomic_ops.h"
-
-#include "BLI_math.h"
-#include "BLI_jitter_2d.h"
-#include "BLI_bitmap.h"
-#include "BLI_task.h"
-
-#include "BKE_cdderivedmesh.h"
-#include "BKE_deform.h"
-#include "BKE_mesh.h"
-#include "BKE_mesh_iterators.h"
-#include "BKE_editmesh.h"
-#include "BKE_editmesh_bvh.h"
-#include "BKE_editmesh_cache.h"
-#include "BKE_editmesh_tangent.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-
-#include "MEM_guardedalloc.h"
-
-/* -------------------------------------------------------------------- */
-/* StatVis Functions */
-
-static void axis_from_enum_v3(float v[3], const char axis)
-{
- zero_v3(v);
- if (axis < 3) {
- v[axis] = 1.0f;
- }
- else {
- v[axis - 3] = -1.0f;
- }
-}
-
-static void statvis_calc_overhang(BMEditMesh *em,
- const float (*polyNos)[3],
- /* values for calculating */
- const float min,
- const float max,
- const char axis,
- /* result */
- unsigned char (*r_face_colors)[4])
-{
- BMIter iter;
- BMesh *bm = em->bm;
- BMFace *f;
- float dir[3];
- int index;
- const float minmax_irange = 1.0f / (max - min);
- bool is_max;
-
- /* fallback */
- unsigned char col_fallback[4] = {64, 64, 64, 255}; /* gray */
- unsigned char col_fallback_max[4] = {0, 0, 0, 255}; /* max color */
-
- BLI_assert(min <= max);
-
- axis_from_enum_v3(dir, axis);
-
- if (LIKELY(em->ob)) {
- mul_transposed_mat3_m4_v3(em->ob->obmat, dir);
- normalize_v3(dir);
- }
-
- /* fallback max */
- {
- float fcol[3];
- BKE_defvert_weight_to_rgb(fcol, 1.0f);
- rgb_float_to_uchar(col_fallback_max, fcol);
- }
-
- /* now convert into global space */
- BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, index) {
- float fac = angle_normalized_v3v3(polyNos ? polyNos[index] : f->no, dir) / (float)M_PI;
-
- /* remap */
- if ((is_max = (fac <= max)) && (fac >= min)) {
- float fcol[3];
- fac = (fac - min) * minmax_irange;
- fac = 1.0f - fac;
- CLAMP(fac, 0.0f, 1.0f);
- BKE_defvert_weight_to_rgb(fcol, fac);
- rgb_float_to_uchar(r_face_colors[index], fcol);
- }
- else {
- const unsigned char *fallback = is_max ? col_fallback_max : col_fallback;
- copy_v4_v4_uchar(r_face_colors[index], fallback);
- }
- }
-}
-
-/* so we can use jitter values for face interpolation */
-static void uv_from_jitter_v2(float uv[2])
-{
- uv[0] += 0.5f;
- uv[1] += 0.5f;
- if (uv[0] + uv[1] > 1.0f) {
- uv[0] = 1.0f - uv[0];
- uv[1] = 1.0f - uv[1];
- }
-
- CLAMP(uv[0], 0.0f, 1.0f);
- CLAMP(uv[1], 0.0f, 1.0f);
-}
-
-static void statvis_calc_thickness(BMEditMesh *em,
- const float (*vertexCos)[3],
- /* values for calculating */
- const float min,
- const float max,
- const int samples,
- /* result */
- unsigned char (*r_face_colors)[4])
-{
- const float eps_offset = 0.00002f; /* values <= 0.00001 give errors */
- float *face_dists = (float *)r_face_colors; /* cheating */
- const bool use_jit = samples < 32;
- float jit_ofs[32][2];
- BMesh *bm = em->bm;
- const int tottri = em->tottri;
- const float minmax_irange = 1.0f / (max - min);
- int i;
-
- struct BMLoop *(*looptris)[3] = em->looptris;
-
- /* fallback */
- const unsigned char col_fallback[4] = {64, 64, 64, 255};
-
- struct BMBVHTree *bmtree;
-
- BLI_assert(min <= max);
-
- copy_vn_fl(face_dists, em->bm->totface, max);
-
- if (use_jit) {
- int j;
- BLI_assert(samples < 32);
- BLI_jitter_init(jit_ofs, samples);
-
- for (j = 0; j < samples; j++) {
- uv_from_jitter_v2(jit_ofs[j]);
- }
- }
-
- BM_mesh_elem_index_ensure(bm, BM_FACE);
- if (vertexCos) {
- BM_mesh_elem_index_ensure(bm, BM_VERT);
- }
-
- bmtree = BKE_bmbvh_new_from_editmesh(em, 0, vertexCos, false);
-
- for (i = 0; i < tottri; i++) {
- BMFace *f_hit;
- BMLoop **ltri = looptris
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list