Skip to content

Commit

Permalink
Engine/Project: reset auto save timestamp on knob changes (#679)
Browse files Browse the repository at this point in the history
Reset the auto save timestamp on project knob changes. This marks the project as modified and will prompt users to save when closing the project.
  • Loading branch information
rodlie committed Oct 11, 2021
1 parent ba2e346 commit b68ed08
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Engine/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ Project::onKnobValueChanged(KnobI* knob,
bool /*originatedFromMainThread*/)
{
bool ret = true;
bool shouldAutoSave = false;

if ( knob == _imp->viewsList.get() ) {
/**
Expand All @@ -1592,13 +1593,16 @@ Project::onKnobValueChanged(KnobI* knob,
forceComputeInputDependentDataOnAllTrees();
}
Q_EMIT projectViewsChanged();
shouldAutoSave = true;
} else if ( knob == _imp->defaultLayersList.get() ) {
if (reason == eValueChangedReasonUserEdited) {
///default layers change, notify all nodes so they rebuild their layers menus
forceComputeInputDependentDataOnAllTrees();
}
shouldAutoSave = true;
} else if ( knob == _imp->setupForStereoButton.get() ) {
setupProjectForStereo();
shouldAutoSave = true;
} else if ( knob == _imp->formatKnob.get() ) {
int index = _imp->formatKnob->getValue();
Format frmt;
Expand All @@ -1623,24 +1627,49 @@ Project::onKnobValueChanged(KnobI* knob,
///Format change, hence probably the PAR so run getClipPreferences again
forceComputeInputDependentDataOnAllTrees();
Q_EMIT formatChanged(frmt);
shouldAutoSave = true;
}
} else if ( knob == _imp->addFormatKnob.get() ) {
Q_EMIT mustCreateFormat();
} else if ( knob == _imp->previewMode.get() ) {
Q_EMIT autoPreviewChanged( _imp->previewMode->getValue() );
shouldAutoSave = true;
} else if ( knob == _imp->frameRate.get() ) {
forceComputeInputDependentDataOnAllTrees();
shouldAutoSave = true;
} else if ( knob == _imp->frameRange.get() ) {
int first = _imp->frameRange->getValue(0);
int last = _imp->frameRange->getValue(1);
Q_EMIT frameRangeChanged(first, last);
shouldAutoSave = true;
} else if ( knob == _imp->gpuSupport.get() ) {

refreshOpenGLRenderingFlagOnNodes();
shouldAutoSave = true;
} else {
ret = false;
}

// others knobs that should trigger auto save
if ( knob == _imp->colorSpace8u.get() ||
knob == _imp->colorSpace16u.get() ||
knob == _imp->colorSpace32f.get() ||
knob == _imp->lockFrameRange.get() ||
knob == _imp->onProjectLoadCB.get() ||
knob == _imp->onProjectSaveCB.get() ||
knob == _imp->onProjectCloseCB.get() ||
knob == _imp->onNodeCreated.get() ||
knob == _imp->onNodeDeleted.get() ||
knob == _imp->envVars.get() )
{
shouldAutoSave = true;
}

// auto save on project knobs change
if (shouldAutoSave) {
_imp->lastAutoSave = QDateTime();
}

return ret;
} // Project::onKnobValueChanged

Expand Down

0 comments on commit b68ed08

Please sign in to comment.