| 394 | } |
| 395 | |
| 396 | void |
| 397 | PrecompNodePrivate::reloadProject(bool setWriteNodeChoice) |
| 398 | { |
| 399 | std::string filename = projectFileNameKnob.lock()->getValue(); |
| 400 | QFileInfo file( QString::fromUtf8( filename.c_str() ) ); |
| 401 | |
| 402 | if ( !file.exists() ) { |
| 403 | Dialogs::errorDialog( tr("Pre-Comp").toStdString(), tr("Pre-comp file not found.").toStdString() ); |
| 404 | |
| 405 | return; |
| 406 | } |
| 407 | QString fileUnPathed = file.fileName(); |
| 408 | |
| 409 | subLabelKnob.lock()->setValue( fileUnPathed.toStdString() ); |
| 410 | |
| 411 | QString path = file.path() + QLatin1Char('/'); |
| 412 | |
| 413 | precompInputs.clear(); |
| 414 | |
| 415 | boost::shared_ptr<Project> project = app.lock()->getProject(); |
| 416 | project->resetProject(); |
| 417 | { |
| 418 | //Set a temporary timeline that will be used while loading the project. |
| 419 | //This is to avoid that the seekFrame call has an effect on this project since they share the same timeline |
| 420 | boost::shared_ptr<TimeLine> tmpTimeline( new TimeLine( project.get() ) ); |
| 421 | project->setTimeLine(tmpTimeline); |
| 422 | } |
| 423 | |
| 424 | bool ok = project->loadProject( path, fileUnPathed); |
| 425 | if (!ok) { |
| 426 | project->resetProject(); |
| 427 | } |
| 428 | |
| 429 | //Switch the timeline to this instance's timeline |
| 430 | project->setTimeLine( _publicInterface->getApp()->getTimeLine() ); |
| 431 | |
| 432 | populateWriteNodesChoice(true, setWriteNodeChoice); |
| 433 | |
| 434 | if (ok) { |
| 435 | createReadNode(); |
| 436 | } |
| 437 | refreshOutputNode(); |
| 438 | } |
| 439 | |
| 440 | void |
| 441 | PrecompNodePrivate::populateWriteNodesChoice(bool setPartOfPrecomp, |
no test coverage detected