Made LE data can be loaded outside of LE
This commit is contained in:
parent
6b22e16a51
commit
e36c303ce7
|
|
@ -1,23 +1,22 @@
|
|||
import os
|
||||
import imp
|
||||
|
||||
from ObjectMgr import ObjectMgr
|
||||
from ObjectHandler import ObjectHandler
|
||||
from ObjectPalette import ObjectPalette
|
||||
|
||||
import ObjectMgr
|
||||
import ObjectHandler
|
||||
import ObjectPalette
|
||||
import ObjectGlobals as OG
|
||||
|
||||
class FileMgr:
|
||||
""" To handle data file """
|
||||
|
||||
def __init__(self, editor):
|
||||
def __init__(self, editor=None):
|
||||
self.editor = editor
|
||||
|
||||
def saveToFile(self, fileName):
|
||||
try:
|
||||
f = open(fileName, 'w')
|
||||
f.write("from pandac.PandaModules import *\n")
|
||||
f.write("\nhasattr(base, 'le'):\n")
|
||||
f.write("\nif hasattr(base, 'le'):\n")
|
||||
f.write("\tobjectMgr = base.le.objectMgr\n")
|
||||
f.write('\tui = base.le.ui\n')
|
||||
f.write('\tui.sceneGraphUI.reset()\n\n')
|
||||
|
|
@ -46,9 +45,9 @@ class FileMgr:
|
|||
file, pathname, description = imp.find_module(moduleName, [dirname])
|
||||
try:
|
||||
if self.editor is None: # when loaded outside of LE
|
||||
base.objectPalette = ObjectPalette()
|
||||
base.objectHandler = ObjectHandler(None)
|
||||
base.objectMgr = ObjectMgr(None)
|
||||
base.objectPalette = ObjectPalette.ObjectPalette()
|
||||
base.objectHandler = ObjectHandler.ObjectHandler(None)
|
||||
base.objectMgr = ObjectMgr.ObjectMgr(None)
|
||||
|
||||
module = imp.load_module(moduleName, file, pathname, description)
|
||||
except:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from pandac.PandaModules import *
|
||||
|
||||
hasattr(base, 'le'):
|
||||
if hasattr(base, 'le'):
|
||||
objectMgr = base.le.objectMgr
|
||||
ui = base.le.ui
|
||||
ui.sceneGraphUI.reset()
|
||||
|
|
|
|||
Loading…
Reference in New Issue