As promised two days ago here are the detailed building instructions. I hope I didn’t forget something:
(1)
Download Panda3D 1.4.2 source code and unpacked to C:\Libraries\panda3d-1.4.2\
(2)
New, clean install of Python 2.5.1 in C:\Programme\Python. Because I already had some dozen Python modules in my old Python 2.5 installation, and I didn’t want to include a messed up Python directory in Panda3D.
(3)
I replaced the Panda3D folder C:\Libraries\panda3d-1.4.2\thirdparty\win-python with the new Python installation.
(4)
From C:\Windows\system32 I copied these two files to C:\Libraries\panda3d-1.4.2\thirdparty\win-python:
- python25.dll
- pywintypes25.dll
(5)
Edit C:\Libraries\panda3d-1.4.2\makepanda\makepanda.py:
- renamed python24.dll to python25.dll.
- added a line to copy pywintypes25.dll too.
For details see below.
(6)
Edit C:\Libraries\panda3d-1.4.2\direct\src\ffi\DoGenPyCode.py:
- added code to create the new file pandac\preload.py.
- modified code for creation of pandac_init_.py.
- added some code which preloads the Panda3D dlls before auto-generating the other files in pandac.
For details see below.
(7)
Run makepanda:
C:\Libraries\panda3d-1.4.2> makepanda\makepanda.bat --everything --installer
Makepanda did run without crash and created an installer (~70M). The only tests I had time to do so far are the tutorials included in Panda3D 1.4.2. I think that the Python 2.5 builds will need a lot of further testing.
enn0x
Modifications in makepanda/makepanda.py:
Line 1885ff:
if (sys.platform == "win32"):
if (OMIT.count("PYTHON")==0):
# >>>>>
CopyFile('built/bin/python25.dll', 'thirdparty/win-python/python25.dll')
CopyFile('built/bin/pywintypes25.dll', 'thirdparty/win-python/pywintypes25.dll')
# <<<<<
CopyTree('built/python', 'thirdparty/win-python')
ConditionalWriteFile('built/python/panda.pth',"..\n../bin\n")
Modifications in direct\src\ffi\DoGenPyCode.py:
Line 11ff:
import time
# >>>>>
import imp
# <<<<<
from direct.ffi import FFIConstants
Line 237ff:
# Generate __init__.py
initFilename = os.path.join(outputCodeDir, '__init__.py')
init = open(initFilename, 'w')
# >>>>>
init.write( 'import preload\n' )
init.close( )
# Generate preload script
preloadCode = '''
import imp
import os
import sys
modules = [ 'libp3direct',
'libpandafx',
'libpanda',
'libpandaphysics',
'libpandaskel',
'libpandaegg',
'libp3heapq',
'libpandaexpress',
]
for name in modules:
if sys.modules.get( name ): continue
here = os.path.dirname( __file__ )
path = os.path.join( here, '../bin/%s.dll' % name )
path = os.path.normpath( path )
module = imp.load_dynamic( name, path )
sys.modules[ name ] = module
'''
preloadFilename = os.path.join(outputCodeDir, '__init__.py')
preload = open(initFilename, 'w')
preload.write( preloadCode )
preload.close( )
# <<<<<
# Generate PandaModules.py
Line 296ff:
for moduleName in FFIConstants.CodeModuleNameList:
print 'Importing code library: ' + moduleName
# >>>>>
exec('modulePath = os.path.normpath( __file__ + "../../../built/bin/" + moduleName + ".dll" )')
#exec('modulePath = os.path.abspath( os.getcwd( ) + "/built/bin/" + moduleName + ".dll" )')
exec('module = imp.load_dynamic( moduleName, modulePath )' )
#exec('import %s as module' % moduleName)
# <<<<<
pandaModules.write('from %sModules import *\n' % (moduleName))