Explorar el Código

*** empty log message ***

Josh Yelon hace 20 años
padre
commit
879261500c

+ 2 - 0
direct/src/directscripts/packpanda.nsi

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

+ 76 - 34
direct/src/directscripts/packpanda.py

@@ -17,9 +17,11 @@ import sys,os,getopt,string,shutil,py_compile
 OPTIONLIST = [
 ("game",      1, "Name of directory containing game"),
 ("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"),
-("cplegg",    0, "Convert all EGG files to BAM"),
-("cplpy",     0, "Convert all PY files to PYC"),
+("bam",       0, "Generate BAM files"),
+("pyc",       0, "Generate PYC files"),
 ]
 
 def ParseFailure():
@@ -38,15 +40,21 @@ def ParseOptions(args):
     options = {}
     longopts = []
     for (opt, hasval, explanation) in OPTIONLIST:
-      if (hasval): longopts.append(opt+"=")
-      else: longopts.append(opt)
-      options[opt] = 0
-      if (hasval): options[opt]=""
+      if (hasval==2):
+        longopts.append(opt+"=")
+        options[opt] = []
+      elif (hasval==1):
+        longopts.append(opt+"=")
+        options[opt] = ""
+      else:
+        longopts.append(opt)
+        options[opt] = 0
     opts, extras = getopt.getopt(args, "", longopts)
     for option,value in opts:
       for (opt, hasval, explanation) in OPTIONLIST:
         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
     return options
   except: ParseFailure();
@@ -88,8 +96,6 @@ GAME=os.path.abspath(GAME)
 NAME=os.path.basename(GAME)
 SMDIRECTORY=os.path.basename(GAME)
 if (VER!=""): SMDIRECTORY=SMDIRECTORY+" "+VER
-if (OPTIONS["cplpy"]): MAIN=NAME+".pyc"
-else: MAIN=NAME+".py"
 ICON=os.path.join(GAME,NAME+".ico")
 BITMAP=os.path.join(GAME,NAME+".bmp")
 LICENSE=os.path.join(GAME,"LICENSE.TXT")
@@ -100,6 +106,8 @@ INSTALLDIR='C:\\'+os.path.basename(GAME)
 if (VER!=""): INSTALLDIR=INSTALLDIR+"-"+VER
 COMPRESS="lzma"
 if (OPTIONS["fast"]): COMPRESS="zlib"
+if (OPTIONS["pyc"]): MAIN=NAME+".pyc"
+else: MAIN=NAME+".py"
 
 def PrintFileStatus(label, 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")
 
 def egg2bam(file):
-    orig = os.getcwd()
-    dir = os.path.dirname(file)
-    base = os.path.basename(file)
-    pre = base[:-4]
-    cmd = 'egg2bam -noabs "'+base+'" -o "'+pre+'.bam"'
+    bam = file[:-4]+'.bam'
+    present = os.path.exists(bam)
+    if (present): bam = "packpanda-TMP.bam";
+    cmd = 'egg2bam -noabs -ps rel -pd . "'+file+'" -o "'+bam+'"'
     print "Executing: "+cmd
-    os.chdir(dir)
     res = os.spawnl(os.P_WAIT, EGG2BAM, cmd)
-    if (res != 0): sys.exit("Cannot convert egg to bam")
-    os.chdir(orig)
-    os.unlink(file)
+    if (res != 0): sys.exit("Problem in egg file: "+file)
+    if (present) or (OPTIONS["bam"]==0):
+        os.unlink(bam)
 
 def py2pyc(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)
     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):
     if (os.path.isfile(file)):
-        if OPTIONS["cplegg"] and (string.lower(file[-4:])==".egg"):
+        if (string.lower(file[-4:])==".egg"):
             egg2bam(file)
