Better logic to display symmetries

Add option to hide node and arc indexes (for cleaner screenshots)
This commit is contained in:
Martin Poirier 2008-08-15 20:55:38 +00:00
parent 520e52d7d2
commit cc3b41b3cd
4 changed files with 26 additions and 16 deletions

View File

@ -114,5 +114,6 @@ void BLI_mirrorAlongAxis(float v[3], float center[3], float axis[3]);
#define SYM_SIDE_POSITIVE 1
#define SYM_SIDE_NEGATIVE 2
/* Anything higher is the order in radial symmetry */
#define SYM_SIDE_RADIAL 3
#endif /*BLI_GRAPH_H_*/

View File

@ -850,6 +850,7 @@ typedef struct Scene {
#define SKGEN_DISP_WEIGHT (1 << 11)
#define SKGEN_DISP_ORIG (1 << 12)
#define SKGEN_DISP_EMBED (1 << 13)
#define SKGEN_DISP_INDEX (1 << 14)
#define SKGEN_SUB_LENGTH 0
#define SKGEN_SUB_ANGLE 1

View File

@ -5048,10 +5048,12 @@ static void editing_panel_mesh_skgen_display(Object *ob, Mesh *me)
skgen_graph_block(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, SKGEN_DISP_LENGTH, REDRAWVIEW3D, "Length", 1025, 40, 63,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Length");
uiDefButBitS(block, TOG, SKGEN_DISP_WEIGHT, REDRAWVIEW3D, "Weight", 1088, 40, 63,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Weight");
uiDefButBitS(block, TOG, SKGEN_DISP_EMBED, REDRAWVIEW3D, "Embed", 1151, 40, 62,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Arc Embedings");
uiDefButBitS(block, TOG, SKGEN_DISP_ORIG, REDRAWVIEW3D, "Original", 1213, 40, 62,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Original Graph");
uiDefButBitS(block, TOG, SKGEN_DISP_LENGTH, REDRAWVIEW3D, "Length", 1025, 40, 50,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Length");
uiDefButBitS(block, TOG, SKGEN_DISP_WEIGHT, REDRAWVIEW3D, "Weight", 1075, 40, 50,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Weight");
uiDefButBitS(block, TOG, SKGEN_DISP_EMBED, REDRAWVIEW3D, "Embed", 1125, 40, 50,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Arc Embedings");
uiDefButBitS(block, TOG, SKGEN_DISP_INDEX, REDRAWVIEW3D, "Index", 1175, 40, 50,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Arc and Node indexes");
uiDefButBitS(block, TOG, SKGEN_DISP_ORIG, REDRAWVIEW3D, "Original", 1225, 40, 50,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Show Original Graph");
uiBlockEndAlign(block);
uiDefButC(block, NUM, REDRAWVIEW3D, "Level:", 1025, 20, 125,19, &G.scene->toolsettings->skgen_multi_level, 0, REEB_MAX_MULTI_LEVEL, 1, 0,"Specify the level to draw");

View File

@ -3515,11 +3515,11 @@ void REEB_draw()
{
glColor3f(1, 0, 0);
}
else if (arc->head->symmetry_flag & SYM_AXIAL)
else if (arc->symmetry_flag == SYM_SIDE_POSITIVE || arc->symmetry_flag == SYM_SIDE_NEGATIVE)
{
glColor3f(1, 0.5f, 0);
}
else if (arc->head->symmetry_flag & SYM_RADIAL)
else if (arc->symmetry_flag >= SYM_SIDE_RADIAL)
{
glColor3f(0.5f, 1, 0);
}
@ -3564,29 +3564,35 @@ void REEB_draw()
VecLerpf(vec, arc->head->p, arc->tail->p, 0.5f);
s += sprintf(s, "%i", i);
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_INDEX)
{
s += sprintf(s, "%i ", i);
}
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_WEIGHT)
{
s += sprintf(s, " - %0.3f", arc->tail->weight - arc->head->weight);
s += sprintf(s, "w:%0.3f ", arc->tail->weight - arc->head->weight);
}
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_LENGTH)
{
s += sprintf(s, " - %0.3f", arc->length);
s += sprintf(s, "l:%0.3f", arc->length);
}
glColor3f(0, 1, 0);
glRasterPos3fv(vec);
BMF_DrawString( G.fonts, text);
sprintf(text, "%i", arc->head->index);
glRasterPos3fv(arc->head->p);
BMF_DrawString( G.fonts, text);
sprintf(text, "%i", arc->tail->index);
glRasterPos3fv(arc->tail->p);
BMF_DrawString( G.fonts, text);
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_INDEX)
{
sprintf(text, "%i", arc->head->index);
glRasterPos3fv(arc->head->p);
BMF_DrawString( G.fonts, text);
sprintf(text, "%i", arc->tail->index);
glRasterPos3fv(arc->tail->p);
BMF_DrawString( G.fonts, text);
}
}
glEnable(GL_DEPTH_TEST);