Better logic to display symmetries
authorMartin Poirier <theeth@yahoo.com>
Fri, 15 Aug 2008 20:55:38 +0000 (20:55 +0000)
committerMartin Poirier <theeth@yahoo.com>
Fri, 15 Aug 2008 20:55:38 +0000 (20:55 +0000)
Add option to hide node and arc indexes (for cleaner screenshots)

source/blender/blenlib/BLI_graph.h
source/blender/makesdna/DNA_scene_types.h
source/blender/src/buttons_editing.c
source/blender/src/reeb.c

index 89f21b919e293c5e0e291ad1e88dd3e5b9857e7f..59e73004b8bc8a3b2e39ea921eac2d099edafea7 100644 (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_*/
index 55d5a68662a7b9139b977407e380d8b57af46489..5acc4b4acbe2d569226f8b5a63d9ca4391d98c7a 100644 (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
index 906405344c47d7f3e2949ddda6111c11791da33d..98f20b94495df0f34292f316550baeeaa2919f4d 100644 (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");
index 9938a8850ccb354b8dad2b2ed9cb20162ed480f0..fa88d582a1806d76c2612287454c07bfa649a6aa 100644 (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);