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

Merged
Pratik Borhade merged 8 commits from PratikPB2123/blender:107965-action-frame-range into main 2023-07-06 10:55:39 +02:00
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)
}
}

For future PRs, keep the versioning code in the "Versioning code until next subversion bump goes here" section, and only do the subversion bump when landing. Otherwise it's too likely to create conflicts.

For future PRs, keep the versioning code in the "Versioning code until next subversion bump goes here" section, and only do the subversion bump when landing. Otherwise it's too likely to create conflicts.
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);