fix for py console autocomp. need to swap out __main__ module there too.

This commit is contained in:
2010-08-01 22:54:39 +00:00
parent c92e3225f3
commit 2e7c8bbeec

View File

@@ -205,6 +205,10 @@ def autocomplete(context):
scrollback = ""
scrollback_error = ""
if _BPY_MAIN_OWN:
main_mod_back = sys.modules["__main__"]
sys.modules["__main__"] = console._bpy_main_mod
try:
current_line = sc.history[-1]
line = current_line.line
@@ -223,6 +227,9 @@ def autocomplete(context):
import traceback
scrollback_error = traceback.format_exc()
if _BPY_MAIN_OWN:
sys.modules["__main__"] = main_mod_back
# Separate automplete output by command prompts
if scrollback != '':
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')