Cleanup: Editors/Animation, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/editors/animation` module. No functional changes.
This commit is contained in:
@@ -322,9 +322,7 @@ static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
|
||||
if (acf && acf->get_indent_level) {
|
||||
return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* offset based on nodetree type */
|
||||
@@ -514,11 +512,10 @@ static int acf_summary_setting_flag(bAnimContext *UNUSED(ac),
|
||||
*neg = true;
|
||||
return ADS_FLAG_SUMMARY_COLLAPSED;
|
||||
}
|
||||
else {
|
||||
/* unsupported */
|
||||
*neg = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* unsupported */
|
||||
*neg = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get pointer to the setting */
|
||||
@@ -538,11 +535,10 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale,
|
||||
/* return pointer to DopeSheet's flag */
|
||||
return GET_ACF_FLAG_PTR(ads->flag, type);
|
||||
}
|
||||
else {
|
||||
/* can't return anything useful - unsupported */
|
||||
*type = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* can't return anything useful - unsupported */
|
||||
*type = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* all animation summary (DopeSheet only) type define */
|
||||
@@ -3815,19 +3811,15 @@ static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac),
|
||||
/* ok - we've got a solo track, and this is it */
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
/* not ok - we've got a solo track, but this isn't it, so make it more obvious */
|
||||
return false;
|
||||
}
|
||||
/* not ok - we've got a solo track, but this isn't it, so make it more obvious */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ok - no tracks are solo'd, and this isn't being tweaked */
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
/* unsupported - this track is being tweaked */
|
||||
return false;
|
||||
}
|
||||
/* unsupported - this track is being tweaked */
|
||||
return false;
|
||||
|
||||
/* unsupported */
|
||||
default:
|
||||
@@ -3901,9 +3893,8 @@ static int acf_nlaaction_icon(bAnimListElem *ale)
|
||||
if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
|
||||
return ICON_ACTION_TWEAK;
|
||||
}
|
||||
else {
|
||||
return ICON_ACTION;
|
||||
}
|
||||
|
||||
return ICON_ACTION;
|
||||
}
|
||||
|
||||
/* Backdrop color for nla action channel
|
||||
@@ -4157,9 +4148,8 @@ const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale)
|
||||
if ((ale->type >= 0) && (ale->type < ANIMTYPE_NUM_TYPES)) {
|
||||
return animchannelTypeInfo[ale->type];
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* --------------------------- */
|
||||
@@ -4227,9 +4217,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
|
||||
if (negflag) {
|
||||
return ((*val) & flag) == 0;
|
||||
}
|
||||
else {
|
||||
return ((*val) & flag) != 0;
|
||||
}
|
||||
return ((*val) & flag) != 0;
|
||||
}
|
||||
case sizeof(short): /* short pointer for setting */
|
||||
{
|
||||
@@ -4238,9 +4226,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
|
||||
if (negflag) {
|
||||
return ((*val) & flag) == 0;
|
||||
}
|
||||
else {
|
||||
return ((*val) & flag) != 0;
|
||||
}
|
||||
return ((*val) & flag) != 0;
|
||||
}
|
||||
case sizeof(char): /* char pointer for setting */
|
||||
{
|
||||
@@ -4249,9 +4235,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
|
||||
if (negflag) {
|
||||
return ((*val) & flag) == 0;
|
||||
}
|
||||
else {
|
||||
return ((*val) & flag) != 0;
|
||||
}
|
||||
return ((*val) & flag) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,9 +505,9 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac,
|
||||
printf("ERROR: no channel matching the one changed was found\n");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale_setting);
|
||||
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale_setting);
|
||||
if (acf == NULL) {
|
||||
printf("ERROR: no channel info for the changed channel\n");
|
||||
return;
|
||||
@@ -571,9 +571,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac,
|
||||
* finished, so skip until we get to the parent of this level
|
||||
*/
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2314,7 +2312,7 @@ static int animchannels_clean_empty_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
nla_empty = false;
|
||||
break;
|
||||
}
|
||||
else if (nlt->strips.first == NULL) {
|
||||
if (nlt->strips.first == NULL) {
|
||||
/* this track is empty, but another one may still have stuff in it, so can't break yet */
|
||||
nla_empty = true;
|
||||
}
|
||||
@@ -2812,10 +2810,9 @@ static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), const
|
||||
if (rename_anim_channels(&ac, channel_index)) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
/* allow event to be handled by selectall operator */
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
/* allow event to be handled by selectall operator */
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_rename(wmOperatorType *ot)
|
||||
@@ -3372,10 +3369,9 @@ static int animchannels_channel_select_keys_invoke(bContext *C,
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
/* allow event to be handled by selectall operator */
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
/* allow event to be handled by selectall operator */
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channel_select_keys(wmOperatorType *ot)
|
||||
|
||||
@@ -473,9 +473,7 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag
|
||||
if (flag & ANIM_UNITCONV_RESTORE) {
|
||||
return DEG2RADF(1.0f); /* degrees to radians */
|
||||
}
|
||||
else {
|
||||
return RAD2DEGF(1.0f); /* radians to degrees */
|
||||
}
|
||||
return RAD2DEGF(1.0f); /* radians to degrees */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
channel_data, channel_type, owner_id, fcurve_owner_id, ale_statement) \
|
||||
if (filter_mode & ANIMFILTER_TMP_PEEK) \
|
||||
return 1; \
|
||||
else { \
|
||||
{ \
|
||||
bAnimListElem *ale = make_new_animlistelem( \
|
||||
channel_data, channel_type, (ID *)owner_id, fcurve_owner_id); \
|
||||
if (ale) { \
|
||||
@@ -1169,10 +1169,8 @@ static bool name_matches_dopesheet_filter(bDopeSheet *ads, char *name)
|
||||
/* if we have a match somewhere, this returns true */
|
||||
return found;
|
||||
}
|
||||
else {
|
||||
/* fallback/default - just case insensitive, but starts from start of word */
|
||||
return BLI_strcasestr(name, ads->searchstr) != NULL;
|
||||
}
|
||||
/* fallback/default - just case insensitive, but starts from start of word */
|
||||
return BLI_strcasestr(name, ads->searchstr) != NULL;
|
||||
}
|
||||
|
||||
/* (Display-)Name-based F-Curve filtering
|
||||
|
||||
@@ -59,7 +59,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
||||
if (name == NULL) {
|
||||
return icon;
|
||||
}
|
||||
else if (ELEM(NULL, id, fcu, fcu->rna_path)) {
|
||||
|
||||
if (ELEM(NULL, id, fcu, fcu->rna_path)) {
|
||||
if (fcu == NULL) {
|
||||
strcpy(name, TIP_("<invalid>"));
|
||||
}
|
||||
|
||||
@@ -110,9 +110,7 @@ ListBase *ED_animcontext_get_markers(const bAnimContext *ac)
|
||||
if (ac) {
|
||||
return context_get_markers(ac->scene, ac->area);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* --------------------------------- */
|
||||
@@ -307,7 +305,7 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (ce->cfra > marker->frame) {
|
||||
if (ce->cfra > marker->frame) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -487,13 +485,11 @@ static int marker_get_icon_id(TimeMarker *marker, int flag)
|
||||
(marker->flag & SELECT) ? ICON_PMARKER_SEL : ICON_PMARKER;
|
||||
}
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
else if (marker->camera) {
|
||||
if (marker->camera) {
|
||||
return (marker->flag & SELECT) ? ICON_OUTLINER_OB_CAMERA : ICON_CAMERA_DATA;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
return (marker->flag & SELECT) ? ICON_MARKER_HLT : ICON_MARKER;
|
||||
}
|
||||
return (marker->flag & SELECT) ? ICON_MARKER_HLT : ICON_MARKER;
|
||||
}
|
||||
|
||||
static void draw_marker(
|
||||
@@ -1508,9 +1504,8 @@ static int ed_marker_rename_exec(bContext *C, wmOperator *op)
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int ed_marker_rename_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
@@ -1020,9 +1020,7 @@ static int add_driver_button_none(bContext *C, wmOperator *op, short mapping_typ
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int add_driver_button_menu_exec(bContext *C, wmOperator *op)
|
||||
@@ -1032,16 +1030,15 @@ static int add_driver_button_menu_exec(bContext *C, wmOperator *op)
|
||||
/* Just create driver with no targets */
|
||||
return add_driver_button_none(C, op, mapping_type);
|
||||
}
|
||||
else {
|
||||
/* Create Driver using Eyedropper */
|
||||
wmOperatorType *ot = WM_operatortype_find("UI_OT_eyedropper_driver", true);
|
||||
|
||||
/* XXX: We assume that it's fine to use the same set of properties,
|
||||
* since they're actually the same. */
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, op->ptr);
|
||||
/* Create Driver using Eyedropper */
|
||||
wmOperatorType *ot = WM_operatortype_find("UI_OT_eyedropper_driver", true);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
/* XXX: We assume that it's fine to use the same set of properties,
|
||||
* since they're actually the same. */
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, op->ptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* Show menu or create drivers */
|
||||
@@ -1054,12 +1051,11 @@ static int add_driver_button_menu_invoke(bContext *C, wmOperator *op, const wmEv
|
||||
/* Mapping Type is Set - Directly go into creating drivers */
|
||||
return add_driver_button_menu_exec(C, op);
|
||||
}
|
||||
else {
|
||||
/* Show menu */
|
||||
// TODO: This should get filtered by the enum filter
|
||||
/* important to execute in the region we're currently in */
|
||||
return WM_menu_invoke_ex(C, op, WM_OP_INVOKE_DEFAULT);
|
||||
}
|
||||
|
||||
/* Show menu */
|
||||
// TODO: This should get filtered by the enum filter
|
||||
/* important to execute in the region we're currently in */
|
||||
return WM_menu_invoke_ex(C, op, WM_OP_INVOKE_DEFAULT);
|
||||
}
|
||||
|
||||
static void UNUSED_FUNCTION(ANIM_OT_driver_button_add_menu)(wmOperatorType *ot)
|
||||
|
||||
@@ -84,9 +84,7 @@ short compare_ak_cfraPtr(void *node, void *data)
|
||||
if (val < ak->cfra) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* --------------- */
|
||||
@@ -106,18 +104,16 @@ static eKeyframeHandleDrawOpts bezt_handle_type(BezTriple *bezt)
|
||||
if (bezt->h1 == HD_AUTO_ANIM && bezt->h2 == HD_AUTO_ANIM) {
|
||||
return KEYFRAME_HANDLE_AUTO_CLAMP;
|
||||
}
|
||||
else if (ELEM(bezt->h1, HD_AUTO_ANIM, HD_AUTO) && ELEM(bezt->h2, HD_AUTO_ANIM, HD_AUTO)) {
|
||||
if (ELEM(bezt->h1, HD_AUTO_ANIM, HD_AUTO) && ELEM(bezt->h2, HD_AUTO_ANIM, HD_AUTO)) {
|
||||
return KEYFRAME_HANDLE_AUTO;
|
||||
}
|
||||
else if (bezt->h1 == HD_VECT && bezt->h2 == HD_VECT) {
|
||||
if (bezt->h1 == HD_VECT && bezt->h2 == HD_VECT) {
|
||||
return KEYFRAME_HANDLE_VECTOR;
|
||||
}
|
||||
else if (ELEM(HD_FREE, bezt->h1, bezt->h2)) {
|
||||
if (ELEM(HD_FREE, bezt->h1, bezt->h2)) {
|
||||
return KEYFRAME_HANDLE_FREE;
|
||||
}
|
||||
else {
|
||||
return KEYFRAME_HANDLE_ALIGNED;
|
||||
}
|
||||
return KEYFRAME_HANDLE_ALIGNED;
|
||||
}
|
||||
|
||||
/* Determine if the keyframe is an extreme by comparing with neighbors.
|
||||
@@ -337,9 +333,8 @@ static void add_bezt_to_keycolumns_list(DLRBT_Tree *keys, BezTripleChain *bezt)
|
||||
if (ELEM(NULL, keys, bezt)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
BLI_dlrbTree_add(keys, compare_ak_bezt, nalloc_ak_bezt, nupdate_ak_bezt, bezt);
|
||||
}
|
||||
|
||||
BLI_dlrbTree_add(keys, compare_ak_bezt, nalloc_ak_bezt, nupdate_ak_bezt, bezt);
|
||||
}
|
||||
|
||||
/* Add the given GPencil Frame to the given 'list' of Keyframes */
|
||||
@@ -348,9 +343,8 @@ static void add_gpframe_to_keycolumns_list(DLRBT_Tree *keys, bGPDframe *gpf)
|
||||
if (ELEM(NULL, keys, gpf)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
|
||||
}
|
||||
|
||||
BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
|
||||
}
|
||||
|
||||
/* Add the given MaskLayerShape Frame to the given 'list' of Keyframes */
|
||||
@@ -359,13 +353,12 @@ static void add_masklay_to_keycolumns_list(DLRBT_Tree *keys, MaskLayerShape *mas
|
||||
if (ELEM(NULL, keys, masklay_shape)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
BLI_dlrbTree_add(keys,
|
||||
compare_ak_masklayshape,
|
||||
nalloc_ak_masklayshape,
|
||||
nupdate_ak_masklayshape,
|
||||
masklay_shape);
|
||||
}
|
||||
|
||||
BLI_dlrbTree_add(keys,
|
||||
compare_ak_masklayshape,
|
||||
nalloc_ak_masklayshape,
|
||||
nupdate_ak_masklayshape,
|
||||
masklay_shape);
|
||||
}
|
||||
|
||||
/* ActKeyBlocks (Long Keyframes) ------------------------------------------ */
|
||||
|
||||
@@ -569,9 +569,7 @@ static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
if (BEZT_ISSEL_ANY(bezt)) {
|
||||
return KEYFRAME_OK_ALL;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short ok_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
|
||||
@@ -617,9 +615,7 @@ static short ok_bezier_region(KeyframeEditData *ked, BezTriple *bezt)
|
||||
/* return ok flags */
|
||||
return ok;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -654,9 +650,7 @@ static short ok_bezier_region_lasso(KeyframeEditData *ked, BezTriple *bezt)
|
||||
/* return ok flags */
|
||||
return ok;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short ok_bezier_channel_lasso(KeyframeEditData *ked, BezTriple *bezt)
|
||||
@@ -718,9 +712,7 @@ static short ok_bezier_region_circle(KeyframeEditData *ked, BezTriple *bezt)
|
||||
/* return ok flags */
|
||||
return ok;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short ok_bezier_channel_circle(KeyframeEditData *ked, BezTriple *bezt)
|
||||
|
||||
@@ -83,7 +83,7 @@ void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc)
|
||||
if (abs(index) >= fcu->totvert) {
|
||||
return;
|
||||
}
|
||||
else if (index < 0) {
|
||||
if (index < 0) {
|
||||
index += fcu->totvert;
|
||||
}
|
||||
|
||||
|
||||
@@ -659,20 +659,17 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
|
||||
if (IS_EQF(prevVal, nValue) && IS_EQF(beztVal, nValue) && IS_EQF(prevVal, beztVal)) {
|
||||
return KEYNEEDED_DONTADD;
|
||||
}
|
||||
else {
|
||||
float realVal;
|
||||
|
||||
/* get real value of curve at that point */
|
||||
realVal = evaluate_fcurve(fcu, cFrame);
|
||||
float realVal;
|
||||
|
||||
/* compare whether it's the same as proposed */
|
||||
if (IS_EQF(realVal, nValue)) {
|
||||
return KEYNEEDED_DONTADD;
|
||||
}
|
||||
else {
|
||||
return KEYNEEDED_JUSTADD;
|
||||
}
|
||||
/* get real value of curve at that point */
|
||||
realVal = evaluate_fcurve(fcu, cFrame);
|
||||
|
||||
/* compare whether it's the same as proposed */
|
||||
if (IS_EQF(realVal, nValue)) {
|
||||
return KEYNEEDED_DONTADD;
|
||||
}
|
||||
return KEYNEEDED_JUSTADD;
|
||||
}
|
||||
|
||||
/* new keyframe before prev beztriple? */
|
||||
@@ -684,9 +681,8 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
|
||||
if (IS_EQF(prevVal, nValue) && IS_EQF(beztVal, nValue) && IS_EQF(prevVal, beztVal)) {
|
||||
return KEYNEEDED_DELNEXT;
|
||||
}
|
||||
else {
|
||||
return KEYNEEDED_JUSTADD;
|
||||
}
|
||||
|
||||
return KEYNEEDED_JUSTADD;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -728,9 +724,8 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
|
||||
if (IS_EQF(valA, nValue) && IS_EQF(valA, valB)) {
|
||||
return KEYNEEDED_DELPREV;
|
||||
}
|
||||
else {
|
||||
return KEYNEEDED_JUSTADD;
|
||||
}
|
||||
|
||||
return KEYNEEDED_JUSTADD;
|
||||
}
|
||||
|
||||
/* ------------------ RNA Data-Access Functions ------------------ */
|
||||
@@ -865,7 +860,8 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
|
||||
printf("%s failed: NULL identifier\n", __func__);
|
||||
return false;
|
||||
}
|
||||
else if (strstr(identifier, "location")) {
|
||||
|
||||
if (strstr(identifier, "location")) {
|
||||
searchtype = VISUALKEY_LOC;
|
||||
}
|
||||
else if (strstr(identifier, "rotation")) {
|
||||
@@ -1036,7 +1032,8 @@ static float *visualkey_get_values(
|
||||
*r_count = 3;
|
||||
return buffer;
|
||||
}
|
||||
else if (strstr(identifier, "rotation_quaternion")) {
|
||||
|
||||
if (strstr(identifier, "rotation_quaternion")) {
|
||||
float mat3[3][3];
|
||||
|
||||
copy_m3_m4(mat3, tmat);
|
||||
@@ -1045,14 +1042,16 @@ static float *visualkey_get_values(
|
||||
*r_count = 4;
|
||||
return buffer;
|
||||
}
|
||||
else if (strstr(identifier, "rotation_axis_angle")) {
|
||||
|
||||
if (strstr(identifier, "rotation_axis_angle")) {
|
||||
/* w = 0, x,y,z = 1,2,3 */
|
||||
mat4_to_axis_angle(buffer + 1, buffer, tmat);
|
||||
|
||||
*r_count = 4;
|
||||
return buffer;
|
||||
}
|
||||
else if (strstr(identifier, "scale")) {
|
||||
|
||||
if (strstr(identifier, "scale")) {
|
||||
mat4_to_size(buffer, tmat);
|
||||
|
||||
*r_count = 3;
|
||||
@@ -1181,10 +1180,9 @@ static bool insert_keyframe_value(ReportList *reports,
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
/* just insert keyframe */
|
||||
return insert_vert_fcurve(fcu, cfra, curval, keytype, flag) >= 0;
|
||||
}
|
||||
|
||||
/* just insert keyframe */
|
||||
return insert_vert_fcurve(fcu, cfra, curval, keytype, flag) >= 0;
|
||||
}
|
||||
|
||||
/* Secondary Keyframing API call:
|
||||
@@ -1239,10 +1237,9 @@ bool insert_keyframe_direct(ReportList *reports,
|
||||
fcu->rna_path);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
/* property found, so overwrite 'ptr' to make later code easier */
|
||||
ptr = tmp_ptr;
|
||||
}
|
||||
|
||||
/* property found, so overwrite 'ptr' to make later code easier */
|
||||
ptr = tmp_ptr;
|
||||
}
|
||||
|
||||
/* update F-Curve flags to ensure proper behavior for property type */
|
||||
@@ -1325,9 +1322,8 @@ static bool insert_keyframe_fcurve_value(Main *bmain,
|
||||
/* insert keyframe */
|
||||
return insert_keyframe_value(reports, ptr, prop, fcu, cfra, curval, keytype, flag);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1851,7 +1847,8 @@ static int insert_key_exec(bContext *C, wmOperator *op)
|
||||
BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else if (num_channels > 0) {
|
||||
|
||||
if (num_channels > 0) {
|
||||
/* if the appropriate properties have been set, make a note that we've inserted something */
|
||||
if (RNA_boolean_get(op->ptr, "confirm_success")) {
|
||||
BKE_reportf(op->reports,
|
||||
@@ -1961,13 +1958,12 @@ static int insert_key_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UN
|
||||
|
||||
return OPERATOR_INTERFACE;
|
||||
}
|
||||
else {
|
||||
/* just call the exec() on the active keyingset */
|
||||
RNA_enum_set(op->ptr, "type", 0);
|
||||
RNA_boolean_set(op->ptr, "confirm_success", true);
|
||||
|
||||
return op->type->exec(C, op);
|
||||
}
|
||||
/* just call the exec() on the active keyingset */
|
||||
RNA_enum_set(op->ptr, "type", 0);
|
||||
RNA_boolean_set(op->ptr, "confirm_success", true);
|
||||
|
||||
return op->type->exec(C, op);
|
||||
}
|
||||
|
||||
void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
|
||||
@@ -2067,7 +2063,8 @@ static int delete_key_exec(bContext *C, wmOperator *op)
|
||||
BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else if (num_channels > 0) {
|
||||
|
||||
if (num_channels > 0) {
|
||||
/* if the appropriate properties have been set, make a note that we've inserted something */
|
||||
if (RNA_boolean_get(op->ptr, "confirm_success")) {
|
||||
BKE_reportf(op->reports,
|
||||
@@ -2727,17 +2724,16 @@ bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
|
||||
*/
|
||||
return id_frame_has_keyframe(id, cfra, ANIMFILTER_KEYS_LOCAL);
|
||||
}
|
||||
else {
|
||||
/* Normal Mode (or treat as being normal mode):
|
||||
*
|
||||
* Just in case the flags aren't set properly (i.e. only on/off is set, without a mode)
|
||||
* let's set the "normal" flag too, so that it will all be sane everywhere...
|
||||
*/
|
||||
scene->toolsettings->autokey_mode = AUTOKEY_MODE_NORMAL;
|
||||
|
||||
/* Can insert anytime we like... */
|
||||
return true;
|
||||
}
|
||||
/* Normal Mode (or treat as being normal mode):
|
||||
*
|
||||
* Just in case the flags aren't set properly (i.e. only on/off is set, without a mode)
|
||||
* let's set the "normal" flag too, so that it will all be sane everywhere...
|
||||
*/
|
||||
scene->toolsettings->autokey_mode = AUTOKEY_MODE_NORMAL;
|
||||
|
||||
/* Can insert anytime we like... */
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ******************************************* */
|
||||
@@ -2950,9 +2946,7 @@ bool ED_autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ED_autokeyframe_pchan(
|
||||
@@ -2977,14 +2971,13 @@ bool ED_autokeyframe_pchan(
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
/* add unkeyed tags */
|
||||
if (pchan->bone) {
|
||||
pchan->bone->flag |= BONE_UNKEYED;
|
||||
}
|
||||
|
||||
return false;
|
||||
/* add unkeyed tags */
|
||||
if (pchan->bone) {
|
||||
pchan->bone->flag |= BONE_UNKEYED;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,9 +96,8 @@ static bool keyingset_poll_activePath_edit(bContext *C)
|
||||
if (scene->active_keyingset <= 0) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
}
|
||||
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* there must be an active KeyingSet and an active path */
|
||||
return ((ks) && (ks->paths.first) && (ks->active_path > 0));
|
||||
@@ -158,13 +157,13 @@ static int remove_active_keyingset_exec(bContext *C, wmOperator *op)
|
||||
BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else if (scene->active_keyingset < 0) {
|
||||
|
||||
if (scene->active_keyingset < 0) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Cannot remove built in keying set");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else {
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
}
|
||||
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* free KeyingSet's data, then remove it from the scene */
|
||||
BKE_keyingset_free(ks);
|
||||
@@ -207,9 +206,8 @@ static int add_empty_ks_path_exec(bContext *C, wmOperator *op)
|
||||
BKE_report(op->reports, RPT_ERROR, "No active Keying Set to add empty path to");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else {
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
}
|
||||
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* don't use the API method for this, since that checks on values... */
|
||||
ksp = MEM_callocN(sizeof(KS_Path), "KeyingSetPath Empty");
|
||||
@@ -414,13 +412,13 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
|
||||
BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove property from");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else if (scene->active_keyingset < 0) {
|
||||
|
||||
if (scene->active_keyingset < 0) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Cannot remove property from built in keying set");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else {
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
}
|
||||
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
if (ptr.owner_id && ptr.data && prop) {
|
||||
path = RNA_path_from_ID_to_property(&ptr, prop);
|
||||
@@ -688,9 +686,7 @@ KeyingSet *ANIM_scene_get_active_keyingset(const Scene *scene)
|
||||
if (scene->active_keyingset > 0) {
|
||||
return BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
}
|
||||
else {
|
||||
return BLI_findlink(&builtin_keyingsets, (-scene->active_keyingset) - 1);
|
||||
}
|
||||
return BLI_findlink(&builtin_keyingsets, (-scene->active_keyingset) - 1);
|
||||
}
|
||||
|
||||
/* Get the index of the Keying Set provided, for the given Scene */
|
||||
@@ -722,9 +718,7 @@ int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *ks)
|
||||
if (index != -1) {
|
||||
return -(index + 1);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get Keying Set to use for Auto-Keyframing some transforms */
|
||||
@@ -737,12 +731,10 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(const Scene *scene, const char *tra
|
||||
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (scene->active_keyingset)) {
|
||||
return ANIM_scene_get_active_keyingset(scene);
|
||||
}
|
||||
else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) {
|
||||
if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) {
|
||||
return ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_AVAILABLE_ID);
|
||||
}
|
||||
else {
|
||||
return ANIM_builtin_keyingset_get_named(NULL, transformKSName);
|
||||
}
|
||||
return ANIM_builtin_keyingset_get_named(NULL, transformKSName);
|
||||
}
|
||||
|
||||
/* Menu of All Keying Sets ----------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user