-----------------------------------------------------------------------------
| 447 | |
| 448 | //----------------------------------------------------------------------------- |
| 449 | void pqKeyFrameEditor::readKeyFrameData() |
| 450 | { |
| 451 | this->Internal->Model.clear(); |
| 452 | |
| 453 | if (!this->Internal->Cue) |
| 454 | { |
| 455 | return; |
| 456 | } |
| 457 | |
| 458 | int numberKeyFrames = this->Internal->Cue->getNumberOfKeyFrames(); |
| 459 | this->Internal->Model.setRowCount(numberKeyFrames); |
| 460 | QStringList headerLabels; |
| 461 | bool camera = this->Internal->cameraCue(); |
| 462 | this->Internal->EditorDelegate->CameraMode = camera; |
| 463 | if (camera) |
| 464 | { |
| 465 | this->Internal->Model.setColumnCount(2); |
| 466 | headerLabels << tr("Time"); |
| 467 | headerLabels << tr("Camera Values"); |
| 468 | } |
| 469 | else |
| 470 | { |
| 471 | this->Internal->Model.setColumnCount(3); |
| 472 | headerLabels << tr("Time"); |
| 473 | headerLabels << tr("Interpolation") << tr("Value"); |
| 474 | } |
| 475 | |
| 476 | // set the header data |
| 477 | this->Internal->Model.setHorizontalHeaderLabels(headerLabels); |
| 478 | |
| 479 | for (int i = 0; i < numberKeyFrames; i++) |
| 480 | { |
| 481 | pqSMProxy keyFrame = this->Internal->Cue->getKeyFrame(i); |
| 482 | |
| 483 | QModelIndex idx = this->Internal->Model.index(i, 0); |
| 484 | QVariant keyTime = pqSMAdaptor::getElementProperty(keyFrame->GetProperty("KeyTime")); |
| 485 | double realKeyTime = this->Internal->realTime(keyTime.toDouble()); |
| 486 | this->Internal->Model.setData(idx, realKeyTime, Qt::DisplayRole); |
| 487 | |
| 488 | if (camera) |
| 489 | { |
| 490 | bool path_based = this->Internal->cameraPathCue(); |
| 491 | if ((i < numberKeyFrames - 1) || !path_based) |
| 492 | { |
| 493 | pqCameraKeyFrameItem* item = new pqCameraKeyFrameItem(); |
| 494 | QObject::connect(&item->CamWidget, &pqCameraKeyFrameWidget::updateCurrentCamera, this, |
| 495 | [=]() { this->Internal->Editor->updateCurrentCamera(item); }); |
| 496 | QObject::connect(&item->CamWidget, &pqCameraKeyFrameWidget::useCurrentCamera, this, |
| 497 | [=]() { this->Internal->Editor->useCurrentCamera(item); }); |
| 498 | item->CamWidget.setUsePathBasedMode(path_based); |
| 499 | item->CamWidget.initializeUsingKeyFrame(keyFrame); |
| 500 | this->Internal->Model.setItem(i, 1, item); |
| 501 | } |
| 502 | } |
| 503 | else |
| 504 | { |
| 505 | if (i < numberKeyFrames - 1) |
| 506 | { |
no test coverage detected