@@ -115,9 +115,10 @@ SurfaceMesh* TreeViewer::leaves() const {
115115bool TreeViewer::key_press_event (int key, int modifiers)
116116{
117117 if (key == GLFW_KEY_P && modifiers == GLFW_MOD_SHIFT) {
118- if (!cloud ())
119- return false ;
120- cloud ()->set_visible (!cloud ()->is_visible ());
118+ if (cloud ()) {
119+ PointsDrawable* vertices = cloud ()->points_drawable (" vertices" );
120+ vertices->set_visible (!vertices->is_visible ());
121+ }
121122 return true ;
122123 }
123124
@@ -127,8 +128,10 @@ bool TreeViewer::key_press_event(int key, int modifiers)
127128
128129 // shift the visibility of the graph drawable
129130 LinesDrawable* graph_drawable = cloud ()->lines_drawable (" graph" );
130- if (!graph_drawable)
131+ if (!graph_drawable) {
131132 create_skeleton_drawable (ST_SMOOTHED);
133+ graph_drawable = cloud ()->lines_drawable (" graph" );
134+ }
132135 if (graph_drawable)
133136 graph_drawable->set_visible (!graph_drawable->is_visible ());
134137 return true ;
@@ -450,8 +453,10 @@ bool TreeViewer::create_skeleton_drawable(SkeletonType type)
450453
451454 // initialize the line drawable object;
452455 LinesDrawable* graph_drawable = cloud ()->lines_drawable (" graph" );
453- if (!graph_drawable)
454- graph_drawable = cloud ()->add_lines_drawable (" graph" );
456+ if (!graph_drawable) {
457+ graph_drawable = cloud ()->add_lines_drawable (" graph" );
458+ graph_drawable->set_visible (false ); // not visible by default
459+ }
455460 graph_drawable->update_vertex_buffer (graph_points);
456461 graph_drawable->set_per_vertex_color (false );
457462 graph_drawable->set_default_color (vec3 (0 .0f , 0 .0f , 0 .0f ));
@@ -514,7 +519,8 @@ bool TreeViewer::reconstruct_skeleton() {
514519 if (!branches ())
515520 add_model (mesh);
516521
517- cloud ()->set_visible (false );
522+ PointsDrawable* vertices = cloud ()->points_drawable (" vertices" );
523+ vertices->set_visible (false );
518524 return true ;
519525 }
520526
0 commit comments