Refactor: combine insert_keyframe() and insert_key_rna() into a single function #122053

Merged
Nathan Vegdahl merged 49 commits from nathanvegdahl/blender:combine_keying_functions into main 2024-06-11 16:43:08 +02:00
Showing only changes of commit 61184ba9b6 - Show all commits

View File

@ -1031,7 +1031,7 @@ CombinedKeyingResult insert_keyframes(Main *bmain,
* we're faithfully reproducing the original behavior.
*/
eInsertKeyFlags insert_key_flags_adjusted = insert_key_flags;
if (force_all && insert_key_flags & (INSERTKEY_REPLACE | INSERTKEY_AVAILABLE)) {
if (force_all && (insert_key_flags & (INSERTKEY_REPLACE | INSERTKEY_AVAILABLE))) {
nathanvegdahl marked this conversation as resolved Outdated

I think parentheses around insert_key_flags & (INSERTKEY_REPLACE | INSERTKEY_AVAILABLE) is still necessary. AFAIK some compilers will complain about ambiguity between & and &&.

I think parentheses around `insert_key_flags & (INSERTKEY_REPLACE | INSERTKEY_AVAILABLE)` is still necessary. AFAIK some compilers will complain about ambiguity between `&` and `&&`.

The operator precedence is unambiguous in C++ at least, but I agree that it would help readability a lot here, regardless.

The [operator precedence is unambiguous in C++](https://en.cppreference.com/w/cpp/language/operator_precedence) at least, but I agree that it would help readability a lot here, regardless.
/* Determine if at least one element would succeed getting keyed. */
bool at_least_one_would_succeed = false;
for (int i = 0; i < rna_values.size(); i++) {