fix for py console autocomp. need to swap out __main__ module there too.
This commit is contained in:
@@ -205,6 +205,10 @@ def autocomplete(context):
|
|||||||
scrollback = ""
|
scrollback = ""
|
||||||
scrollback_error = ""
|
scrollback_error = ""
|
||||||
|
|
||||||
|
if _BPY_MAIN_OWN:
|
||||||
|
main_mod_back = sys.modules["__main__"]
|
||||||
|
sys.modules["__main__"] = console._bpy_main_mod
|
||||||
|
|
||||||
try:
|
try:
|
||||||
current_line = sc.history[-1]
|
current_line = sc.history[-1]
|
||||||
line = current_line.line
|
line = current_line.line
|
||||||
@@ -223,6 +227,9 @@ def autocomplete(context):
|
|||||||
import traceback
|
import traceback
|
||||||
scrollback_error = traceback.format_exc()
|
scrollback_error = traceback.format_exc()
|
||||||
|
|
||||||
|
if _BPY_MAIN_OWN:
|
||||||
|
sys.modules["__main__"] = main_mod_back
|
||||||
|
|
||||||
# Separate automplete output by command prompts
|
# Separate automplete output by command prompts
|
||||||
if scrollback != '':
|
if scrollback != '':
|
||||||
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
|
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
|
||||||
|
|||||||
Reference in New Issue
Block a user