from os import makedirs
from multiprocessing import cpu_count
from panda3d.core import Filename, load_prc_file_data, AntialiasAttrib, \
- WindowProperties, LVector2i, TextNode
+ WindowProperties, LVector2i, TextNode, GraphicsBuffer
from panda3d.bullet import BulletWorld, BulletDebugNode
from direct.showbase.ShowBase import ShowBase
from direct.gui.OnscreenText import OnscreenText
from pmachines.posmgr import PositionMgr
from pmachines.persistent import Persistent
from ya2.utils.dictfile import DctFile
-from ya2.p3d.p3d import LibP3d
+from ya2.utils.logics import LogicsTools
from ya2.utils.lang import LangMgr
from ya2.utils.log import LogMgr
from ya2.utils.functional import FunctionalTest
-from ya2.p3d.asserts import Assert
+from ya2.utils.asserts import Assert
class MainFsm(FSM):
def __do_asserts(self):
args = self._pmachines._args
- if not LibP3d.runtime() or args.functional_test or args.functional_ref:
+ if not LogicsTools.runtime() or args.functional_test or args.functional_ref:
Assert.assert_threads()
Assert.assert_tasks()
Assert.assert_render3d()
Assert.assert_events()
Assert.assert_buffers()
+ def enterOff(self):
+ self.ignore('new_scene')
+
class Pmachines:
self.log_mgr = LogMgr.init_cls()()
self._pos_mgr = PositionMgr()
self._prepare_window(args)
+ self._fsm = MainFsm(self)
+ self._fsm.demand('Start') # otherwise it is Off and cleanup in tests won't work
if args.update:
return
if args.functional_test:
self.lang_mgr = LangMgr(self._options['settings']['language'],
'pmachines',
'assets/locale/')
- self._fsm = MainFsm(self)
if args.functional_test or args.functional_ref:
FunctionalTest(args.functional_ref, self._pos_mgr)
- if not LibP3d.runtime() or args.functional_test or args.functional_ref:
+ if not LogicsTools.runtime() or args.functional_test or args.functional_ref:
self.__fps_lst = []
taskMgr.do_method_later(1.0, self.__assert_fps, 'assert_fps')
optfile = args.optfile if args.optfile else 'options.ini'
info('data path: %s' % data_path)
info('option file: %s' % optfile)
- info('fixed path: %s' % LibP3d.fixpath(data_path + '/' + optfile))
+ info('fixed path: %s' % LogicsTools.fixpath(data_path + '/' + optfile))
default_opt = {
'settings': {
'volume': 1,
'fps': 0,
'editor': 0,
'auto_start_editor': 0}}
- opt_path = LibP3d.fixpath(data_path + '/' + optfile) if data_path else optfile
+ opt_path = LogicsTools.fixpath(data_path + '/' + optfile) if data_path else optfile
opt_exists = exists(opt_path)
self._options = DctFile(
- LibP3d.fixpath(data_path + '/' + optfile) if data_path else optfile,
+ LogicsTools.fixpath(data_path + '/' + optfile) if data_path else optfile,
default_opt)
if not opt_exists:
self._options.store()
props.set_size(res)
props.set_fullscreen(fullscreen)
props.set_icon_filename('assets/images/icon/pmachines.ico')
- if not args.screenshot and not self.is_version_run and base.win:
+ if not args.screenshot and not self.is_version_run and base.win and not isinstance(base.win, GraphicsBuffer):
base.win.request_properties(props)
#gltf.patch_loader(base.loader)
if self._options['development']['simplepbr'] and not self.is_version_run and base.win:
assert not all(fps < fps_threshold for fps in self.__fps_lst), 'low fps %s' % self.__fps_lst
return task.again
+ def destroy(self):
+ self._fsm.cleanup()
+ self.base.destroy()
+
def run(self):
self.start()
self.base.run()