diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 74 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access_compare_override.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 23 | ||||
-rw-r--r-- | source/creator/creator.c | 2 | ||||
-rw-r--r-- | source/creator/creator_args.c | 149 |
6 files changed, 95 insertions, 159 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 5aa684539af..8b861d20e4e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -256,10 +256,10 @@ static const char *rna_safe_id(const char *id) if (STREQ(id, "operator")) { return "operator_value"; } - else if (STREQ(id, "new")) { + if (STREQ(id, "new")) { return "create"; } - else if (STREQ(id, "co_return")) { + if (STREQ(id, "co_return")) { /* MSVC2015, C++ uses for coroutines */ return "coord_return"; } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a631fe4fc26..361168bcf3f 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -425,9 +425,7 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop) if (idprop->type == IDP_ARRAY) { return idprop->len; } - else { - return 0; - } + return 0; } static bool rna_ensure_property_array_check(PropertyRNA *prop) @@ -1268,7 +1266,7 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index) PROP_COORDS)) { return vectoritem[index]; } - else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) { + if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) { return coloritem[index]; } @@ -1533,9 +1531,7 @@ int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value) *value = max; return 1; } - else { - return 0; - } + return 0; } int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value) @@ -1552,9 +1548,7 @@ int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value) *value = max; return 1; } - else { - return 0; - } + return 0; } /* this is the max length including \0 terminator. @@ -2614,7 +2608,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) if (iprop->get) { return iprop->get(ptr); } - else if (iprop->get_ex) { + if (iprop->get_ex) { return iprop->get_ex(ptr, prop); } else { @@ -2950,7 +2944,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) } return (float)IDP_Double(idprop); } - else if (fprop->get) { + if (fprop->get) { return fprop->get(ptr); } else if (fprop->get_ex) { @@ -3389,7 +3383,7 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) #endif return idprop->len - 1; } - else if (sprop->length) { + if (sprop->length) { return sprop->length(ptr); } else if (sprop->length_ex) { @@ -3555,7 +3549,7 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop) if (eprop->get) { return eprop->get(ptr); } - else if (eprop->get_ex) { + if (eprop->get_ex) { return eprop->get_ex(ptr, prop); } else { @@ -3671,7 +3665,7 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop) } return rna_pointer_inherit_refine(ptr, pprop->type, idprop); } - else if (pprop->get) { + if (pprop->get) { return pprop->get(ptr); } else if (prop->flag & PROP_IDPROPERTY) { @@ -3924,18 +3918,16 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop) if (cprop->length) { return cprop->length(ptr); } - else { - CollectionPropertyIterator iter; - int length = 0; - - RNA_property_collection_begin(ptr, prop, &iter); - for (; iter.valid; RNA_property_collection_next(&iter)) { - length++; - } - RNA_property_collection_end(&iter); + CollectionPropertyIterator iter; + int length = 0; - return length; + RNA_property_collection_begin(ptr, prop, &iter); + for (; iter.valid; RNA_property_collection_next(&iter)) { + length++; } + RNA_property_collection_end(&iter); + + return length; } /* This helper checks whether given collection property itself is editable (we only currently @@ -5775,21 +5767,19 @@ static char *rna_idp_path(PointerRNA *ptr, path = rna_idp_path_create(&link); break; } - else { - int j; - link.name = iter->name; - for (j = 0; j < iter->len; j++, array++) { - PointerRNA child_ptr; - if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) { - link.index = j; - if ((path = rna_idp_path(&child_ptr, array, needle, &link))) { - break; - } + int j; + link.name = iter->name; + for (j = 0; j < iter->len; j++, array++) { + PointerRNA child_ptr; + if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) { + link.index = j; + if ((path = rna_idp_path(&child_ptr, array, needle, &link))) { + break; } } - if (path) { - break; - } + } + if (path) { + break; } } } @@ -6788,9 +6778,7 @@ static char *rna_pointer_as_string__bldata(Main *bmain, PointerRNA *ptr) if (RNA_struct_is_ID(ptr->type)) { return RNA_path_full_ID_py(bmain, ptr->owner_id); } - else { - return RNA_path_full_struct_py(bmain, ptr); - } + return RNA_path_full_struct_py(bmain, ptr); } char *RNA_pointer_as_string(bContext *C, @@ -6805,9 +6793,7 @@ char *RNA_pointer_as_string(bContext *C, if ((prop = rna_idproperty_check(&prop_ptr, ptr)) && prop->type != IDP_ID) { return RNA_pointer_as_string_id(C, ptr_prop); } - else { - return rna_pointer_as_string__bldata(CTX_data_main(C), ptr_prop); - } + return rna_pointer_as_string__bldata(CTX_data_main(C), ptr_prop); } /* context can be NULL */ diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index d367bc663f1..4bbbf5f01da 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -211,7 +211,7 @@ bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACo if (ptr_a == NULL || ptr_b == NULL) { return false; } - else if (ptr_a->type != ptr_b->type) { + if (ptr_a->type != ptr_b->type) { return false; } diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index b298d49fad5..b437e60ecf9 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -513,7 +513,7 @@ static int rna_find_sdna_member(SDNA *sdna, return 1; } - else if (cmp == 3) { + if (cmp == 3) { smember->type = ""; smember->name = dnaname; smember->offset = *offset; @@ -2199,15 +2199,13 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, dp->dnaoffset = smember.offset; return dp; } - else { - CLOG_ERROR(&LOG, - "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.", - structname, - propname, - prop->identifier); - DefRNA.error = true; - return NULL; - } + CLOG_ERROR(&LOG, + "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.", + structname, + propname, + prop->identifier); + DefRNA.error = true; + return NULL; } if (smember.arraylength > 1) { @@ -4363,9 +4361,8 @@ int rna_parameter_size(PropertyRNA *parm) } return sizeof(PointerRNA *); } - else { - return sizeof(void *); - } + return sizeof(void *); + #endif } case PROP_COLLECTION: diff --git a/source/creator/creator.c b/source/creator/creator.c index 3365dad75d1..fee97e5090f 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -293,7 +293,7 @@ int main(int argc, MEM_use_guarded_allocator(); break; } - else if (STREQ(argv[i], "--")) { + if (STREQ(argv[i], "--")) { break; } } diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 077eb4e6821..58601dcb6af 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -119,7 +119,7 @@ static bool parse_int_relative(const char *str, *r_err_msg = msg; return false; } - else if ((errno == ERANGE) || ((value < INT_MIN || value > INT_MAX))) { + if ((errno == ERANGE) || ((value < INT_MIN || value > INT_MAX))) { static const char *msg = "exceeds range"; *r_err_msg = msg; return false; @@ -166,9 +166,7 @@ static bool parse_int_range_relative(const char *str, str_end_range + 2, str_end_test, pos, neg, &r_value_range[1], r_err_msg)) { return true; } - else { - return false; - } + return false; } static bool parse_int_relative_clamp(const char *str, @@ -184,9 +182,7 @@ static bool parse_int_relative_clamp(const char *str, CLAMP(*r_value, min, max); return true; } - else { - return false; - } + return false; } static bool parse_int_range_relative_clamp(const char *str, @@ -205,9 +201,7 @@ static bool parse_int_range_relative_clamp(const char *str, CLAMP(r_value_range[1], min, max); return true; } - else { - return false; - } + return false; } /** @@ -231,7 +225,7 @@ static bool parse_int_strict_range(const char *str, *r_err_msg = msg; return false; } - else if ((errno == ERANGE) || ((value < min || value > max))) { + if ((errno == ERANGE) || ((value < min || value > max))) { static const char *msg = "exceeds range"; *r_err_msg = msg; return false; @@ -261,9 +255,7 @@ static bool parse_int_clamp(const char *str, CLAMP(*r_value, min, max); return true; } - else { - return false; - } + return false; } # if 0 @@ -802,10 +794,8 @@ static int arg_handle_log_level_set(int argc, const char **argv, void *UNUSED(da } return 1; } - else { - printf("\nError: '%s' no args given.\n", arg_id); - return 0; - } + printf("\nError: '%s' no args given.\n", arg_id); + return 0; } static const char arg_handle_log_show_basename_set_doc[] = @@ -865,10 +855,8 @@ static int arg_handle_log_file_set(int argc, const char **argv, void *UNUSED(dat } return 1; } - else { - printf("\nError: '%s' no args given.\n", arg_id); - return 0; - } + printf("\nError: '%s' no args given.\n", arg_id); + return 0; } static const char arg_handle_log_set_doc[] = @@ -908,10 +896,8 @@ static int arg_handle_log_set(int argc, const char **argv, void *UNUSED(data)) } return 1; } - else { - printf("\nError: '%s' no args given.\n", arg_id); - return 0; - } + printf("\nError: '%s' no args given.\n", arg_id); + return 0; } static const char arg_handle_debug_mode_set_doc[] = @@ -1094,10 +1080,8 @@ static int arg_handle_debug_value_set(int argc, const char **argv, void *UNUSED( return 1; } - else { - printf("\nError: you must specify debug value to set.\n"); - return 0; - } + printf("\nError: you must specify debug value to set.\n"); + return 0; } static const char arg_handle_debug_fpe_set_doc[] = @@ -1121,10 +1105,8 @@ static int arg_handle_app_template(int argc, const char **argv, void *UNUSED(dat WM_init_state_app_template_set(app_template); return 1; } - else { - printf("\nError: App template must follow '--app-template'.\n"); - return 0; - } + printf("\nError: App template must follow '--app-template'.\n"); + return 0; } static const char arg_handle_factory_startup_set_doc[] = @@ -1382,10 +1364,8 @@ static int arg_handle_output_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a path after '-o / --render-output'.\n"); - return 0; - } + printf("\nError: you must specify a path after '-o / --render-output'.\n"); + return 0; } static const char arg_handle_engine_set_doc[] = @@ -1425,10 +1405,8 @@ static int arg_handle_engine_set(int argc, const char **argv, void *data) return 1; } - else { - printf("\nEngine not specified, give 'help' for a list of available engines.\n"); - return 0; - } + printf("\nEngine not specified, give 'help' for a list of available engines.\n"); + return 0; } static const char arg_handle_image_type_set_doc[] = @@ -1465,10 +1443,8 @@ static int arg_handle_image_type_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a format after '-F / --render-format'.\n"); - return 0; - } + printf("\nError: you must specify a format after '-F / --render-format'.\n"); + return 0; } static const char arg_handle_threads_set_doc[] = @@ -1495,10 +1471,8 @@ static int arg_handle_threads_set(int argc, const char **argv, void *UNUSED(data BLI_system_num_threads_override_set(threads); return 1; } - else { - printf("\nError: you must specify a number of threads in [%d..%d] '%s'.\n", min, max, arg_id); - return 0; - } + printf("\nError: you must specify a number of threads in [%d..%d] '%s'.\n", min, max, arg_id); + return 0; } static const char arg_handle_verbosity_set_doc[] = @@ -1524,10 +1498,8 @@ static int arg_handle_verbosity_set(int argc, const char **argv, void *UNUSED(da return 1; } - else { - printf("\nError: you must specify a verbosity level.\n"); - return 0; - } + printf("\nError: you must specify a verbosity level.\n"); + return 0; } static const char arg_handle_extension_set_doc[] = @@ -1558,10 +1530,8 @@ static int arg_handle_extension_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a path after '- '.\n"); - return 0; - } + printf("\nError: you must specify a path after '- '.\n"); + return 0; } static const char arg_handle_render_frame_doc[] = @@ -1616,10 +1586,8 @@ static int arg_handle_render_frame(int argc, const char **argv, void *data) MEM_freeN(frame_range_arr); return 1; } - else { - printf("\nError: frame number must follow '%s'.\n", arg_id); - return 0; - } + printf("\nError: frame number must follow '%s'.\n", arg_id); + return 0; } else { printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); @@ -1673,10 +1641,8 @@ static int arg_handle_scene_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: Scene name must follow '-S / --scene'.\n"); - return 0; - } + printf("\nError: Scene name must follow '-S / --scene'.\n"); + return 0; } static const char arg_handle_frame_start_set_doc[] = @@ -1705,10 +1671,8 @@ static int arg_handle_frame_start_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: frame number must follow '%s'.\n", arg_id); - return 0; - } + printf("\nError: frame number must follow '%s'.\n", arg_id); + return 0; } else { printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); @@ -1742,10 +1706,8 @@ static int arg_handle_frame_end_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: frame number must follow '%s'.\n", arg_id); - return 0; - } + printf("\nError: frame number must follow '%s'.\n", arg_id); + return 0; } else { printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); @@ -1772,10 +1734,8 @@ static int arg_handle_frame_skip_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: number of frames to step must follow '%s'.\n", arg_id); - return 0; - } + printf("\nError: number of frames to step must follow '%s'.\n", arg_id); + return 0; } else { printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); @@ -1807,10 +1767,9 @@ static int arg_handle_python_file_run(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a filepath after '%s'.\n", argv[0]); - return 0; - } + printf("\nError: you must specify a filepath after '%s'.\n", argv[0]); + return 0; + # else UNUSED_VARS(argc, argv, data); printf("This Blender was built without Python support\n"); @@ -1849,10 +1808,9 @@ static int arg_handle_python_text_run(int argc, const char **argv, void *data) return 1; } - else { - printf("\nError: you must specify a text block after '%s'.\n", argv[0]); - return 0; - } + printf("\nError: you must specify a text block after '%s'.\n", argv[0]); + return 0; + # else UNUSED_VARS(argc, argv, data); printf("This Blender was built without Python support\n"); @@ -1879,10 +1837,9 @@ static int arg_handle_python_expr_run(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a Python expression after '%s'.\n", argv[0]); - return 0; - } + printf("\nError: you must specify a Python expression after '%s'.\n", argv[0]); + return 0; + # else UNUSED_VARS(argc, argv, data); printf("This Blender was built without Python support\n"); @@ -1932,10 +1889,8 @@ static int arg_handle_python_exit_code_set(int argc, const char **argv, void *UN app_state.exit_code_on_error.python = (unsigned char)exit_code; return 1; } - else { - printf("\nError: you must specify an exit code number '%s'.\n", arg_id); - return 0; - } + printf("\nError: you must specify an exit code number '%s'.\n", arg_id); + return 0; } static const char arg_handle_python_use_system_env_set_doc[] = @@ -1978,10 +1933,8 @@ static int arg_handle_addons_set(int argc, const char **argv, void *data) # endif /* WITH_PYTHON */ return 1; } - else { - printf("\nError: you must specify a comma separated list after '--addons'.\n"); - return 0; - } + printf("\nError: you must specify a comma separated list after '--addons'.\n"); + return 0; } static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data) |