Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_transverts.h15
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c2
-rw-r--r--source/blender/editors/util/ed_transverts.c17
3 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h
index cbcf28d53d5..dbf156d480f 100644
--- a/source/blender/editors/include/ED_transverts.h
+++ b/source/blender/editors/include/ED_transverts.h
@@ -28,6 +28,7 @@ extern "C" {
#endif
struct Object;
+struct bContext;
typedef struct TransVert {
float *loc;
@@ -42,10 +43,14 @@ typedef struct TransVertStore {
int mode;
} TransVertStore;
-void ED_transverts_create_from_obedit(TransVertStore *tvs, struct Object *obedit, int mode);
+/**
+ * \param obedit: When `mode` has the #TM_CALC_MAPLOC flag set, `obedit` must be evaluated,
+ * to access evaluated vertices.
+ */
+void ED_transverts_create_from_obedit(TransVertStore *tvs, const struct Object *obedit, int mode);
void ED_transverts_update_obedit(TransVertStore *tvs, struct Object *obedit);
void ED_transverts_free(TransVertStore *tvs);
-bool ED_transverts_check_obedit(Object *obedit);
+bool ED_transverts_check_obedit(const struct Object *obedit);
bool ED_transverts_poll(struct bContext *C);
/* currently only used for bmesh index values */
@@ -66,12 +71,16 @@ enum {
TM_SKIP_HANDLES = (1 << 1),
/** fill in normals when available */
TM_CALC_NORMALS = (1 << 2),
+ /** Calculates #TransVert.maploc where possible. */
+ TM_CALC_MAPLOC = (1 << 2),
};
enum {
/* SELECT == (1 << 0) */
+ /** Calculated when #TM_CALC_MAPLOC is set. */
TX_VERT_USE_MAPLOC = (1 << 1),
- TX_VERT_USE_NORMAL = (1 << 2), /* avoid nonzero check */
+ /** Calculated when #TM_CALC_NORMALS is set, avoid nonzero check. */
+ TX_VERT_USE_NORMAL = (1 << 2),
};
#ifdef __cplusplus
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 53bd181f544..4334ede0a06 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -1033,7 +1033,7 @@ bool ED_view3d_minmax_verts(Object *obedit, float r_min[3], float r_max[3])
}
if (ED_transverts_check_obedit(obedit)) {
- ED_transverts_create_from_obedit(&tvs, obedit, TM_ALL_JOINTS);
+ ED_transverts_create_from_obedit(&tvs, obedit, TM_ALL_JOINTS | TM_CALC_MAPLOC);
}
if (tvs.transverts_tot == 0) {
diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c
index b8efbad1ad9..b9e90670a4d 100644
--- a/source/blender/editors/util/ed_transverts.c
+++ b/source/blender/editors/util/ed_transverts.c
@@ -195,12 +195,12 @@ static void set_mapped_co(void *vuserdata, int index, const float co[3], const f
}
}
-bool ED_transverts_check_obedit(Object *obedit)
+bool ED_transverts_check_obedit(const Object *obedit)
{
return (ELEM(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL));
}
-void ED_transverts_create_from_obedit(TransVertStore *tvs, Object *obedit, const int mode)
+void ED_transverts_create_from_obedit(TransVertStore *tvs, const Object *obedit, const int mode)
{
Nurb *nu;
BezTriple *bezt;
@@ -214,7 +214,7 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, Object *obedit, const
tvs->transverts_tot = 0;
if (obedit->type == OB_MESH) {
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ BMEditMesh *em = BKE_editmesh_from_object((Object *)obedit);
BMesh *bm = em->bm;
BMIter iter;
void *userdata[2] = {em, NULL};
@@ -312,10 +312,13 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, Object *obedit, const
userdata[1] = tvs->transverts;
}
- struct Mesh *editmesh_eval_cage = BKE_object_get_editmesh_eval_cage(obedit);
- if (tvs->transverts && editmesh_eval_cage) {
- BM_mesh_elem_table_ensure(bm, BM_VERT);
- BKE_mesh_foreach_mapped_vert(editmesh_eval_cage, set_mapped_co, userdata, MESH_FOREACH_NOP);
+ if (mode & TM_CALC_MAPLOC) {
+ struct Mesh *editmesh_eval_cage = BKE_object_get_editmesh_eval_cage(obedit);
+ if (tvs->transverts && editmesh_eval_cage) {
+ BM_mesh_elem_table_ensure(bm, BM_VERT);
+ BKE_mesh_foreach_mapped_vert(
+ editmesh_eval_cage, set_mapped_co, userdata, MESH_FOREACH_NOP);
+ }
}
}
else if (obedit->type == OB_ARMATURE) {