Skip to content

Commit

Permalink
Update storage version after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Oct 26, 2023
1 parent 1724403 commit 2bae7dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/terrain_3d_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void Terrain3DStorage::set_control_maps(const TypedArray<Image> &p_maps) {
LOG(INFO, "Setting control maps: ", p_maps.size());
TypedArray<Image> maps = p_maps;
// DEPRECATED 0.8.4 Remove 0.9
// Convert old RGB8 control format <0.8.4 to bit based format 0.8.41
// Convert old RGB8 control format <0.841 to bit based format 0.8.42
if (_version < CURRENT_VERSION && maps.size() > 0 && (Ref<Image>(maps[0])->get_format() != FORMAT[TYPE_CONTROL])) {
LOG(WARN, "Control maps are being upgraded to int format: ", vformat("%.2f", _version), "->", vformat("%.2f", CURRENT_VERSION));
for (int i = 0; i < maps.size(); i++) {
Expand All @@ -394,6 +394,7 @@ void Terrain3DStorage::set_control_maps(const TypedArray<Image> &p_maps) {
Ref<Image> new_img = Image::create_from_data(_region_size, _region_size, false, Image::FORMAT_RF, pba);
maps[i] = new_img;
}
_version = CURRENT_VERSION; // Prevent running again on focus
}
_control_maps = sanitize_maps(TYPE_CONTROL, maps);
force_update_maps(TYPE_CONTROL);
Expand All @@ -404,7 +405,7 @@ void Terrain3DStorage::set_color_maps(const TypedArray<Image> &p_maps) {

TypedArray<Image> maps = p_maps;
// DEPRECATED 0.8.4 Remove 0.9
// Convert colormap from linear <0.8.4 to srgb 0.8.41
// Convert colormap from linear <0.84 to srgb 0.841
if (_version < CURRENT_VERSION && maps.size() > 0) {
LOG(WARN, "Color maps are being converted from linear to srgb. Upgrading: ", vformat("%.2f", _version), "->", vformat("%.2f", CURRENT_VERSION));
for (int i = 0; i < maps.size(); i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/terrain_3d_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Terrain3DStorage : public Resource {

// Constants & Definitions

static inline const real_t CURRENT_VERSION = 0.841;
static inline const real_t CURRENT_VERSION = 0.842;
static inline const int REGION_MAP_SIZE = 16;
static inline const Vector2i REGION_MAP_VSIZE = Vector2i(REGION_MAP_SIZE, REGION_MAP_SIZE);

Expand Down

0 comments on commit 2bae7dd

Please sign in to comment.