diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-12-12 17:23:55 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-12-12 17:46:06 +0300 |
commit | 440d1042798113a0e8115ea1f1d016a44712e7a0 (patch) | |
tree | 147ca3dfc851aa635538a988005afa5ed89ac65a /source/blender/makesrna/intern/rna_scene.c | |
parent | 62703850ad560b5832c4e42143f563d11ba21cf4 (diff) |
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index c63d4e775f8..ddfb5dc6d61 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2310,7 +2310,7 @@ static void rna_def_gpencil_brushes(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "new", "rna_GPencil_brush_new"); RNA_def_function_ui_description(func, "Add a new grease pencil brush"); parm = RNA_def_string(func, "name", "GPencilBrush", MAX_NAME, "Name", "Name of the brush"); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "set_active", 0, "Set Active", "Set the newly created brush to the active brush"); parm = RNA_def_pointer(func, "palette", "GPencilBrush", "", "The newly created brush"); RNA_def_function_return(func, parm); @@ -2319,8 +2319,8 @@ static void rna_def_gpencil_brushes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a grease pencil brush"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "brush", "GPencilBrush", "", "The brush to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); - RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "GPencilBrush"); @@ -3609,8 +3609,8 @@ static void rna_def_freestyle_modules(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a style module from scene render layer Freestyle settings"); RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "module", "FreestyleModuleSettings", "", "Style module to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); - RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); } static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop) @@ -3642,7 +3642,7 @@ static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Add a line set to scene render layer Freestyle settings"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID); parm = RNA_def_string(func, "name", "LineSet", 0, "", "New name for the line set (not unique)"); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Newly created line set"); RNA_def_function_return(func, parm); @@ -3650,8 +3650,8 @@ static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a line set from scene render layer Freestyle settings"); RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Line set to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); - RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); } static void rna_def_freestyle_settings(BlenderRNA *brna) @@ -4979,7 +4979,7 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Add a render layer to scene"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); parm = RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the render layer (not unique)"); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer"); RNA_def_function_return(func, parm); @@ -4987,8 +4987,8 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a render layer"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID); parm = RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Render layer to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); - RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); } /* Render Views - MultiView */ @@ -5058,7 +5058,7 @@ static void rna_def_render_views(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Add a render view to scene"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); parm = RNA_def_string(func, "name", "RenderView", 0, "", "New name for the marker (not unique)"); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "result", "SceneRenderView", "", "Newly created render view"); RNA_def_function_return(func, parm); @@ -5066,8 +5066,8 @@ static void rna_def_render_views(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a render view"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID); parm = RNA_def_pointer(func, "view", "SceneRenderView", "", "Render view to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); - RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); } static void rna_def_image_format_stereo3d_format(BlenderRNA *brna) @@ -6635,7 +6635,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Link object to scene, run scene.update() after"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "object", "Object", "", "Object to add to scene"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base"); RNA_def_function_return(func, parm); @@ -6643,7 +6643,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Unlink object from scene"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); @@ -6694,7 +6694,7 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "new", "rna_TimeLine_add"); RNA_def_function_ui_description(func, "Add a keyframe to the curve"); parm = RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)"); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "frame", 1, -MAXFRAME, MAXFRAME, "", "The frame for the new marker", -MAXFRAME, MAXFRAME); parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created timeline marker"); RNA_def_function_return(func, parm); @@ -6704,8 +6704,8 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a timeline marker"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); - RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); func = RNA_def_function(srna, "clear", "rna_TimeLine_clear"); RNA_def_function_ui_description(func, "Remove all timeline markers"); @@ -6732,7 +6732,6 @@ static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop) /* name */ RNA_def_string(func, "idname", "KeyingSet", 64, "IDName", "Internal identifier of Keying Set"); RNA_def_string(func, "name", "KeyingSet", 64, "Name", "User visible name of Keying Set"); - /* returns the new KeyingSet */ parm = RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set"); RNA_def_function_return(func, parm); @@ -7216,8 +7215,8 @@ void RNA_def_scene(BlenderRNA *brna) /* Statistics */ func = RNA_def_function(srna, "statistics", "ED_info_stats_string"); - prop = RNA_def_string(func, "statistics", NULL, 0, "Statistics", ""); - RNA_def_function_return(func, prop); + parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", ""); + RNA_def_function_return(func, parm); /* Grease Pencil */ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); |