py addons: much faster scanning of addons by only parsing the dictionary rather then the entire file.
This commit is contained in:
		| @@ -842,12 +842,23 @@ class USERPREF_PT_addons(bpy.types.Panel): | |||||||
|  |  | ||||||
|         if 1: |         if 1: | ||||||
|             # fake module importing |             # fake module importing | ||||||
|             def fake_module(mod_name, mod_path, speedy=False): |             def fake_module(mod_name, mod_path, speedy=True): | ||||||
|                 print("fake_module", mod_name, mod_path) |                 if bpy.app.debug: | ||||||
|  |                     print("fake_module", mod_name, mod_path) | ||||||
|                 import ast |                 import ast | ||||||
|                 ModuleType = type(ast) |                 ModuleType = type(ast) | ||||||
|                 if speedy: |                 if speedy: | ||||||
|                     pass |                     lines = [] | ||||||
|  |                     line_iter = iter(open(mod_path, "r")) | ||||||
|  |                     l = "" | ||||||
|  |                     while not l.startswith("bl_addon_info"): | ||||||
|  |                         l = line_iter.readline() | ||||||
|  |                     while l.rstrip(): | ||||||
|  |                         lines.append(l) | ||||||
|  |                         l = line_iter.readline() | ||||||
|  |                     del line_iter | ||||||
|  |                     data = "".join(lines) | ||||||
|  |  | ||||||
|                 else: |                 else: | ||||||
|                     data = open(mod_path, "r").read() |                     data = open(mod_path, "r").read() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user