Index: trunk/src/hid_helper.c =================================================================== --- trunk/src/hid_helper.c (revision 18264) +++ trunk/src/hid_helper.c (revision 18265) @@ -288,7 +288,7 @@ return -1; } -void pcb_cam_end(pcb_cam_t *dst) +int pcb_cam_end(pcb_cam_t *dst) { free(dst->inst); dst->inst = NULL; @@ -296,6 +296,7 @@ return; layervis_restore(dst); dst->active = 0; + return dst->exported_grps; } @@ -316,9 +317,11 @@ } else { int vid = vl->new_id - PCB_LYT_VIRTUAL - 1; - return !cam->vgrp_vis[vid]; + if (!cam->vgrp_vis[vid]) + return 1; } + cam->exported_grps++; return 0; } Index: trunk/src/hid_helper.h =================================================================== --- trunk/src/hid_helper.h (revision 18264) +++ trunk/src/hid_helper.h (revision 18265) @@ -34,12 +34,16 @@ char *inst; pcb_board_t *pcb; int orig_vis[PCB_MAX_LAYER]; /* backup of the original layer visibility */ + int exported_grps; } pcb_cam_t; int pcb_cam_begin(pcb_board_t *pcb, pcb_cam_t *dst, const char *src, const pcb_hid_attribute_t *attr_tbl, int numa, pcb_hid_attr_val_t *options); -void pcb_cam_end(pcb_cam_t *dst); +/* Finish cam export, free all memory, mark cam export inactive and report + the number of layer groups exported */ +int pcb_cam_end(pcb_cam_t *dst); + /* Shall be the first rule in a cam capable exporter's set_layer_group() callback: decides not to draw a layer group in cam mode if the group is not scheduled for export */