bool key_down()

in code/cpp/tools/scene_annotation_tool/main.cpp [2654:2687]


bool key_down(igl::opengl::glfw::Viewer& viewer, unsigned char key, int modifier) {

    GLFWwindow* window = glfwGetCurrentContext();
    glfwSetWindowShouldClose(window, GL_FALSE);

    if (modifier == 1) { // modifier == SHIFT
        g_mouse_drawing_key_modifier = true;
    }

    switch (key) {
        case 'Z':
        case 'z':
            if (modifier == 8) { // modifier == COMMAND
                if (g_can_undo) {
                    undo();
                }
            }
            if (modifier == 9) { // modifier == COMMAND+SHIFT
                if (g_can_redo) {
                    redo();
                }
            }
            break;

        case ' ':
            if (g_segmentation_layer == SEGMENTATION_LAYER_SEMANTIC_INSTANCE) {
                g_semantic_instance_id         = create_new_semantic_instance_segmentation_id();
                g_updated_semantic_instance_id = true;
            }
            break;
    }

    return true;
}