Skip to content

Commit

Permalink
UPBGE: Fix color space for world texture.
Browse files Browse the repository at this point in the history
Color space wasn't exposed for world texture slot, now they are
the same than material texture slot.
  • Loading branch information
panzergame committed Oct 21, 2018
1 parent 0d30856 commit 5ac1856
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/blender/blenloader/intern/versioning_upbge.c
Expand Up @@ -324,6 +324,14 @@ void blo_do_versions_upbge(FileData *fd, Library *lib, Main *main)
}
}
}

for (World *wo = main->world.first; wo; wo = wo->id.next) {
for (unsigned short a = 0; a < MAX_MTEX; ++a) {
if (wo->mtex[a]) {
wo->mtex[a]->colorManagement = GAME_COLOR_MANAGEMENT_SRGB;
}
}
}
}
}
}
13 changes: 13 additions & 0 deletions source/blender/makesrna/intern/rna_world.c
Expand Up @@ -35,6 +35,7 @@
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "DNA_scene_types.h"

#include "WM_types.h"

Expand Down Expand Up @@ -139,6 +140,12 @@ static void rna_def_world_mtex(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};

static EnumPropertyItem color_management_items[] = {
{GAME_COLOR_MANAGEMENT_LINEAR, "COLOR_MANAGEMENT_LINEAR", 0, "Linear", "Linear color space"},
{GAME_COLOR_MANAGEMENT_SRGB, "COLOR_MANAGEMENT_SRGB", 0, "sRGB", "sRGB color space"},
{0, NULL, 0, NULL, NULL}
};

srna = RNA_def_struct(brna, "WorldTextureSlot", "TextureSlot");
RNA_def_struct_sdna(srna, "MTex");
RNA_def_struct_ui_text(srna, "World Texture Slot", "Texture slot for textures in a World data-block");
Expand All @@ -164,6 +171,12 @@ static void rna_def_world_mtex(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below");
RNA_def_property_update(prop, 0, "rna_World_update");

prop = RNA_def_property(srna, "color_management", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "colorManagement");
RNA_def_property_enum_items(prop, color_management_items);
RNA_def_property_ui_text(prop, "Color Space", "The color space of the image");
RNA_def_property_update(prop, 0, "rna_World_update");

prop = RNA_def_property(srna, "lod_bias", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "lodbias");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 10, 3);
Expand Down

0 comments on commit 5ac1856

Please sign in to comment.