Sky Texture: change Nishita Altitude to use unit system

Differential Revision: https://developer.blender.org/D9968
This commit is contained in:
Marco 2021-01-27 14:54:51 +01:00 committed by Brecht Van Lommel
parent 9b80291412
commit 0af512abdf
4 changed files with 20 additions and 4 deletions

View File

@ -882,7 +882,7 @@ static ShaderNode *add_node(Scene *scene,
sky->set_sun_intensity(b_sky_node.sun_intensity());
sky->set_sun_elevation(b_sky_node.sun_elevation());
sky->set_sun_rotation(b_sky_node.sun_rotation());
sky->set_altitude(1000.0f * b_sky_node.altitude());
sky->set_altitude(b_sky_node.altitude());
sky->set_air_density(b_sky_node.air_density());
sky->set_dust_density(b_sky_node.dust_density());
sky->set_ozone_density(b_sky_node.ozone_density());

View File

@ -39,7 +39,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 4
#define BLENDER_FILE_SUBVERSION 5
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@ -1645,6 +1645,21 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
FOREACH_NODETREE_END;
}
if (!MAIN_VERSION_ATLEAST(bmain, 293, 5)) {
/* Change Nishita sky model Altitude unit. */
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type == NTREE_SHADER) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->type == SH_NODE_TEX_SKY && node->storage) {
NodeTexSky *tex = (NodeTexSky *)node->storage;
tex->altitude *= 1000.0f;
}
}
}
}
FOREACH_NODETREE_END;
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -4741,9 +4741,10 @@ static void def_sh_tex_sky(StructRNA *srna)
RNA_def_property_float_default(prop, 0.0f);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_NONE);
prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_ui_text(prop, "Altitude", "Height from sea level");
RNA_def_property_range(prop, 0.0f, 60.0f);
RNA_def_property_range(prop, 0.0f, 60000.0f);
RNA_def_property_ui_range(prop, 0.0f, 60000.0f, 1000, 1);
RNA_def_property_float_default(prop, 0.0f);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");