*** empty log message ***

This commit is contained in:
Josh Yelon 2005-08-11 01:41:43 +00:00
parent 9e1297d56b
commit 879261500c
10 changed files with 147 additions and 65 deletions

View File

@ -102,6 +102,8 @@ Section "${SMDIRECTORY}" SecCore
!ifdef PPGAME !ifdef PPGAME
SetOutPath $INSTDIR\models\audio
File /r /x CVS ${PANDA}\models\audio\*
SetOutPath $INSTDIR\bin SetOutPath $INSTDIR\bin
File /r ${PANDA}\bin\ppython.exe File /r ${PANDA}\bin\ppython.exe
SetOutpath $INSTDIR\game SetOutpath $INSTDIR\game

View File

@ -17,9 +17,11 @@ import sys,os,getopt,string,shutil,py_compile
OPTIONLIST = [ OPTIONLIST = [
("game", 1, "Name of directory containing game"), ("game", 1, "Name of directory containing game"),
("version", 1, "Version number to add to game name"), ("version", 1, "Version number to add to game name"),
("rmdir", 2, "Delete all directories with given name"),
("rmext", 2, "Delete all files with given extension"),
("fast", 0, "Use fast compression instead of good compression"), ("fast", 0, "Use fast compression instead of good compression"),
("cplegg", 0, "Convert all EGG files to BAM"), ("bam", 0, "Generate BAM files"),
("cplpy", 0, "Convert all PY files to PYC"), ("pyc", 0, "Generate PYC files"),
] ]
def ParseFailure(): def ParseFailure():
@ -38,15 +40,21 @@ def ParseOptions(args):
options = {} options = {}
longopts = [] longopts = []
for (opt, hasval, explanation) in OPTIONLIST: for (opt, hasval, explanation) in OPTIONLIST:
if (hasval): longopts.append(opt+"=") if (hasval==2):
else: longopts.append(opt) longopts.append(opt+"=")
options[opt] = 0 options[opt] = []
if (hasval): options[opt]="" elif (hasval==1):
longopts.append(opt+"=")
options[opt] = ""
else:
longopts.append(opt)
options[opt] = 0
opts, extras = getopt.getopt(args, "", longopts) opts, extras = getopt.getopt(args, "", longopts)
for option,value in opts: for option,value in opts:
for (opt, hasval, explanation) in OPTIONLIST: for (opt, hasval, explanation) in OPTIONLIST:
if (option == "--"+opt): if (option == "--"+opt):
if (hasval): options[opt] = value if (hasval==2): options[opt].append(value)
elif (hasval==1): options[opt] = value
else: options[opt] = 1 else: options[opt] = 1
return options return options
except: ParseFailure(); except: ParseFailure();
@ -88,8 +96,6 @@ GAME=os.path.abspath(GAME)
NAME=os.path.basename(GAME) NAME=os.path.basename(GAME)
SMDIRECTORY=os.path.basename(GAME) SMDIRECTORY=os.path.basename(GAME)
if (VER!=""): SMDIRECTORY=SMDIRECTORY+" "+VER if (VER!=""): SMDIRECTORY=SMDIRECTORY+" "+VER
if (OPTIONS["cplpy"]): MAIN=NAME+".pyc"
else: MAIN=NAME+".py"
ICON=os.path.join(GAME,NAME+".ico") ICON=os.path.join(GAME,NAME+".ico")
BITMAP=os.path.join(GAME,NAME+".bmp") BITMAP=os.path.join(GAME,NAME+".bmp")
LICENSE=os.path.join(GAME,"LICENSE.TXT") LICENSE=os.path.join(GAME,"LICENSE.TXT")
@ -100,6 +106,8 @@ INSTALLDIR='C:\\'+os.path.basename(GAME)
if (VER!=""): INSTALLDIR=INSTALLDIR+"-"+VER if (VER!=""): INSTALLDIR=INSTALLDIR+"-"+VER
COMPRESS="lzma" COMPRESS="lzma"
if (OPTIONS["fast"]): COMPRESS="zlib" if (OPTIONS["fast"]): COMPRESS="zlib"
if (OPTIONS["pyc"]): MAIN=NAME+".pyc"
else: MAIN=NAME+".py"
def PrintFileStatus(label, file): def PrintFileStatus(label, file):
if (os.path.exists(file)): if (os.path.exists(file)):
@ -131,54 +139,88 @@ if (os.path.isfile(BITMAP)==0):
############################################################################## ##############################################################################
# #
# If necessary, make a copy of the game for compilation purposes. # Copy the game to a temporary directory, so we can modify it safely.
#
##############################################################################
TMPDIR=os.path.abspath("packpanda-TMP")
print ""
print "Copying the game to "+TMPDIR+"..."
if (os.path.exists(TMPDIR)):
try: shutil.rmtree(TMPDIR)
except: sys.exit("Cannot delete "+TMPDIR)
try: shutil.copytree(GAME, TMPDIR)
except: sys.exit("Cannot copy game to "+TMPDIR)
##############################################################################
#
# Compile all py files, convert all egg files.
#
# We do this as a sanity check, even if the user
# hasn't requested that his files be compiled.
# #
############################################################################## ##############################################################################
EGG2BAM=os.path.join(PANDA,"bin","egg2bam.exe") EGG2BAM=os.path.join(PANDA,"bin","egg2bam.exe")
def egg2bam(file): def egg2bam(file):
orig = os.getcwd() bam = file[:-4]+'.bam'
dir = os.path.dirname(file) present = os.path.exists(bam)
base = os.path.basename(file) if (present): bam = "packpanda-TMP.bam";
pre = base[:-4] cmd = 'egg2bam -noabs -ps rel -pd . "'+file+'" -o "'+bam+'"'
cmd = 'egg2bam -noabs "'+base+'" -o "'+pre+'.bam"'
print "Executing: "+cmd print "Executing: "+cmd
os.chdir(dir)
res = os.spawnl(os.P_WAIT, EGG2BAM, cmd) res = os.spawnl(os.P_WAIT, EGG2BAM, cmd)
if (res != 0): sys.exit("Cannot convert egg to bam") if (res != 0): sys.exit("Problem in egg file: "+file)
os.chdir(orig) if (present) or (OPTIONS["bam"]==0):
os.unlink(file) os.unlink(bam)
def py2pyc(file): def py2pyc(file):
print "Compiling python "+file print "Compiling python "+file
pyc = file[:-3]+'.pyc'
pyo = file[:-3]+'.pyo'
if (os.path.exists(pyc)): os.unlink(pyc)
if (os.path.exists(pyo)): os.unlink(pyo)
try: py_compile.compile(file) try: py_compile.compile(file)
except: sys.exit("Cannot compile "+file) except: sys.exit("Cannot compile "+file)
os.unlink(file) if (OPTIONS["pyc"]==0):
if (os.path.exists(pyc)):
os.unlink(pyc)
if (os.path.exists(pyo)):
os.unlink(pyo)
def CompileFiles(file): def CompileFiles(file):
if (os.path.isfile(file)): if (os.path.isfile(file)):
if OPTIONS["cplegg"] and (string.lower(file[-4:])==".egg"): if (string.lower(file[-4:])==".egg"):
egg2bam(file) egg2bam(file)
elif OPTIONS["cplpy"] and (string.lower(file[-3:])==".py"): elif (string.lower(file[-3:])==".py"):
py2pyc(file) py2pyc(file)
else: pass else: pass
elif (os.path.isdir(file)): elif (os.path.isdir(file)):
for x in os.listdir(file): for x in os.listdir(file):
CompileFiles(os.path.join(file,x)) CompileFiles(os.path.join(file,x))
if (OPTIONS["cplpy"] or OPTIONS["cplegg"]): def DeleteFiles(file):
TMPDIR=os.path.abspath("packpanda-TMP") base = string.lower(os.path.basename(file))
print "Copying the game to "+TMPDIR+"..." if (os.path.isdir(file)):
if (os.path.exists(TMPDIR)): for pattern in OPTIONS["rmdir"]:
try: shutil.rmtree(TMPDIR) if (string.lower(pattern) == base):
except: sys.exit("Cannot delete "+TMPDIR) print "Deleting "+file
try: shutil.copytree(GAME, TMPDIR) shutil.rmtree(file)
except: sys.exit("Cannot copy game to "+TMPDIR) return
print "Searching for files to compile in "+TMPDIR+"..." for x in os.listdir(file):
CompileFiles(TMPDIR) DeleteFiles(os.path.join(file,x))
else: else:
TMPDIR=GAME for ext in OPTIONS["rmext"]:
if (base[-(len(ext)+1):] == string.lower("."+ext)):
print "Deleting "+file
os.unlink(file)
return
print ""
print "Compiling BAM and PYC files..."
os.chdir(TMPDIR)
CompileFiles(".")
DeleteFiles(".")
############################################################################## ##############################################################################
# #

