Animation: Set hardmin/max for frame start and end of action

Currently start and end property of action don't have hardmin/hardmax. This results in an
error when exporting action having extreme range values in FBX and gltf formats (#107965).

Pull Request: https://projects.blender.org/blender/blender/pulls/107985
This commit is contained in:
Pratik Borhade
2023-07-06 10:55:33 +02:00
committed by Pratik Borhade
parent bbb18137ff
commit e73273e24b
4 changed files with 11 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 7
#define BLENDER_FILE_SUBVERSION 8
/* 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

@@ -1470,8 +1470,8 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
max += 1.0f;
}
*start = min;
*end = max;
*start = max_ff(min, MINAFRAMEF);
*end = min_ff(max, MAXFRAMEF);
}
else {
*start = 0.0f;

View File

@@ -258,6 +258,12 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 400, 8)) {
LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
act->frame_start = max_ff(act->frame_start, MINAFRAMEF);
act->frame_end = min_ff(act->frame_end, MAXFRAMEF);
}
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@@ -921,7 +921,7 @@ static void rna_def_action(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_float_sdna(prop, nullptr, "frame_start");
RNA_def_property_float_funcs(prop, nullptr, "rna_Action_start_frame_set", nullptr);
RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 2);
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
RNA_def_property_ui_text(
prop, "Start Frame", "The start frame of the manually set intended playback range");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, nullptr);
@@ -930,7 +930,7 @@ static void rna_def_action(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_float_sdna(prop, nullptr, "frame_end");
RNA_def_property_float_funcs(prop, nullptr, "rna_Action_end_frame_set", nullptr);
RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 2);
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
RNA_def_property_ui_text(
prop, "End Frame", "The end frame of the manually set intended playback range");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, nullptr);