def load_nodes_from(abs_dir):
print("loading project nodes and cells from {}".format(abs_dir))
dir_file_names = os.listdir(abs_dir)
py_file_names = [x for x in dir_file_names if x.endswith(".py")]
for fname in py_file_names:
mod_name = fname[:-3]
full_path = os.path.join(abs_dir, fname)
source = None
with open(full_path, "r") as f:
source = f.read()
if source:
bge_netlogic = _get_this_module()
locals = {
"bge_netlogic": _get_this_module(),
"__name__": mod_name,
"bpy": bpy}
globals = locals
print("loading... {}".format(mod_name))
exec(source, locals, globals)
#TODO: reload source to refresh intermediate compilation?
pass
评论列表
文章目录