diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index 86da0b56943..5d7bd5af70a 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -252,19 +252,22 @@ class InfoFunctionRNA: self.description = rna_func.description.strip() self.args = [] - self.return_value = None + self.return_values = () def build(self): rna_func = self.bl_func parent_id = rna_func + self.return_values = [] for rna_prop in rna_func.parameters.values(): prop = GetInfoPropertyRNA(rna_prop, parent_id) if rna_prop.use_return: - self.return_value = prop + self.return_values.append(prop) else: self.args.append(prop) + self.return_values = tuple(self.return_values) + def __repr__(self): txt = '' txt += ' * ' + self.identifier + '(' @@ -566,8 +569,8 @@ def BuildRNAInfo(): func.build() for prop in func.args: prop.build() - if func.return_value: - func.return_value.build() + for prop in func.return_values: + prop.build() # now for operators op_mods = dir(bpy.ops) diff --git a/source/blender/python/sphinx_doc_gen.py b/source/blender/python/sphinx_doc_gen.py index c8e283ac447..73ac95ff931 100644 --- a/source/blender/python/sphinx_doc_gen.py +++ b/source/blender/python/sphinx_doc_gen.py @@ -115,8 +115,8 @@ def rna2sphinx(BASEPATH): #if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"): # return - #if not struct.identifier.startswith("Bone"): - # return + if not struct.identifier == "Object": + return filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % struct.identifier) file = open(filepath, "w") @@ -182,8 +182,17 @@ def rna2sphinx(BASEPATH): for prop in func.args: write_param(" ", fw, prop) - if func.return_value: - write_param(" ", fw, func.return_value, is_return=True) + if len(func.return_values) == 1: + write_param(" ", fw, func.return_values[0], is_return=True) + else: # multiple return values + fw(" :return (%s):\n" % ", ".join([prop.identifier for prop in func.return_values])) + for prop in func.return_values: + type_descr = prop.get_type_description(as_arg=True, class_fmt=":class:`%s`") + descr = prop.description + if not descr: + descr = prop.name + fw(" `%s`, %s, %s\n\n" % (prop.identifier, descr, type_descr)) + fw("\n")