Fixed post processor loading.
This commit is contained in:
@@ -23,8 +23,13 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import sys
|
||||
|
||||
from PathScripts.PathPreferences import PathPreferences
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
|
||||
class PostProcessor:
|
||||
|
||||
@classmethod
|
||||
@@ -33,11 +38,17 @@ class PostProcessor:
|
||||
|
||||
@classmethod
|
||||
def load(cls, processor):
|
||||
PathLog.track(processor)
|
||||
syspath = sys.path
|
||||
paths = PathPreferences.searchPaths()
|
||||
paths.extend(sys.path)
|
||||
sys.path = paths
|
||||
|
||||
postname = processor + "_post"
|
||||
namespace = {}
|
||||
|
||||
#can't modify function local scope with exec in python3
|
||||
exec("from PathScripts import %s as current_post" % postname, namespace)
|
||||
exec("import %s as current_post" % postname, namespace)
|
||||
current_post = namespace['current_post']
|
||||
|
||||
# make sure the script is reloaded if it was previously loaded
|
||||
@@ -52,6 +63,8 @@ class PostProcessor:
|
||||
from importlib import reload
|
||||
exec("reload(%s)" % 'current_post')
|
||||
|
||||
sys.path = syspath
|
||||
|
||||
instance = PostProcessor(current_post)
|
||||
instance.units = None
|
||||
if hasattr(current_post, "UNITS"):
|
||||
|
||||
Reference in New Issue
Block a user