Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/modules/console_python.py
| Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | def get_console(console_id): | ||||
| if consoles is None: | if consoles is None: | ||||
| consoles = get_console.consoles = {} | consoles = get_console.consoles = {} | ||||
| get_console.consoles_namespace_hash = hash_next | get_console.consoles_namespace_hash = hash_next | ||||
| else: | else: | ||||
| # check if clearing the namespace is needed to avoid a memory leak. | # check if clearing the namespace is needed to avoid a memory leak. | ||||
| # the window manager is normally loaded with new blend files | # the window manager is normally loaded with new blend files | ||||
| # so this is a reasonable way to deal with namespace clearing. | # so this is a reasonable way to deal with namespace clearing. | ||||
| # bpy.data hashing is reset by undo so cant be used. | # bpy.data hashing is reset by undo so can't be used. | ||||
| hash_prev = getattr(get_console, "consoles_namespace_hash", 0) | hash_prev = getattr(get_console, "consoles_namespace_hash", 0) | ||||
| if hash_prev != hash_next: | if hash_prev != hash_next: | ||||
| get_console.consoles_namespace_hash = hash_next | get_console.consoles_namespace_hash = hash_next | ||||
| consoles.clear() | consoles.clear() | ||||
| console_data = consoles.get(console_id) | console_data = consoles.get(console_id) | ||||
| ▲ Show 20 Lines • Show All 295 Lines • Show Last 20 Lines | |||||