Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Store settings by OpenPype version #2570

Merged
merged 17 commits into from
Feb 10, 2022

Conversation

iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Jan 20, 2022

Brief Description

Settings are stored by OpenPype version.

Description

This PR changes how settings are stored and loaded. All settings documents have one additional key "version". If settings for current OpenPype version are not available then it looks for latest available version from the other available settings versions but never higher. Since new key was added and backwards compatibility must be kept the settings type was changed to <previous type>_versioned (e.g. system_settings_versioned). If there are not OpenPype settings with any version document with legacy key is used. The versioned settings documents are created at the moment of saving in settings UI or headless saving with SystemSettingsEntity or ProjectSettingsEntity. When they are created they will be used for the version so any changes from previous version settings won't be propagated anymore.

How the settings lookup works

Simple example

Version numbers here are just samples!
Imagine this feature is available since 1.0.1 and there are 3 versions of system settings in database.

  • legacy settings
  • for version 1.0.1
  • for version 1.0.3

What will be loaded

  • When OpenPype 1.0.0 is opened it will load legacy settings
  • When OpenPype 1.0.1 is opened it will load settings for 1.0.1
  • When OpenPype 1.0.3 is opened it will load settings for 1.0.3
  • When 1.0.2 is opened it will load settings for version 1.0.1 because is the closest lower version available
  • When any version higher than 1.0.3 is opened it will load settings for 1.0.3

What will be saved

  • No matter what version of settings was loaded the saved settings are saved under the version of current OpenPype

Which version is lower/higher?

Version order is defined by OpenPypeVersion class in igniter which follows semantic versioning. No matter if is staging or production.

How does it work in hosts where OpenPypeVersion is not available

OpenPype process store ordered versions into mongo so it is possible to sort available versions by them.

Changes

  • Settings handler can handle storing settings data by OpenPype version and loading if settings for current version are not available
  • Settings UI changes
    • refresh button moved next to path widget
    • shows which settings version is currently loaded (not current version has yellow color)
    • it is possible to change source version with right clicking on settings tab
    • project view has also ability to change source version per project with right click on project
    • project view shows used versions per project if are different then current project

Note

This PR requires to have newer OpenPype build otherwise can't compare versions.

Screenshots

Settings UI

image
image
image

Require new build dialog

So when build does not support OpenPypeVersion class dialog telling user to update installation is shown.
image

@mkolar
Copy link
Member

mkolar commented Jan 20, 2022

Task linked: OP-2361 Store settings by OpenPype version

@iLLiCiTiT iLLiCiTiT self-assigned this Jan 20, 2022
@iLLiCiTiT iLLiCiTiT marked this pull request as ready for review January 26, 2022 13:07
Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am missing info about currently used settings version. In most cases it will match version of OpenPype , but for those few when it is not so, or you need to test something, it would be helpful to be able to select version.

Also we need to handle production and staging versions.

@mkolar mkolar added the type: feature Larger, user affecting changes and completely new things label Feb 7, 2022
Copy link
Member

@mkolar mkolar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once users click on any project in the settings, it is not possible to go back to default project settings The UI is not reacting, however, it is possible to switch to another project

Copy link
Member

@mkolar mkolar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notification about obsolete version should be more explicit for the user.

In this case I'm running 3.8.2 with old settings, but the only indication of that fact is the orange colour. We should be explicit like
Your settings are loaded from an older version: 3.8.1-nightly.2
Tooltip should then describe what to do.
Please check that all settings are still correct (blue colour indicates potential changes in the new version) and save your settings to update them to you current running OpenPype version.
image

@mkolar
Copy link
Member

mkolar commented Feb 7, 2022

We should also probably write the current OpenPype version somewhere obvious. Writing it permanently in the bottom panel is confusing, because that should only be used for user messages. This feels like I should be doing something about it.
image

How about we add the current OP running version into the title of the window? Then if the settings match, we show them clean, and only if there is mismatch we display the message and version next to the project or defaults.

@iLLiCiTiT
Copy link
Member Author

Once users click on any project in the settings, it is not possible to go back to default project settings The UI is not reacting, however, it is possible to switch to another project

Fixed

We should also probably write the current OpenPype version somewhere obvious. Writing it permanently in the bottom panel is confusing, because that should only be used for user messages

Removed border around version and move it next to Save button. Current state:

image

image

@mkolar mkolar self-requested a review February 10, 2022 09:50
@iLLiCiTiT iLLiCiTiT merged commit f1c2acd into develop Feb 10, 2022
@iLLiCiTiT iLLiCiTiT mentioned this pull request Feb 10, 2022
@iLLiCiTiT iLLiCiTiT deleted the feature/OP-2361_Store-settings-by-OpenPype-version branch February 11, 2022 09:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Larger, user affecting changes and completely new things
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants