浏览代码

Merge branch 'release/1.10.x'

rdb 1 年之前
父节点
当前提交
55fa0e9912

+ 28 - 3
direct/src/dist/commands.py

@@ -75,6 +75,7 @@ def _model_to_bam(_build_cmd, srcpath, dstpath):
 
 
     src_fn = p3d.Filename.from_os_specific(srcpath)
     src_fn = p3d.Filename.from_os_specific(srcpath)
     dst_fn = p3d.Filename.from_os_specific(dstpath)
     dst_fn = p3d.Filename.from_os_specific(dstpath)
+    dst_fn.set_binary()
 
 
     _register_python_loaders()
     _register_python_loaders()
 
 
@@ -85,8 +86,30 @@ def _model_to_bam(_build_cmd, srcpath, dstpath):
     if not node:
     if not node:
         raise IOError('Failed to load model: %s' % (srcpath))
         raise IOError('Failed to load model: %s' % (srcpath))
 
 
-    if not p3d.NodePath(node).write_bam_file(dst_fn):
-        raise IOError('Failed to write .bam file: %s' % (dstpath))
+    stream = p3d.OFileStream()
+    if not dst_fn.open_write(stream):
+        raise IOError('Failed to open .bam file for writing: %s' % (dstpath))
+
+    # We pass it the source filename here so that texture files are made
+    # relative to the original pathname and don't point from the destination
+    # back into the source directory.
+    dout = p3d.DatagramOutputFile()
+    if not dout.open(stream, src_fn) or not dout.write_header("pbj\0\n\r"):
+        raise IOError('Failed to write to .bam file: %s' % (dstpath))
+
+    writer = p3d.BamWriter(dout)
+    writer.root_node = node
+    writer.init()
+    if _build_cmd.bam_embed_textures:
+        writer.set_file_texture_mode(p3d.BamEnums.BTM_rawdata)
+    else:
+        writer.set_file_texture_mode(p3d.BamEnums.BTM_relative)
+    writer.write_object(node)
+    writer.flush()
+    writer = None
+    dout.close()
+    dout = None
+    stream.close()
 
 
 
 
 macosx_binary_magics = (
 macosx_binary_magics = (
@@ -312,6 +335,7 @@ class build_apps(setuptools.Command):
         ]
         ]
         self.file_handlers = {}
         self.file_handlers = {}
         self.bam_model_extensions = ['.egg', '.gltf', '.glb']
         self.bam_model_extensions = ['.egg', '.gltf', '.glb']
+        self.bam_embed_textures = False
         self.exclude_dependencies = [
         self.exclude_dependencies = [
             # Windows
             # Windows
             'kernel32.dll', 'user32.dll', 'wsock32.dll', 'ws2_32.dll',
             'kernel32.dll', 'user32.dll', 'wsock32.dll', 'ws2_32.dll',
@@ -326,7 +350,8 @@ class build_apps(setuptools.Command):
 
 
             # manylinux1/linux
             # manylinux1/linux
             'libdl.so.*', 'libstdc++.so.*', 'libm.so.*', 'libgcc_s.so.*',
             'libdl.so.*', 'libstdc++.so.*', 'libm.so.*', 'libgcc_s.so.*',
-            'libpthread.so.*', 'libc.so.*', 'ld-linux-x86-64.so.*',
+            'libpthread.so.*', 'libc.so.*',
+            'ld-linux-x86-64.so.*', 'ld-linux-aarch64.so.*',
             'libgl.so.*', 'libx11.so.*', 'libncursesw.so.*', 'libz.so.*',
             'libgl.so.*', 'libx11.so.*', 'libncursesw.so.*', 'libz.so.*',
             'librt.so.*', 'libutil.so.*', 'libnsl.so.1', 'libXext.so.6',
             'librt.so.*', 'libutil.so.*', 'libnsl.so.1', 'libXext.so.6',
             'libXrender.so.1', 'libICE.so.6', 'libSM.so.6', 'libEGL.so.1',
             'libXrender.so.1', 'libICE.so.6', 'libSM.so.6', 'libEGL.so.1',

+ 7 - 2
makepanda/makewheel.py

@@ -725,11 +725,16 @@ def makewheel(version, output_dir, platform=None):
         whl.ignore_deps.update(MANYLINUX_LIBS)
         whl.ignore_deps.update(MANYLINUX_LIBS)
 
 
     # Add libpython for deployment.
     # Add libpython for deployment.
+    suffix = ''
+    gil_disabled = get_config_var("Py_GIL_DISABLED")
+    if gil_disabled and int(gil_disabled):
+        suffix = 't'
+
     if is_windows:
     if is_windows:
-        pylib_name = 'python{0}{1}.dll'.format(*sys.version_info)
+        pylib_name = 'python{0}{1}{2}.dll'.format(sys.version_info[0], sys.version_info[1], suffix)
         pylib_path = os.path.join(get_config_var('BINDIR'), pylib_name)
         pylib_path = os.path.join(get_config_var('BINDIR'), pylib_name)
     elif is_macosx:
     elif is_macosx:
-        pylib_name = 'libpython{0}.{1}.dylib'.format(*sys.version_info)
+        pylib_name = 'libpython{0}.{1}{2}.dylib'.format(sys.version_info[0], sys.version_info[1], suffix)
         pylib_path = os.path.join(get_config_var('LIBDIR'), pylib_name)
         pylib_path = os.path.join(get_config_var('LIBDIR'), pylib_name)
     else:
     else:
         pylib_name = get_config_var('LDLIBRARY')
         pylib_name = get_config_var('LDLIBRARY')

+ 6 - 2
makepanda/test_wheel.py

@@ -14,7 +14,7 @@ import tempfile
 from optparse import OptionParser
 from optparse import OptionParser
 
 
 
 
-def test_wheel(wheel, verbose=False):
+def test_wheel(wheel, verbose=False, ignores=[]):
     envdir = tempfile.mkdtemp(prefix="venv-")
     envdir = tempfile.mkdtemp(prefix="venv-")
     print("Setting up virtual environment in {0}".format(envdir))
     print("Setting up virtual environment in {0}".format(envdir))
     sys.stdout.flush()
     sys.stdout.flush()
@@ -61,6 +61,9 @@ def test_wheel(wheel, verbose=False):
     test_cmd = [python, "-m", "pytest", "tests"]
     test_cmd = [python, "-m", "pytest", "tests"]
     if verbose:
     if verbose:
         test_cmd.append("--verbose")
         test_cmd.append("--verbose")
+    for ignore in ignores:
+        test_cmd.append("--ignore")
+        test_cmd.append(ignore)
 
 
     # Put the location of the python DLL on the path, for deploy-stub test
     # Put the location of the python DLL on the path, for deploy-stub test
     # This is needed because venv does not install a copy of the python DLL
     # This is needed because venv does not install a copy of the python DLL
@@ -87,6 +90,7 @@ def test_wheel(wheel, verbose=False):
 if __name__ == "__main__":
 if __name__ == "__main__":
     parser = OptionParser(usage="%prog [options] file...")
     parser = OptionParser(usage="%prog [options] file...")
     parser.add_option('', '--verbose', dest = 'verbose', help = 'Enable verbose output', action = 'store_true', default = False)
     parser.add_option('', '--verbose', dest = 'verbose', help = 'Enable verbose output', action = 'store_true', default = False)
+    parser.add_option('', '--ignore', dest = 'ignores', help = 'Ignores given test directory (may be repeated)', action = 'append', default = [])
     (options, args) = parser.parse_args()
     (options, args) = parser.parse_args()
 
 
     if not args:
     if not args:
@@ -94,4 +98,4 @@ if __name__ == "__main__":
         sys.exit(1)
         sys.exit(1)
 
 
     for arg in args:
     for arg in args:
-        test_wheel(arg, verbose=options.verbose)
+        test_wheel(arg, verbose=options.verbose, ignores=options.ignores)

+ 9 - 7
panda/src/gobj/texture.cxx

@@ -10183,13 +10183,15 @@ do_write_datagram_header(CData *cdata, BamWriter *manager, Datagram &me, bool &h
         << "Texture file " << cdata->_fullpath
         << "Texture file " << cdata->_fullpath
         << " found as " << filename << "\n";
         << " found as " << filename << "\n";
     }
     }
-    if (!has_bam_dir || !alpha_filename.make_relative_to(bam_dir, true)) {
-      alpha_filename.find_on_searchpath(get_model_path());
-    }
-    if (gobj_cat.is_debug()) {
-      gobj_cat.debug()
-        << "Alpha image " << cdata->_alpha_fullpath
-        << " found as " << alpha_filename << "\n";
+    if (!alpha_filename.empty()) {
+      if (!has_bam_dir || !alpha_filename.make_relative_to(bam_dir, true)) {
+        alpha_filename.find_on_searchpath(get_model_path());
+      }
+      if (gobj_cat.is_debug()) {
+        gobj_cat.debug()
+          << "Alpha image " << cdata->_alpha_fullpath
+          << " found as " << alpha_filename << "\n";
+      }
     }
     }
     break;
     break;
 
 

+ 3 - 0
panda/src/putil/bamWriter.I

@@ -96,6 +96,9 @@ get_file_texture_mode() const {
  * Changes the BamTextureMode preference for the Bam file currently being
  * Changes the BamTextureMode preference for the Bam file currently being
  * written.  Texture objects written to this Bam file will be encoded
  * written.  Texture objects written to this Bam file will be encoded
  * according to the specified mode.
  * according to the specified mode.
+ *
+ * This should be called after the call to init(), or it will be overwritten
+ * with the default mode in the config file.
  */
  */
 INLINE void BamWriter::
 INLINE void BamWriter::
 set_file_texture_mode(BamTextureMode file_texture_mode) {
 set_file_texture_mode(BamTextureMode file_texture_mode) {

+ 2 - 2
panda/src/putil/bamWriter.h

@@ -96,7 +96,7 @@ PUBLISHED:
   MAKE_PROPERTY(file_version, get_file_version);
   MAKE_PROPERTY(file_version, get_file_version);
   MAKE_PROPERTY(file_endian, get_file_endian);
   MAKE_PROPERTY(file_endian, get_file_endian);
   MAKE_PROPERTY(file_stdfloat_double, get_file_stdfloat_double);
   MAKE_PROPERTY(file_stdfloat_double, get_file_stdfloat_double);
-  MAKE_PROPERTY(file_texture_mode, get_file_texture_mode);
+  MAKE_PROPERTY(file_texture_mode, get_file_texture_mode, set_file_texture_mode);
   MAKE_PROPERTY(root_node, get_root_node, set_root_node);
   MAKE_PROPERTY(root_node, get_root_node, set_root_node);
 
 
 public:
 public:
@@ -135,7 +135,7 @@ private:
   // Stores the PandaNode representing the root of the node hierarchy we are
   // Stores the PandaNode representing the root of the node hierarchy we are
   // currently writing, if any, for the purpose of writing NodePaths.  This is
   // currently writing, if any, for the purpose of writing NodePaths.  This is
   // a TypedWritable since PandaNode is defined in pgraph.
   // a TypedWritable since PandaNode is defined in pgraph.
-  TypedWritable *_root_node;
+  TypedWritable *_root_node = nullptr;
 
 
   // This is the set of all TypeHandles already written.
   // This is the set of all TypeHandles already written.
   pset<int, int_hash> _types_written;
   pset<int, int_hash> _types_written;