[Bf-blender-cvs] [554b26cf88d] master: Fix T56912: bpy.data.masks.new() crashed
Jacques Lucke
noreply at git.blender.org
Tue Sep 25 12:02:30 CEST 2018
Commit: 554b26cf88de613ac94121c652cfff45a8f03c88
Author: Jacques Lucke
Date: Tue Sep 25 12:01:43 2018 +0200
Branches: master
https://developer.blender.org/rB554b26cf88de613ac94121c652cfff45a8f03c88
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
===================================================================
M source/blender/makesrna/intern/rna_main_api.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list