Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-12-26 19:47:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-26 19:47:25 +0300
commit24ab5416da537bd5073d1e19431143f381b7922f (patch)
tree05da2e83e95f29619ddfd9010b19a8892f4d0f35 /release/scripts/modules/rna_info.py
parent20ab9a4d9bcfab7c0843ee21f9a3f7976ab530cc (diff)
* sphinx docgen *
py_function_args wasnt working right (was using function namespace for function args), use pythons inspect module instead. move the function to get a type description into rna_info
Diffstat (limited to 'release/scripts/modules/rna_info.py')
-rw-r--r--release/scripts/modules/rna_info.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py
index 45bb46917af..57918046f95 100644
--- a/release/scripts/modules/rna_info.py
+++ b/release/scripts/modules/rna_info.py
@@ -201,6 +201,40 @@ class InfoPropertyRNA:
return "%s=%s" % (self.identifier, default)
return self.identifier
+ def get_type_description(self, as_arg=False, class_fmt="%s"):
+ type_str = ""
+ if self.fixed_type is None:
+ type_str += self.type
+ if self.array_length:
+ type_str += " array of %d items" % (self.array_length)
+
+ if self.type in ("float", "int"):
+ type_str += " in [%s, %s]" % (range_str(self.min), range_str(self.max))
+ elif self.type == "enum":
+ type_str += " in [%s]" % ', '.join([("'%s'" % s) for s in self.enum_items])
+ else:
+ if self.type == "collection":
+ if self.collection_type:
+ collection_str = (class_fmt % self.collection_type.identifier) + " collection of "
+ else:
+ collection_str = "Collection of "
+ else:
+ collection_str = ""
+
+ type_str += collection_str + (class_fmt % self.fixed_type.identifier)
+
+ if as_arg:
+ if not self.is_required:
+ type_str += ", (optional)"
+ else: # readonly is only useful for selfs, not args
+ if self.is_readonly:
+ type_str += ", (readonly)"
+
+ if self.is_never_none:
+ type_str += ", (never None)"
+
+ return type_str
+
def __repr__(self):
txt = ''
txt += ' * ' + self.identifier + ': ' + self.description