View File

@ -16,7 +16,7 @@
def getSourceTextureName(self): def getSourceTextureName(self):
if self.sourceTextureName == None: if self.sourceTextureName == None:
SpriteParticleRenderer.sourceTextureName = base.config.GetString( SpriteParticleRenderer.sourceTextureName = base.config.GetString(
'particle-sprite-texture', 'phase_3/maps/eyes.jpg') 'particle-sprite-texture', 'phase_3/maps/feyes.jpg')
# Return instance copy of class variable # Return instance copy of class variable
return self.sourceTextureName return self.sourceTextureName

View File

@ -1,4 +1,4 @@
from pandac.VBase3 import VBase3 from pandac.PandaModules import VBase3
from direct.task import Task from direct.task import Task
class Audio3DManager: class Audio3DManager:

View File

@ -4704,18 +4704,26 @@ def MakeInstallerNSIS(file,fullname,smdirectory,installdir):
os.remove(file) os.remove(file)
if (os.path.exists("nsis-output.exe")): if (os.path.exists("nsis-output.exe")):
os.remove("nsis-output.exe") os.remove("nsis-output.exe")
def0 = '/DCOMPRESSOR="' + COMPRESSOR + '" ' psource=os.path.abspath(".")
def1 = '/DFULLNAME="' + fullname + '" ' panda=os.path.abspath(PREFIX)
def2 = '/DSMDIRECTORY="' + smdirectory + '" ' cmd="thirdparty/win-nsis/makensis.exe /V2 "
def3 = '/DINSTALLDIR="' + installdir + '" ' cmd=cmd+'/DCOMPRESSOR="'+COMPRESSOR+'" '
def4 = '/DPANDA="..\\..\\..\\' + PREFIX + '" ' cmd=cmd+'/DNAME="'+fullname+'" '
def5 = '/DPSOURCE="..\\..\\.." ' cmd=cmd+'/DSMDIRECTORY="'+smdirectory+'" '
def6 = '/DPYEXTRAS="..\\..\\..\\thirdparty\\win-extras" ' cmd=cmd+'/DINSTALLDIR="'+installdir+'" '
def7 = '/DOUTFILE="..\\..\\..\\nsis-output.exe" ' cmd=cmd+'/DOUTFILE="'+psource+'\\nsis-output.exe" '
oscmd("thirdparty/win-nsis/makensis.exe /V2 "+def0+def1+def2+def3+def4+def5+def6+def7+" direct/src/directscripts/packpanda.nsi") cmd=cmd+'/DLICENSE="'+panda+'\\LICENSE" '
cmd=cmd+'/DLANGUAGE="Panda3DEnglish" '
cmd=cmd+'/DRUNTEXT="Run the Panda Greeting Card" '
cmd=cmd+'/DIBITMAP="panda-install.bmp" '
cmd=cmd+'/DUBITMAP="panda-uninstall.bmp" '
cmd=cmd+'/DPANDA="'+panda+'" '
cmd=cmd+'/DPSOURCE="'+psource+'" '
cmd=cmd+'/DPYEXTRAS="'+psource+'\\thirdparty\\win-extras" '
cmd=cmd+'"'+psource+'\\direct\\src\\directscripts\\packpanda.nsi"'
oscmd(cmd)
os.rename("nsis-output.exe", file) os.rename("nsis-output.exe", file)
def MakeInstallerDPKG(file): def MakeInstallerDPKG(file):
if (older(file,ALLTARGETS)): if (older(file,ALLTARGETS)):
DEB=""" DEB="""

