def checkPandaVersionOutOfDate(self, minDay, minMonth, minYear): """ Checks if the panda build is out of date, so users don't complain about stuff not working, because they simply didn't update """ built = PandaSystem.getBuildDate() formated = datetime.datetime.strptime(built, "%b %d %Y %H:%M:%S") required = datetime.datetime(minYear, minMonth, minDay, 12, 00) if formated < required: print "ERROR: Your Panda3D Build is out of date. Update to the latest" print "git build in order to use the pipeline: " print "https://github.com/panda3d/panda3d" sys.exit(0) # Check version versionMinMinor = 9 versionMinMajor = 1 versionMismatch = False if PandaSystem.getMajorVersion() < versionMinMajor: versionMismatch = True elif PandaSystem.getMinorVersion() < versionMinMinor: versionMismatch = True if versionMismatch: print "ERROR: Your current panda build (", PandaSystem.getVersionString(), ") is" print "not supported! The minimum required build is", str(versionMinMajor) + "." + str(versionMinMinor) + ".0" sys.exit(0)
def analyze(self): """ Analyzes the user system. This should help debugging when the user shares his log. """ print "System analyzer:" def stat(name, *args): print " ", str(name).ljust(20, " "), "=", ''.join([str(i) for i in args]) stat("System", sys.platform, " / ", os.name) stat("Bitness", 8 * struct.calcsize("P")) stat("Panda3D-Build Date", PandaSystem.getBuildDate()) stat("Panda3D-Compiler", PandaSystem.getCompiler()) stat("Panda3D-Distributor", PandaSystem.getDistributor()) stat("Panda3D-Version", PandaSystem.getVersionString()) stat("Panda3D-Platform", PandaSystem.getPlatform()) stat("Panda3D-Official?", PandaSystem.isOfficialVersion())
def handleCommand(self, command): if command is None: # hack for Ctrl-Break self.spewInProgress = False self.console.addLine("*** break ***") self.console.allowEditing(True) return command = command.strip() if not command: return tokens = [x.strip() for x in command.split(' ')] command = tokens[0].lower() if command == 'help': self.console.addLines([ "Sorry, this is utter fakery.", "You won't get much more", "out of this simulation unless", "you program it yourself. :)" ]) elif command == 'dir': self.console.addLines([ "Directory of C:\\:", "HELP COM 72 05-06-2015 14:07", "DIR COM 121 05-06-2015 14:11", "SPEW COM 666 05-06-2015 15:02", " 2 Files(s) 859 Bytes.", " 0 Dirs(s) 7333 Bytes free.", ""]) elif command == 'cls': self.console.cls() elif command == 'echo': self.console.addLine(' '.join(tokens[1:])) elif command == 'ver': self.console.addLine('Panda DOS v0.01 in Panda3D ' + PandaSystem.getVersionString()) elif command == 'spew': self.startSpew() elif command == 'exit': self.console.setPrompt("System is shutting down NOW!") self.terminateMonitor() else: self.console.addLine("command not found")
def __init__(self): self.platform = self.__get_platform() self.os_version = self.__get_os_version() self.manufacturer = self.__getManufacturer() self.sdk_version = 'rest api v2' self.build_version = config.GetString('server-version', 'pirates-dev') self.engine_version = 'Panda3D %s' % PandaSystem.getVersionString() self.game_key = config.GetString('analytics-game-key', '') self.secret_key = config.GetString('analytics-secret-key', '') self.use_gzip = config.GetBool('analytics-gzip', True) self.client_ts_offset = 0 self.session_id = None self.url_init = 'http://api.gameanalytics.com/v2/' + self.game_key + '/init' self.url_events = 'http://api.gameanalytics.com/v2/' + self.game_key + '/events' if config.GetBool('want-analytics-sandbox', False): self.notify.warning('Running in Sandbox') self.url_init = 'http://sandbox-api.gameanalytics.com/v2/' + self.game_key + '/init' self.url_events = 'http://sandbox-api.gameanalytics.com/v2/' + self.game_key + '/events' self.event_queue = [] self.session_start_time = None self.ready = False if config.GetBool('want-analytics', False): self.__initialize()
def run(): global outputCodeDir global outputHTMLDir global directDir global extensionsDir global interrogateLib global codeLibs global doSqueeze global deleteSourceAfterSqueeze global etcPath global pythonSourcePath doGetopts() doErrorCheck() # Ok, now we can start generating code if native: generateNativeWrappers() else: from direct.ffi import FFIInterrogateDatabase db = FFIInterrogateDatabase.FFIInterrogateDatabase(etcPath = etcPath) db.generateCode(outputCodeDir, extensionsDir) if doSqueeze: db.squeezeGeneratedCode(outputCodeDir, deleteSourceAfterSqueeze) if doHTML: from direct.directscripts import gendocs from panda3d.core import PandaSystem versionString = '%s %s' % ( PandaSystem.getDistributor(), PandaSystem.getVersionString()) gendocs.generate(versionString, etcPath, pythonSourcePath, outputHTMLDir, HTMLHeader % time.asctime(), HTMLFooter, '', '.html')
def run(): global outputCodeDir global outputHTMLDir global directDir global extensionsDir global interrogateLib global codeLibs global doSqueeze global deleteSourceAfterSqueeze global etcPath global pythonSourcePath doGetopts() doErrorCheck() # Ok, now we can start generating code if native: generateNativeWrappers() else: from direct.ffi import FFIInterrogateDatabase db = FFIInterrogateDatabase.FFIInterrogateDatabase(etcPath=etcPath) db.generateCode(outputCodeDir, extensionsDir) if doSqueeze: db.squeezeGeneratedCode(outputCodeDir, deleteSourceAfterSqueeze) if doHTML: from direct.directscripts import gendocs from panda3d.core import PandaSystem versionString = '%s %s' % (PandaSystem.getDistributor(), PandaSystem.getVersionString()) gendocs.generate(versionString, etcPath, pythonSourcePath, outputHTMLDir, HTMLHeader % time.asctime(), HTMLFooter, '', '.html')
from panda3d.core import Filename, getModelPath, loadPrcFile, PandaSystem from path import path import scenesim if PandaSystem.getVersionString() != "1.9.0": import warnings warnings.warn("You are using a version of Panda3D that may not work " "with these demos. If you encounter problems, please try " "version 1.9.0 instead.") # load panda configuration ROOT_PATH = path(__path__[0]).joinpath("..").abspath() config_pth = ROOT_PATH.joinpath("Config.prc") if config_pth.isfile(): cp = Filename.fromOsSpecific(config_pth) cp.makeTrueCase() print "Loading config '%s'" % cp loadPrcFile(cp) getModelPath().appendDirectory(ROOT_PATH.joinpath("models")) getModelPath().appendDirectory(ROOT_PATH.joinpath("textures"))
def get_panda_short_version(): return PandaSystem.getVersionString().replace(".0", "")
from src.coginvasion.globals import CIGlobals CIGlobals.SettingsMgr = sm sm.loadFile(jsonFile) sm.doSunriseFor(sunrise=SHOWBASE_PREINIT) notify.info("Applying pre-ShowBase initialization settings.") from CIBase import CIBase base = CIBase() sm.doSunriseFor(sunrise=SHOWBASE_POSTINIT) notify.info("Applying post-ShowBase initialization settings.") base.initStuff() notify.info("Using Panda3D version {0}".format(PandaSystem.getVersionString())) notify.info("True threading: " + str(Thread.isTrueThreads())) # Use our shader generator extension #import ccoginvasion #shGen = ccoginvasion.CIShaderGenerator(base.win.getGsg(), base.win) #base.win.getGsg().setShaderGenerator(shGen) #import AnisotropicFiltering #AnisotropicFiltering.startApplying() display = base.config.GetString('load-display') audio = base.config.GetString('audio-library-name').replace('p3', '').replace( '_audio', '') if display == 'pandagl':
from panda3d.core import Filename, getModelPath, loadPrcFile, PandaSystem from path import path import scenesim if PandaSystem.getVersionString() != "1.9.0": import warnings warnings.warn( "You are using a version of Panda3D that may not work " "with these demos. If you encounter problems, please try " "version 1.9.0 instead.") # load panda configuration ROOT_PATH = path(__path__[0]).joinpath("..").abspath() config_pth = ROOT_PATH.joinpath("Config.prc") if config_pth.isfile(): cp = Filename.fromOsSpecific(config_pth) cp.makeTrueCase() print "Loading config '%s'" % cp loadPrcFile(cp) getModelPath().appendDirectory(ROOT_PATH.joinpath("models")) getModelPath().appendDirectory(ROOT_PATH.joinpath("textures"))
def print_info(self): print("Python version:", platform.python_version()) print("Panda version: %s (%s)" % (PandaSystem.getVersionString(), PandaSystem.getGitCommit())) print("Data type:", "double" if settings.use_double else 'float')
from direct.showbase.ShowBase import ShowBase from panda3d.core import (Mat4, Vec3, Vec4, PandaSystem, OrthographicLens, loadPrcFileData, AmbientLight, Point3) import engine.tq_graphics_basics import numpy as np print("Panda version:", PandaSystem.getVersionString()) svgcleaner_path = 'tests/svgpathmanipulaton/svgcleaner/svgcleaner' # p3d window winsize_scale_factor_0 = 100 * 0.75 winsizex_0 = int(16. * winsize_scale_factor_0) winsizey_0 = int(9. * winsize_scale_factor_0) print("winsizex_0 = ", winsizex_0, ", ", "winsizey_0 = ", winsizey_0) loadPrcFileData('', 'win-size ' + str(winsizex_0) + ' ' + str(winsizey_0)) # p3d window positon within OS gui in pixels; (0,0) is upper left of OS GUI # puts the upper left corner of the p3d window at that position loadPrcFileData('', 'win-origin 10 -1') def getMat4_scale_unit_quad_to_image_aspect_ratio_forrowvecs( image_width_pixels, image_height_pixels): # the height stays constant (height of 1 in world coords) quad_scalex = float(image_width_pixels) quad_scalez = float(image_height_pixels)
jsonfile = 'settings.json' print 'CIStart: Reading settings file ' + jsonfile sm = SettingsManager() class game: name = 'coginvasion' process = 'client' version = os.environ.get('GAME_VERSION') serverAddress = os.environ.get('GAME_SERVER') __builtin__.game = game() print 'CIStart: Starting the game.' print('CIStart: Using Panda3D version {0}').format( PandaSystem.getVersionString()) print 'CIStart: True threading: ' + str(Thread.isTrueThreads()) try: import aes, niraidata prc = niraidata.CONFIG iv, key, prc = prc[:16], prc[16:32], prc[32:] prc = aes.decrypt(prc, key, iv) for line in prc.split('\n'): line = line.strip() if line: loadPrcFileData('coginvasion config', line) print 'CIStart: Running production' except: loadPrcFile('config/Confauto.prc') loadPrcFile('config/config_client.prc')
from lib.coginvasion.manager.SettingsManager import SettingsManager jsonfile = "settings.json" print "CIStart: Reading settings file " + jsonfile sm = SettingsManager() class game: name = 'coginvasion' process = 'client' version = os.environ.get("GAME_VERSION") serverAddress = os.environ.get("GAME_SERVER") __builtin__.game = game() print "CIStart: Starting the game." print "CIStart: Using Panda3D version {0}".format(PandaSystem.getVersionString()) print 'CIStart: True threading: ' + str(Thread.isTrueThreads()) try: import aes import niraidata # Config prc = niraidata.CONFIG iv, key, prc = prc[:16], prc[16:32], prc[32:] prc = aes.decrypt(prc, key, iv) for line in prc.split('\n'): line = line.strip() if line: loadPrcFileData('coginvasion config', line) print "CIStart: Running production" except: