diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-16 13:19:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-16 13:19:14 +0300 |
commit | 430bb75749343ce344a12ce3997f872954e1b3f9 (patch) | |
tree | 339e52fc0c9e82a8e2705da11d103aef2f79f137 /source/blender/makesrna | |
parent | ac1e2fc977671bb55263811a1f009392a7b64d6c (diff) |
enum-flag arguments were incorrectly documented.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 19 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 30 |
3 files changed, 42 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index d0a4647efc3..84d2dce7669 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -488,6 +488,12 @@ static int rna_Property_is_hidden_get(PointerRNA *ptr) return prop->flag & PROP_HIDDEN ? 1:0; } +static int rna_Property_is_enum_flag_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + return prop->flag & PROP_ENUM_FLAG ? 1:0; +} + static int rna_Property_array_length_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -1044,6 +1050,11 @@ static void rna_def_property(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL); RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA"); + + prop= RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Property_is_enum_flag_get", NULL); + RNA_def_property_ui_text(prop, "Enum Flag", "True when multiple enums "); } static void rna_def_function(BlenderRNA *brna) @@ -1209,6 +1220,14 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna) RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf"); RNA_def_property_ui_text(prop, "Default", "Default value for this enum"); + /* same 'default' but uses 'PROP_ENUM_FLAG' */ + prop= RNA_def_property(srna, "default_flag", PROP_ENUM, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_enum_items(prop, default_dummy_items); + RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf"); + RNA_def_property_ui_text(prop, "Default", "Default value for this enum"); + prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "EnumPropertyItem"); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 35186b91901..fc9bbbfb76c 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -620,20 +620,20 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER|FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); parm= RNA_def_pointer(func, "context", "Context", "", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); /* draw */ func= RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, "Draw UI elements into the panel UI layout."); RNA_def_function_flag(func, FUNC_REGISTER); parm= RNA_def_pointer(func, "context", "Context", "", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); func= RNA_def_function(srna, "draw_header", NULL); RNA_def_function_ui_description(func, "Draw UI elements into the panel's header UI layout."); RNA_def_function_flag(func, FUNC_REGISTER); parm= RNA_def_pointer(func, "context", "Context", "", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "UILayout"); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index b934bdfc979..87ef0d61410 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -158,13 +158,15 @@ void RNA_api_operator(StructRNA *srna) RNA_def_function_ui_description(func, "Test if the operator can be called or not."); RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); /* exec */ func= RNA_def_function(srna, "execute", NULL); RNA_def_function_ui_description(func, "Execute the operator."); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name? RNA_def_function_return(func, parm); @@ -173,7 +175,8 @@ void RNA_api_operator(StructRNA *srna) func= RNA_def_function(srna, "check", NULL); RNA_def_function_ui_description(func, "Check the operator settings."); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); parm= RNA_def_boolean(func, "result", 0, "result", ""); // better name? RNA_def_function_return(func, parm); @@ -182,8 +185,10 @@ void RNA_api_operator(StructRNA *srna) func= RNA_def_function(srna, "invoke", NULL); RNA_def_function_ui_description(func, "Invoke the operator."); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); - RNA_def_pointer(func, "context", "Context", "", ""); - RNA_def_pointer(func, "event", "Event", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + parm= RNA_def_pointer(func, "event", "Event", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name? RNA_def_function_return(func, parm); @@ -191,8 +196,10 @@ void RNA_api_operator(StructRNA *srna) func= RNA_def_function(srna, "modal", NULL); /* same as invoke */ RNA_def_function_ui_description(func, "Modal operator function."); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); - RNA_def_pointer(func, "context", "Context", "", ""); - RNA_def_pointer(func, "event", "Event", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + parm= RNA_def_pointer(func, "event", "Event", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name? RNA_def_function_return(func, parm); @@ -201,7 +208,8 @@ void RNA_api_operator(StructRNA *srna) func= RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, "Draw function for the operator."); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_api_macro(StructRNA *srna) @@ -224,13 +232,15 @@ void RNA_api_macro(StructRNA *srna) RNA_def_function_ui_description(func, "Test if the operator can be called or not."); RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); /* draw */ func= RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, "Draw function for the operator."); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_api_keyconfig(StructRNA *srna) |