From 554b26cf88de613ac94121c652cfff45a8f03c88 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 25 Sep 2018 12:01:43 +0200 Subject: [PATCH] Fix T56912: bpy.data.masks.new() crashed I think there are two possible ways to fix that. 1. Make the name a required parameter. 2. Provide a default value. I choosed option 1 in this fix to be consistent with other .new functions. Also I think `RNA_def_string` instead of `RNA_def_string_file_path` should be used here. Looks like a copy-paste error. Reviewers: brecht Differential Revision: https://developer.blender.org/D3728 --- source/blender/makesrna/intern/rna_main_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 7d619254e07..f2249eb397d 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -1864,7 +1864,8 @@ void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop) /* new func */ func = RNA_def_function(srna, "new", "rna_Main_mask_new"); RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database"); - RNA_def_string_file_path(func, "name", NULL, MAX_ID_NAME - 2, "Mask", "Name of new mask data-block"); + parm = RNA_def_string(func, "name", NULL, MAX_ID_NAME - 2, "Mask", "Name of new mask data-block"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask data-block"); RNA_def_function_return(func, parm);