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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-22 09:39:23 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-22 09:39:23 +0400
commit4537061e55b95324a39962bc9d88a4485fb650b9 (patch)
tree7ab614836785df55aba50e3eb24bf0ef199628d8
parente7fb276e294e35697cc8ae2c866f72c74bbb230a (diff)
patch [#29673] Visualize Indices (developer aid)
by Howard Trickey (howardt)
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c43
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c5
4 files changed, 53 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 57bde4eb0dd..46a569c71d4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2247,6 +2247,8 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
col.prop(mesh, "show_extra_edge_length")
col.prop(mesh, "show_extra_face_angle")
col.prop(mesh, "show_extra_face_area")
+ if bpy.app.debug:
+ col.prop(mesh, "show_extra_indices")
class VIEW3D_PT_view3d_curvedisplay(Panel):
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 3199c00a32a..eb6f50b932f 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2793,6 +2793,44 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
}
}
+static void draw_em_indices(EditMesh *em)
+{
+ EditEdge *e;
+ EditFace *f;
+ EditVert *v;
+ int i;
+ char val[32];
+ float pos[3];
+ unsigned char col[4];
+
+ /* For now, reuse appropriate theme colors from stats text colors */
+
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
+ for (v = em->verts.first, i = 0; v; v = v->next, i++) {
+ if (v->f & SELECT) {
+ sprintf(val, "%d", i);
+ view3d_cached_text_draw_add(v->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
+ }
+ }
+
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
+ for (e = em->edges.first, i = 0; e; e = e->next, i++) {
+ if (e->f & SELECT) {
+ sprintf(val, "%d", i);
+ mid_v3_v3v3(pos, e->v1->co, e->v2->co);
+ view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
+ }
+ }
+
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
+ for (f = em->faces.first, i = 0; f; f = f->next, i++) {
+ if (f->f & SELECT) {
+ sprintf(val, "%d", i);
+ view3d_cached_text_draw_add(f->cent, val, 0, V3D_CACHE_TEXT_ASCII, col);
+ }
+ }
+}
+
static int draw_em_fancy__setFaceOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r))
{
EditFace *efa = EM_get_face_for_index(index);
@@ -2968,6 +3006,11 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
{
draw_em_measure_stats(v3d, rv3d, ob, em, &scene->unit);
}
+
+ if ((G.f & G_DEBUG) && (me->drawflag & ME_DRAWEXTRA_INDICES) &&
+ !(v3d->flag2 & V3D_RENDER_OVERRIDE)) {
+ draw_em_indices(em);
+ }
}
if(dt>OB_WIRE) {
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 7d57e2c295c..f8062aeccc7 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -162,6 +162,9 @@ typedef struct TFace {
#define ME_DRAWEXTRA_FACEAREA (1 << 11)
#define ME_DRAWEXTRA_FACEANG (1 << 12)
+/* debug only option */
+#define ME_DRAWEXTRA_INDICES (1 << 13)
+
/* old global flags:
#define G_DRAWEDGES (1 << 18)
#define G_DRAWFACES (1 << 7)
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 02be3183f2c..f6e958ab1f5 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2132,6 +2132,11 @@ static void rna_def_mesh(BlenderRNA *brna)
"Display the area of selected faces, using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ prop= RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_INDICES);
+ RNA_def_property_ui_text(prop, "Indices", "Displays the index numbers of selected vertices, edges, and faces");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
/* editflag */
prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);