diff options
author | Hans Goudey <h.goudey@me.com> | 2020-07-03 17:28:13 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-07-03 17:28:13 +0300 |
commit | 53d41e1a6fc4c521e412fba57913f93fadeb3735 (patch) | |
tree | fb7f0415ebd64240111637c53484b6325e9600ef /source/blender/blenloader | |
parent | 2a39b34a09702e4e64e27befc97dd6154b75ccc0 (diff) |
UI: Use sliders and [0, 1] ranges in ocean modifier
The ocean modifier has two properties that use a [0, 10] hard min and
hard max. The values act as factors though, so it makes more sense to
use sliders and a 0 to 1 range.
This commit also bumps the file subversion to avoid repeatedly applying
the change to the properties' range.
Differential Revision: https://developer.blender.org/D8186
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 2e93df09e1e..0d16b58d28f 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -257,18 +257,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /** - * Versioning code until next subversion bump goes here. - * - * \note Be sure to check when bumping the version: - * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend - * - "versioning_userdef.c", #do_versions_theme - * - * \note Keep this message at the bottom of the function. - */ - { - /* Keep this block, even when empty. */ - + if (!MAIN_VERSION_ATLEAST(bmain, 290, 6)) { /* Transition to saving expansion for all of a modifier's sub-panels. */ if (!DNA_struct_elem_find(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) { for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) { @@ -338,19 +327,43 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - } - /* Refactor bevel profile type to use an enum. */ - if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "short", "profile_type")) { + /* Refactor bevel profile type to use an enum. */ + if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "short", "profile_type")) { + for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) { + LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { + if (md->type == eModifierType_Bevel) { + BevelModifierData *bmd = (BevelModifierData *)md; + bool use_custom_profile = bmd->flags & MOD_BEVEL_CUSTOM_PROFILE_DEPRECATED; + bmd->profile_type = use_custom_profile ? MOD_BEVEL_PROFILE_CUSTOM : + MOD_BEVEL_PROFILE_SUPERELLIPSE; + } + } + } + } + + /* Change ocean modifier values from [0, 10] to [0, 1] ranges. */ for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) { LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { - if (md->type == eModifierType_Bevel) { - BevelModifierData *bmd = (BevelModifierData *)md; - bool use_custom_profile = bmd->flags & MOD_BEVEL_CUSTOM_PROFILE_DEPRECATED; - bmd->profile_type = use_custom_profile ? MOD_BEVEL_PROFILE_CUSTOM : - MOD_BEVEL_PROFILE_SUPERELLIPSE; + if (md->type == eModifierType_Ocean) { + OceanModifierData *omd = (OceanModifierData *)md; + omd->wave_alignment *= 0.1f; + omd->sharpen_peak_jonswap *= 0.1f; } } } } + + /** + * Versioning code until next subversion bump goes here. + * + * \note Be sure to check when bumping the version: + * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend + * - "versioning_userdef.c", #do_versions_theme + * + * \note Keep this message at the bottom of the function. + */ + { + /* Keep this block, even when empty. */ + } } |