bool stop( LSHandle *handle, LSMessage *msg, void *ctx) { if(rec_stop()) { LSMessageRespond( msg, "{\"returnValue\": true, \"Status\": true}", NULL); return true; } else LSMessageRespond( msg, "{\"rerurnValue\": true, \"Status\": false}", NULL); return false; }
void rec(u8 shape, u8 x, u8 y) { if(r_status == rArm) { es.p[p_select].e[0].shape = shape; es.p[p_select].e[0].x = x; es.p[p_select].e[0].y = y; rec_position = 1; rec_start(); } else { es.p[p_select].e[rec_position].shape = shape; es.p[p_select].e[rec_position].x = x; es.p[p_select].e[rec_position].y = y; if(rec_timer) es.p[p_select].e[rec_position-1].interval = rec_timer-1; else es.p[p_select].e[rec_position-1].interval = 1; rec_position++; rec_timer = 0; if(rec_position == EVENTS_PER_PATTERN) rec_stop(); } }
void Recorder::pre_draw_CB() { //set/get time, cam_pos, etc... CAM tmp("temp"); if ( !_cur_path ) return; if ( !_paused ) { if ( _sync && ( _path_pos > _target_frame ) ) replay(); double ttime = _swatch->elapsed_time(); if ( _play_on ) { //forward to closest path after current time if ( _path_pos >= (int)_cur_path->state_list.size() || _cur_path->state_list.empty() ) { cerr << "end of state list reached::camera stop" << endl; rec_stop() ; return; } if ( _render_on || _play_all_frames ) { CAMptr mine = (_cur_path->state_list[_path_pos]->cam()); _view->cam()->data()->set_from ( mine->data()->from() ); _view->cam()->data()->set_at ( mine->data()->at() ); _view->cam()->data()->set_up ( mine->data()->up() ); _view->cam()->data()->set_center ( mine->data()->center() ); _view->cam()->data()->set_focal ( mine->data()->focal() ); _view->cam()->data()->set_persp ( mine->data()->persp() ); _view->cam()->data()->set_iod ( mine->data()->iod() ); _view->set_frame_time( _cur_path->state_list[_path_pos]->t()); //update UI to reflect which frame is being shown _ui->set_frame_num ( _path_pos ); if ( _sync ) { if ( _path_pos == _target_frame ) { cerr << "at target frame: pausing:" << endl ; rec_pause(); } else if ( _path_pos > _target_frame ) { cerr << "ack, we need to set back"<< endl; replay(); } else _path_pos++; } else { if ( _path_pos >= (int)_cur_path->state_list.size() -1 ) rec_stop(); else if ( _path_pos >= _target_frame ) rec_pause(); else _path_pos++; } } else { while ( _cur_path->state_list[_path_pos]->t() < ttime ) { _path_pos++; if ( _path_pos >= (int)_cur_path->state_list.size()) { rec_stop(); return; } } CAMptr mine = (_cur_path->state_list[_path_pos]->cam()); _view->cam()->data()->set_from ( mine->data()->from() ); _view->cam()->data()->set_at ( mine->data()->at() ); _view->cam()->data()->set_up ( mine->data()->up() ); _view->cam()->data()->set_center ( mine->data()->center() ); _view->cam()->data()->set_focal ( mine->data()->focal() ); _view->cam()->data()->set_persp ( mine->data()->persp() ); _view->cam()->data()->set_iod ( mine->data()->iod() ); _view->set_frame_time( _cur_path->state_list[_path_pos]->t()); _ui->set_frame_num ( _path_pos ); } //set view camera to stored camera } else if ( _record_on ) { while ( ttime >= _next_time ) { _cur_path->add( _next_time, _view->cam()); //always adds to end of list _path_pos = _cur_path->state_list.size()-1; _next_time += 1.0/_fps; //set next time to get data } } } else if ( _paused && _play_on) { if ( _sync && ( _path_pos > _target_frame ) ) { replay(); _paused = true; } if ( _path_pos < 0 || _path_pos >= (int)_cur_path->state_list.size() || _cur_path->state_list.empty() ) { rec_stop(); return; } } _ui->update_checks(); }