Skip to content

Commit

Permalink
filter-transform: Migration code for earlier stable versions
Browse files Browse the repository at this point in the history
This fixes #116 which was caused by a refactor in commit efb6b0b. This bug was left undiscovered until users started upgrading from the last stable version to the current pre-release.
  • Loading branch information
Xaymar committed Mar 28, 2020
1 parent 4f7c1cb commit 18b3cd3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/filters/filter-transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,23 @@ transform::transform_instance::~transform_instance()

void transform::transform_instance::load(obs_data_t* settings)
{
migrate_settings(settings);
update(settings);
}

inline void migrate_settings(obs_data_t* settings)
{
uint64_t version = static_cast<uint64_t>(obs_data_get_int(settings, S_VERSION));

switch (version & STREAMFX_MASK_COMPAT) {
case 0:
obs_data_set_double(settings, ST_ROTATION_X, -obs_data_get_double(settings, ST_ROTATION_X));
obs_data_set_double(settings, ST_ROTATION_Y, -obs_data_get_double(settings, ST_ROTATION_Y));
}

obs_data_set_int(settings, S_VERSION, STREAMFX_VERSION);
}

void transform::transform_instance::update(obs_data_t* settings)
{
// Camera
Expand Down

0 comments on commit 18b3cd3

Please sign in to comment.