View File

@ -18,7 +18,7 @@
<Tool <Tool
Name="VCNMakeTool" Name="VCNMakeTool"
BuildCommandLine="cd .. &amp; makepanda\makepanda --everything --installer" BuildCommandLine="cd .. &amp; makepanda\makepanda --everything --installer"
Output="..\built\bin\ppython.exe"/> Output="..\built\python\python.exe"/>
</Configuration> </Configuration>
</Configurations> </Configurations>
<References> <References>

View File

@ -387,7 +387,9 @@ read_args() {
char buffer[buffer_size]; char buffer[buffer_size];
DWORD size = GetModuleFileName(dllhandle, buffer, buffer_size); DWORD size = GetModuleFileName(dllhandle, buffer, buffer_size);
if (size != 0) { if (size != 0) {
_dtool_name = Filename::from_os_specific(string(buffer,size)); Filename tmp = Filename::from_os_specific(string(buffer,size));
tmp.make_true_case();
_dtool_name = tmp;
} }
} }
#endif #endif
@ -414,7 +416,9 @@ read_args() {
char buffer[buffer_size]; char buffer[buffer_size];
DWORD size = GetModuleFileName(NULL, buffer, buffer_size); DWORD size = GetModuleFileName(NULL, buffer, buffer_size);
if (size != 0) { if (size != 0) {
_binary_name = Filename::from_os_specific(string(buffer, size)); Filename tmp = Filename::from_os_specific(string(buffer, size));
tmp.make_true_case();
_binary_name = tmp;
} }
#endif // WIN32_VC #endif // WIN32_VC

View File

@ -51,10 +51,15 @@ public:
INLINE static int get_num_args(); INLINE static int get_num_args();
INLINE static string get_arg(int n); INLINE static string get_arg(int n);
static Filename get_cwd();
PUBLISHED:
INLINE static string get_binary_name(); INLINE static string get_binary_name();
INLINE static string get_dtool_name(); INLINE static string get_dtool_name();
static Filename get_cwd(); PUBLISHED:
string ns_get_binary_name() const;
string ns_get_dtool_name() const;
private: private:
bool ns_has_environment_variable(const string &var) const; bool ns_has_environment_variable(const string &var) const;
@ -66,9 +71,6 @@ private:
int ns_get_num_args() const; int ns_get_num_args() const;
string ns_get_arg(int n) const; string ns_get_arg(int n) const;
string ns_get_binary_name() const;
string ns_get_dtool_name() const;
static ExecutionEnvironment *get_ptr(); static ExecutionEnvironment *get_ptr();
void read_environment_variables(); void read_environment_variables();

View File

@ -152,15 +152,25 @@ public:
vector <MaxEggJoint *> _children; vector <MaxEggJoint *> _children;
public: public:
LVector3d GetXV(void) { return _trans.get_row3(0); } void GetRotation(LVector3d &xv, LVector3d &yv, LVector3d &zv);
LVector3d GetYV(void) { return _trans.get_row3(1); }
LVector3d GetZV(void) { return _trans.get_row3(2); }
LVector3d GetPos(void) { return _trans.get_row3(3); } LVector3d GetPos(void) { return _trans.get_row3(3); }
MaxEggJoint *ChooseBestChild(LVector3d dir); MaxEggJoint *ChooseBestChild(LVector3d dir);
void ChooseEndPos(double thickness); void ChooseEndPos(double thickness);
void CreateMaxBone(CoordinateSystem sys); void CreateMaxBone(CoordinateSystem sys);
}; };
void MaxEggJoint::GetRotation(LVector3d &xv, LVector3d &yv, LVector3d &zv)
{
xv = _trans.get_row3(0);
yv = _trans.get_row3(1);
zv = _trans.get_row3(2);
xv.normalize();
yv.normalize();
zv = xv.cross(yv);
zv.normalize();
yv = zv.cross(xv);
}
MaxEggJoint *MaxEggLoader::FindJoint(EggGroup *joint) MaxEggJoint *MaxEggLoader::FindJoint(EggGroup *joint)
{ {
if (joint==0) return 0; if (joint==0) return 0;
@ -252,9 +262,11 @@ void MaxEggJoint::ChooseEndPos(double thickness)
void MaxEggJoint::CreateMaxBone(CoordinateSystem sys) void MaxEggJoint::CreateMaxBone(CoordinateSystem sys)
{ {
Point3 xv(ConvertCoordSys(sys, GetXV())); LVector3d rxv,ryv,rzv;
Point3 yv(ConvertCoordSys(sys, GetYV())); GetRotation(rxv, ryv, rzv);
Point3 zv(ConvertCoordSys(sys, GetZV())); Point3 xv(ConvertCoordSys(sys, rxv));
Point3 yv(ConvertCoordSys(sys, ryv));
Point3 zv(ConvertCoordSys(sys, rzv));
Point3 pos(ConvertCoordSys(sys, GetPos())); Point3 pos(ConvertCoordSys(sys, GetPos()));
Point3 endpos(ConvertCoordSys(sys, _endpos)); Point3 endpos(ConvertCoordSys(sys, _endpos));
Point3 tzv(ConvertCoordSys(sys, _perp)); Point3 tzv(ConvertCoordSys(sys, _perp));

View File

@ -214,9 +214,7 @@ public:
vector <MayaEggJoint *> _children; vector <MayaEggJoint *> _children;
public: public:
LVector3d GetXV(void) { return _trans.get_row3(0); } void GetRotation(LVector3d &xv, LVector3d &yv, LVector3d &zv);
LVector3d GetYV(void) { return _trans.get_row3(1); }
LVector3d GetZV(void) { return _trans.get_row3(2); }
LVector3d GetPos(void) { return _trans.get_row3(3); } LVector3d GetPos(void) { return _trans.get_row3(3); }
MayaEggJoint *ChooseBestChild(LVector3d dir); MayaEggJoint *ChooseBestChild(LVector3d dir);
void ChooseEndPos(double thickness); void ChooseEndPos(double thickness);
@ -224,6 +222,18 @@ public:
void AssignNames(void); void AssignNames(void);
}; };
void MayaEggJoint::GetRotation(LVector3d &xv, LVector3d &yv, LVector3d &zv)
{
xv = _trans.get_row3(0);
yv = _trans.get_row3(1);
zv = _trans.get_row3(2);
xv.normalize();
yv.normalize();
zv = xv.cross(yv);
zv.normalize();
yv = zv.cross(xv);
}
void MayaEggJoint::AssignNames(void) void MayaEggJoint::AssignNames(void)
{ {
string name = _egg_joint->get_name(); string name = _egg_joint->get_name();
@ -322,9 +332,11 @@ void MayaEggJoint::ChooseEndPos(double thickness)
void MayaEggJoint::CreateMayaBone(CoordinateSystem sys) void MayaEggJoint::CreateMayaBone(CoordinateSystem sys)
{ {
MFloatPoint xv(ConvertCoordSys(sys, GetXV())); LVector3d rxv, ryv, rzv;
MFloatPoint yv(ConvertCoordSys(sys, GetYV())); GetRotation(rxv, ryv, rzv);
MFloatPoint zv(ConvertCoordSys(sys, GetZV())); MFloatPoint xv(ConvertCoordSys(sys, rxv));
MFloatPoint yv(ConvertCoordSys(sys, ryv));
MFloatPoint zv(ConvertCoordSys(sys, rzv));
MFloatPoint pos(ConvertCoordSys(sys, GetPos())); MFloatPoint pos(ConvertCoordSys(sys, GetPos()));
MFloatPoint endpos(ConvertCoordSys(sys, _endpos)); MFloatPoint endpos(ConvertCoordSys(sys, _endpos));
MFloatPoint tzv(ConvertCoordSys(sys, _perp)); MFloatPoint tzv(ConvertCoordSys(sys, _perp));