diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-26 20:49:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-26 20:49:08 +0300 |
commit | 5689ab39754dcd7229f616e3eed206bea5611545 (patch) | |
tree | 08d6726e3e698a9b990f918f34c6cf1224651d7e /source/blender | |
parent | 24ab5416da537bd5073d1e19431143f381b7922f (diff) |
classmethods were excluded from docs, hide self & cls arguments for functions and class methods,
made some rna ui funcs not display as optional.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 21 | ||||
-rw-r--r-- | source/blender/python/sphinx_doc_gen.py | 16 |
2 files changed, 29 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index cbd524680c1..695eb76cb53 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -573,6 +573,7 @@ static void rna_def_panel(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + PropertyRNA *parm; FunctionRNA *func; srna= RNA_def_struct(brna, "Panel", NULL); @@ -586,18 +587,21 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_function_ui_description(func, "Test if the panel is visible or not."); RNA_def_function_flag(func, FUNC_REGISTER|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); /* draw */ func= RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, "Draw buttons into the panel UI layout."); RNA_def_function_flag(func, FUNC_REGISTER); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); func= RNA_def_function(srna, "draw_header", NULL); RNA_def_function_ui_description(func, "Draw buttons into the panel header UI layout."); RNA_def_function_flag(func, FUNC_REGISTER); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "UILayout"); @@ -641,6 +645,7 @@ static void rna_def_header(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + PropertyRNA *parm; FunctionRNA *func; srna= RNA_def_struct(brna, "Header", NULL); @@ -653,7 +658,8 @@ static void rna_def_header(BlenderRNA *brna) func= RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, "Draw buttons into the header UI layout."); RNA_def_function_flag(func, FUNC_REGISTER); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); RNA_define_verify_sdna(0); // not in sdna @@ -678,6 +684,7 @@ static void rna_def_menu(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + PropertyRNA *parm; FunctionRNA *func; srna= RNA_def_struct(brna, "Menu", NULL); @@ -691,13 +698,15 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_function_ui_description(func, "Test if the menu is visible or not."); RNA_def_function_flag(func, FUNC_REGISTER|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); /* draw */ func= RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, "Draw buttons into the menu UI layout."); RNA_def_function_flag(func, FUNC_REGISTER); - RNA_def_pointer(func, "context", "Context", "", ""); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); RNA_define_verify_sdna(0); // not in sdna diff --git a/source/blender/python/sphinx_doc_gen.py b/source/blender/python/sphinx_doc_gen.py index fcf0f274bcf..c8e283ac447 100644 --- a/source/blender/python/sphinx_doc_gen.py +++ b/source/blender/python/sphinx_doc_gen.py @@ -192,8 +192,20 @@ def rna2sphinx(BASEPATH): py_func = None for identifier, py_func in py_funcs: - fw(" .. method:: %s%s\n\n" % (identifier, inspect.formatargspec(*inspect.getargspec(py_func)))) - write_indented_lines(" ", fw, py_func.__doc__) + arg_str = inspect.formatargspec(*inspect.getargspec(py_func)) + if arg_str.startswith("(self, "): + arg_str = "(" + arg_str[7:] + func_type = "method" + elif arg_str.startswith("(cls, "): + arg_str = "(" + arg_str[6:] + func_type = "classmethod" + else: + func_type = "staticmethod" + + fw(" .. %s:: %s%s\n\n" % (func_type, identifier, arg_str)) + if py_func.__doc__: + write_indented_lines(" ", fw, py_func.__doc__) + fw("\n") del py_funcs, py_func if struct.references: |