bpy.app was writing members more then once.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 10 Apr 2010 19:06:18 +0000 (19:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 10 Apr 2010 19:06:18 +0000 (19:06 +0000)
source/blender/python/doc/sphinx_doc_gen.py

index e76300eba010f0437215dba0077c4abfe7d4e219..7a55a488c92276c8197f60003216fea4d097d0d3 100644 (file)
@@ -167,7 +167,7 @@ def pyprop2sphinx(ident, fw, identifier, py_prop):
 
 def pymodule2sphinx(BASEPATH, module_name, module, title):
     import types
-
+    attribute_set = set()
     filepath = os.path.join(BASEPATH, module_name + ".rst")
     
     file = open(filepath, "w")
@@ -193,13 +193,21 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
             if descr.__doc__:
                 fw(".. data:: %s\n\n" % key)
                 write_indented_lines("   ", fw, descr.__doc__, False)
+                attribute_set.add(key)
                 fw("\n")
-    
+    del key, descr
     
     classes = []
 
     for attribute in sorted(dir(module)):
         if not attribute.startswith("_"):
+
+            if attribute in attribute_set:
+                continue
+
+            if attribute.startswith("n_"): # annoying exception, needed for bpy.app
+                continue
+            
             value = getattr(module, attribute)
 
             value_type = type(value)
@@ -220,6 +228,9 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
                 fw("\n")
             else:
                 print("\tnot documenting %s.%s" % (module_name, attribute))
+                continue
+
+            attribute_set.add(attribute)
             # TODO, more types...
 
     # write collected classes now