-        elif OPTIONS["cplpy"] and (string.lower(file[-3:])==".py"):
+        elif (string.lower(file[-3:])==".py"):
             py2pyc(file)
         else: pass
     elif (os.path.isdir(file)):
         for x in os.listdir(file):
             CompileFiles(os.path.join(file,x))
 
-if (OPTIONS["cplpy"] or OPTIONS["cplegg"]):
-    TMPDIR=os.path.abspath("packpanda-TMP")
-    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)
-    print "Searching for files to compile in "+TMPDIR+"..."
-    CompileFiles(TMPDIR)
-else:
-    TMPDIR=GAME
+def DeleteFiles(file):
+    base = string.lower(os.path.basename(file))
+    if (os.path.isdir(file)):
+        for pattern in OPTIONS["rmdir"]:
+            if (string.lower(pattern) == base):
+                print "Deleting "+file
+                shutil.rmtree(file)
+                return
+        for x in os.listdir(file):
+            DeleteFiles(os.path.join(file,x))
+    else:
+        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(".")
 
 ##############################################################################
 #

+ 1 - 1
direct/src/extensions/SpriteParticleRenderer-extensions.py

@@ -16,7 +16,7 @@
     def getSourceTextureName(self):
         if self.sourceTextureName == None:
             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 self.sourceTextureName
 

+ 1 - 1
direct/src/showbase/Audio3DManager.py

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

+ 18 - 10
doc/makepanda/makepanda.py

@@ -4704,18 +4704,26 @@ def MakeInstallerNSIS(file,fullname,smdirectory,installdir):
             os.remove(file)
         if (os.path.exists("nsis-output.exe")):
             os.remove("nsis-output.exe")
-        def0 = '/DCOMPRESSOR="'   + COMPRESSOR   + '" '
-        def1 = '/DFULLNAME="'     + fullname     + '" '
-        def2 = '/DSMDIRECTORY="'  + smdirectory  + '" '
-        def3 = '/DINSTALLDIR="'   + installdir   + '" '
-        def4 = '/DPANDA="..\\..\\..\\'    + PREFIX       + '" '
-        def5 = '/DPSOURCE="..\\..\\.." '
-        def6 = '/DPYEXTRAS="..\\..\\..\\thirdparty\\win-extras" '
-        def7 = '/DOUTFILE="..\\..\\..\\nsis-output.exe" '
-        oscmd("thirdparty/win-nsis/makensis.exe /V2 "+def0+def1+def2+def3+def4+def5+def6+def7+" direct/src/directscripts/packpanda.nsi")
+        psource=os.path.abspath(".")
+        panda=os.path.abspath(PREFIX)
+        cmd="thirdparty/win-nsis/makensis.exe /V2 "
+        cmd=cmd+'/DCOMPRESSOR="'+COMPRESSOR+'" '
+        cmd=cmd+'/DNAME="'+fullname+'" '
+        cmd=cmd+'/DSMDIRECTORY="'+smdirectory+'" '
+        cmd=cmd+'/DINSTALLDIR="'+installdir+'" '
+        cmd=cmd+'/DOUTFILE="'+psource+'\\nsis-output.exe" '
+        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)
 
-
 def MakeInstallerDPKG(file):
     if (older(file,ALLTARGETS)):
         DEB="""

+ 1 - 1
doc/makepanda/makepanda71.vcproj

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

+ 6 - 2
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -387,7 +387,9 @@ read_args() {
     char buffer[buffer_size];
     DWORD size = GetModuleFileName(dllhandle, buffer, buffer_size);
     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
@@ -414,7 +416,9 @@ read_args() {
   char buffer[buffer_size];
   DWORD size = GetModuleFileName(NULL, buffer, buffer_size);
   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
 

+ 6 - 4
dtool/src/dtoolutil/executionEnvironment.h

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

+ 18 - 6
pandatool/src/maxeggimport/maxEggLoader.cxx

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

+ 18 - 6
pandatool/src/mayaeggimport/mayaEggLoader.cxx

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