From afd7fc8a2530278944cd9c030f17f47b78fea83b Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Dec 2019 17:15:07 +0100 Subject: [PATCH 01/12] dxgsg9: don't try to Release() vertex buffer if it failed to create --- panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index ca3fb07d79..bd36f99da3 100644 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -615,8 +615,10 @@ release_vertex_buffer(VertexBufferContext *vbc) { } #endif - dvbc->_vbuffer->Release(); - dvbc->_vbuffer = nullptr; + if (dvbc->_vbuffer != nullptr) { + dvbc->_vbuffer->Release(); + dvbc->_vbuffer = nullptr; + } delete dvbc; } From c02bbe50afd97c46e87b666e9ae1e223f5da9b2f Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Dec 2019 17:15:34 +0100 Subject: [PATCH 02/12] p3d: add deprecation notice to all direct.p3d modules --- direct/src/p3d/DWBPackageInstaller.py | 5 +++++ direct/src/p3d/FileSpec.py | 5 +++++ direct/src/p3d/HostInfo.py | 5 +++++ direct/src/p3d/InstalledHostData.py | 5 +++++ direct/src/p3d/InstalledPackageData.py | 5 +++++ direct/src/p3d/PackageInfo.py | 5 +++++ direct/src/p3d/PackageInstaller.py | 5 +++++ direct/src/p3d/PackageMerger.py | 5 +++++ direct/src/p3d/PatchMaker.py | 5 +++++ direct/src/p3d/ScanDirectoryNode.py | 5 +++++ direct/src/p3d/SeqValue.py | 5 +++++ 11 files changed, 55 insertions(+) diff --git a/direct/src/p3d/DWBPackageInstaller.py b/direct/src/p3d/DWBPackageInstaller.py index c4daa67cb1..3f9aab4c77 100644 --- a/direct/src/p3d/DWBPackageInstaller.py +++ b/direct/src/p3d/DWBPackageInstaller.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["DWBPackageInstaller"] from direct.p3d.PackageInstaller import PackageInstaller diff --git a/direct/src/p3d/FileSpec.py b/direct/src/p3d/FileSpec.py index ddd1dafd6e..c709426e37 100644 --- a/direct/src/p3d/FileSpec.py +++ b/direct/src/p3d/FileSpec.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["FileSpec"] import os diff --git a/direct/src/p3d/HostInfo.py b/direct/src/p3d/HostInfo.py index 4e5efdcd3e..08b2081497 100644 --- a/direct/src/p3d/HostInfo.py +++ b/direct/src/p3d/HostInfo.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["HostInfo"] from panda3d.core import HashVal, Filename, PandaSystem, DocumentSpec, Ramfile diff --git a/direct/src/p3d/InstalledHostData.py b/direct/src/p3d/InstalledHostData.py index d98abb6d18..1a8a0f9dba 100644 --- a/direct/src/p3d/InstalledHostData.py +++ b/direct/src/p3d/InstalledHostData.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["InstalledHostData"] from panda3d.core import URLSpec diff --git a/direct/src/p3d/InstalledPackageData.py b/direct/src/p3d/InstalledPackageData.py index 09ee81cda6..34af2163e3 100644 --- a/direct/src/p3d/InstalledPackageData.py +++ b/direct/src/p3d/InstalledPackageData.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["InstalledPackageData"] class InstalledPackageData: diff --git a/direct/src/p3d/PackageInfo.py b/direct/src/p3d/PackageInfo.py index 08a73365b8..324a87546d 100644 --- a/direct/src/p3d/PackageInfo.py +++ b/direct/src/p3d/PackageInfo.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["PackageInfo"] from panda3d.core import Filename, DocumentSpec, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, ExecutionEnvironment, PStatCollector, TiXmlDocument, TiXmlDeclaration, TiXmlElement diff --git a/direct/src/p3d/PackageInstaller.py b/direct/src/p3d/PackageInstaller.py index cec1e07b11..3f17604071 100644 --- a/direct/src/p3d/PackageInstaller.py +++ b/direct/src/p3d/PackageInstaller.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["PackageInstaller"] from direct.showbase.DirectObject import DirectObject diff --git a/direct/src/p3d/PackageMerger.py b/direct/src/p3d/PackageMerger.py index a22d8f5f2d..ac4b614732 100644 --- a/direct/src/p3d/PackageMerger.py +++ b/direct/src/p3d/PackageMerger.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["PackageMerger", "PackageMergerError"] from direct.p3d.FileSpec import FileSpec diff --git a/direct/src/p3d/PatchMaker.py b/direct/src/p3d/PatchMaker.py index c1624b3cc1..6c50df2e0c 100644 --- a/direct/src/p3d/PatchMaker.py +++ b/direct/src/p3d/PatchMaker.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["PatchMaker"] from direct.p3d.FileSpec import FileSpec diff --git a/direct/src/p3d/ScanDirectoryNode.py b/direct/src/p3d/ScanDirectoryNode.py index 429b8f0fd2..c38431101d 100644 --- a/direct/src/p3d/ScanDirectoryNode.py +++ b/direct/src/p3d/ScanDirectoryNode.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["ScanDirectoryNode"] from panda3d.core import VirtualFileSystem, VirtualFileMountSystem, Filename, TiXmlDocument diff --git a/direct/src/p3d/SeqValue.py b/direct/src/p3d/SeqValue.py index 958132f74b..2fa01ace34 100644 --- a/direct/src/p3d/SeqValue.py +++ b/direct/src/p3d/SeqValue.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["SeqValue"] class SeqValue: From 2b9cc61d0428bd4ce79eabf0a189ec10596662e7 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Jan 2020 00:36:29 +0100 Subject: [PATCH 03/12] grutil: fix wrong method name in LineSegs docstrings --- panda/src/grutil/lineSegs.I | 2 +- panda/src/grutil/lineSegs.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/grutil/lineSegs.I b/panda/src/grutil/lineSegs.I index 5236f13b74..5a7b533e1d 100644 --- a/panda/src/grutil/lineSegs.I +++ b/panda/src/grutil/lineSegs.I @@ -99,7 +99,7 @@ draw_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { * Creates a new GeomNode that will render the series of line segments and * points described via calls to move_to() and draw_to(). The lines and * points are created with the color and thickness established by calls to - * set_color() and set_thick(). + * set_color() and set_thickness(). * * If dynamic is true, the line segments will be created with the dynamic Geom * setting, optimizing them for runtime vertex animation. diff --git a/panda/src/grutil/lineSegs.cxx b/panda/src/grutil/lineSegs.cxx index 534c1f5700..bdf7912d7e 100644 --- a/panda/src/grutil/lineSegs.cxx +++ b/panda/src/grutil/lineSegs.cxx @@ -164,7 +164,7 @@ get_current_position() { * Appends to an existing GeomNode a new Geom that will render the series of * line segments and points described via calls to move_to() and draw_to(). * The lines and points are created with the color and thickness established - * by calls to set_color() and set_thick(). + * by calls to set_color() and set_thickness(). * * If dynamic is true, the line segments will be created with the dynamic Geom * setting, optimizing them for runtime vertex animation. From 7ca66bfe6f1634abc3f73d843e3318f98d09e278 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Jan 2020 01:06:03 +0100 Subject: [PATCH 04/12] tkpanels: work around tkinter bug cancelling file open dialog on macOS Fixes #811 --- direct/src/tkpanels/AnimPanel.py | 2 +- direct/src/tkpanels/MopathRecorder.py | 2 +- direct/src/tkpanels/ParticlePanel.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/direct/src/tkpanels/AnimPanel.py b/direct/src/tkpanels/AnimPanel.py index a8348c299d..ca5cbe0d25 100644 --- a/direct/src/tkpanels/AnimPanel.py +++ b/direct/src/tkpanels/AnimPanel.py @@ -276,7 +276,7 @@ class AnimPanel(AppShell): title = 'Load Animation', parent = self.component('hull') ) - if not animFilename: + if not animFilename and animFilename != 'None': # no file selected, canceled return diff --git a/direct/src/tkpanels/MopathRecorder.py b/direct/src/tkpanels/MopathRecorder.py index 8ff2341865..1cf65cd0aa 100644 --- a/direct/src/tkpanels/MopathRecorder.py +++ b/direct/src/tkpanels/MopathRecorder.py @@ -1638,7 +1638,7 @@ class MopathRecorder(AppShell, DirectObject): initialdir = path, title = 'Load Nurbs Curve', parent = self.parent) - if mopathFilename: + if mopathFilename and mopathFilename != 'None': self.reset() nodePath = loader.loadModel( Filename.fromOsSpecific(mopathFilename)) diff --git a/direct/src/tkpanels/ParticlePanel.py b/direct/src/tkpanels/ParticlePanel.py index b7a632f61a..d82677b5e5 100644 --- a/direct/src/tkpanels/ParticlePanel.py +++ b/direct/src/tkpanels/ParticlePanel.py @@ -1272,7 +1272,7 @@ class ParticlePanel(AppShell): initialdir = path, title = 'Load Particle Effect', parent = self.parent) - if particleFilename: + if particleFilename and particleFilename != 'None': # Delete existing particles and forces self.particleEffect.loadConfig( Filename.fromOsSpecific(particleFilename)) From 438130a157cc393e898c6d2175c91ab24cb9fe27 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Jan 2020 01:10:10 +0100 Subject: [PATCH 05/12] readme: update build instructions for Windows --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d2c4f3fe4f..375982711e 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,11 @@ Building Panda3D Windows ------- -You can build Panda3D with the Microsoft Visual C++ 2015 or 2017 compiler, +You can build Panda3D with the Microsoft Visual C++ 2015, 2017 or 2019 compiler, which can be downloaded for free from the [Visual Studio site](https://visualstudio.microsoft.com/downloads/). You will also need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk), -and if you intend to target Windows XP, you will also need the -[Windows 7.1 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=8279). +and if you intend to target Windows XP, you will also need the Windows 7.1A +SDK (which can be installed from the Visual Studio Installer). You will also need to have the third-party dependency libraries available for the build scripts to use. These are available from one of these two URLs, @@ -64,16 +64,17 @@ depending on whether you are on a 32-bit or 64-bit system, or you can [click here](https://github.com/rdb/panda3d-thirdparty) for instructions on building them from source. -https://www.panda3d.org/download/panda3d-1.10.4.1/panda3d-1.10.4.1-tools-win64.zip -https://www.panda3d.org/download/panda3d-1.10.4.1/panda3d-1.10.4.1-tools-win32.zip +- https://www.panda3d.org/download/panda3d-1.10.5/panda3d-1.10.5-tools-win64.zip +- https://www.panda3d.org/download/panda3d-1.10.5/panda3d-1.10.5-tools-win32.zip -After acquiring these dependencies, you may simply build Panda3D from the -command prompt using the following command. (Change `14.1` to `14` if you are -using Visual C++ 2015 instead of 2017. Add the `--windows-sdk=10` option if -you don't need to support Windows XP and did not install the Windows 7.1 SDK.) +After acquiring these dependencies, you can build Panda3D from the command +prompt using the following command. Change the `--msvc-version` option based +on your version of Visual C++; 2019 is 14.2, 2017 is 14.1, and 2015 is 14. +Remove the `--windows-sdk=10` option if you need to support Windows XP, which +requires the Windows 7.1A SDK. ```bash -makepanda\makepanda.bat --everything --installer --msvc-version=14.1 --no-eigen --threads=2 +makepanda\makepanda.bat --everything --installer --msvc-version=14.2 --windows-sdk=10 --no-eigen --threads=2 ``` When the build succeeds, it will produce an .exe file that you can use to From 3367fe266f2ccb1495f8e2e90c9bc1c5dcc29751 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 18:19:39 +0100 Subject: [PATCH 06/12] tkpanels: properly test "None" return from askopenfilename --- direct/src/tkpanels/AnimPanel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direct/src/tkpanels/AnimPanel.py b/direct/src/tkpanels/AnimPanel.py index ca5cbe0d25..12bc1feefd 100644 --- a/direct/src/tkpanels/AnimPanel.py +++ b/direct/src/tkpanels/AnimPanel.py @@ -276,7 +276,7 @@ class AnimPanel(AppShell): title = 'Load Animation', parent = self.component('hull') ) - if not animFilename and animFilename != 'None': + if not animFilename or animFilename == 'None': # no file selected, canceled return From fe1ecd5e791dd98bf96009b216c3d0960d99ea56 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 18:48:23 +0100 Subject: [PATCH 07/12] pgraph: fix ShaderInput ordering for vector inputs with small floats Fixes #827 --- panda/src/pgraph/shaderInput.I | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index b8e182421f..d0a0e79fbb 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -490,7 +490,19 @@ operator < (const ShaderInput &other) const { return false; case M_vector: - return _stored_vector < other._stored_vector; + if (_stored_vector[0] != other._stored_vector[0]) { + return (_stored_vector[0] < other._stored_vector[0]) ? -1 : 1; + } + if (_stored_vector[1] != other._stored_vector[1]) { + return (_stored_vector[1] < other._stored_vector[1]) ? -1 : 1; + } + if (_stored_vector[2] != other._stored_vector[2]) { + return (_stored_vector[2] < other._stored_vector[2]) ? -1 : 1; + } + if (_stored_vector[3] != other._stored_vector[3]) { + return (_stored_vector[3] < other._stored_vector[3]) ? -1 : 1; + } + return 0; case M_numeric: return _stored_ptr._ptr < other._stored_ptr._ptr; From b60c3e6c7e9e045b4b6aa7eca7374e1ab9ec5efc Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 18:52:55 +0100 Subject: [PATCH 08/12] tests: add unit tests for ShaderInput comparison (#827) --- tests/pgraph/test_shaderinput.py | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/pgraph/test_shaderinput.py diff --git a/tests/pgraph/test_shaderinput.py b/tests/pgraph/test_shaderinput.py new file mode 100644 index 0000000000..d046394dcd --- /dev/null +++ b/tests/pgraph/test_shaderinput.py @@ -0,0 +1,44 @@ +from panda3d.core import ShaderInput, Vec4 + + +def test_shaderinput_vector_compare(): + i0 = ShaderInput('a', Vec4(0, 0, 0, 0)) + i1 = ShaderInput('a', Vec4(1e-9, 0, 0, 0)) + i2 = ShaderInput('a', Vec4(1e-8, 0, 0, 0)) + i3 = ShaderInput('a', Vec4(2, 0, 0, 0)) + + assert i0 == i0 + assert i1 == i1 + assert i2 == i2 + assert i3 == i3 + + assert i0 != i1 + assert i0 != i2 + assert i0 != i3 + assert i1 != i2 + assert i2 != i3 + assert i1 != i3 + + assert not i0 < i0 + assert not i1 < i1 + assert not i2 < i2 + assert not i3 < i3 + + assert i0 < i1 + assert i0 < i2 + assert i0 < i3 + assert i1 < i2 + assert i2 < i3 + assert i1 < i3 + + assert not i0 > i0 + assert not i1 > i1 + assert not i2 > i2 + assert not i3 > i3 + + assert i3 > i1 + assert i2 > i1 + assert i3 > i2 + assert i1 > i0 + assert i2 > i0 + assert i3 > i0 From 135931c9260e7dbbceb7385a65130a2189f374d5 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 22:00:09 +0100 Subject: [PATCH 09/12] pgraph: fix faulty comparison code of ShaderInput vectors --- panda/src/pgraph/shaderInput.I | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index d0a0e79fbb..a7318cdc2b 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -491,16 +491,16 @@ operator < (const ShaderInput &other) const { case M_vector: if (_stored_vector[0] != other._stored_vector[0]) { - return (_stored_vector[0] < other._stored_vector[0]) ? -1 : 1; + return _stored_vector[0] < other._stored_vector[0]; } if (_stored_vector[1] != other._stored_vector[1]) { - return (_stored_vector[1] < other._stored_vector[1]) ? -1 : 1; + return _stored_vector[1] < other._stored_vector[1]; } if (_stored_vector[2] != other._stored_vector[2]) { - return (_stored_vector[2] < other._stored_vector[2]) ? -1 : 1; + return _stored_vector[2] < other._stored_vector[2]; } if (_stored_vector[3] != other._stored_vector[3]) { - return (_stored_vector[3] < other._stored_vector[3]) ? -1 : 1; + return _stored_vector[3] < other._stored_vector[3]; } return 0; From cef70a4fe5ac73c7088cdf2ccabee77fca0b035b Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 01:20:18 +0100 Subject: [PATCH 10/12] tests: remove __gt__ asserts from test_shaderinput_vector_compare This fails in Python 2, and we don't actually provide this operator or make any guarantees about greater-than ordering, so it was silly to test for it to begin with. --- tests/pgraph/test_shaderinput.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/pgraph/test_shaderinput.py b/tests/pgraph/test_shaderinput.py index d046394dcd..68bb6b2e24 100644 --- a/tests/pgraph/test_shaderinput.py +++ b/tests/pgraph/test_shaderinput.py @@ -30,15 +30,3 @@ def test_shaderinput_vector_compare(): assert i1 < i2 assert i2 < i3 assert i1 < i3 - - assert not i0 > i0 - assert not i1 > i1 - assert not i2 > i2 - assert not i3 > i3 - - assert i3 > i1 - assert i2 > i1 - assert i3 > i2 - assert i1 > i0 - assert i2 > i0 - assert i3 > i0 From 24783924d0116fc836a796b0a3aa09cd00121b1e Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 01:21:22 +0100 Subject: [PATCH 11/12] pgraph: fix int return from bool method --- panda/src/pgraph/shaderInput.I | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index a7318cdc2b..2ace5d614b 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -502,7 +502,7 @@ operator < (const ShaderInput &other) const { if (_stored_vector[3] != other._stored_vector[3]) { return _stored_vector[3] < other._stored_vector[3]; } - return 0; + return false; case M_numeric: return _stored_ptr._ptr < other._stored_ptr._ptr; From 0e1b5248858be6f2edf62ee6284581447feecb68 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 01:07:48 +0100 Subject: [PATCH 12/12] gobj: fix Material ambient/diffuse/specular when reading from bam Fixes #828 --- panda/src/gobj/material.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/gobj/material.cxx b/panda/src/gobj/material.cxx index 091c7eff2f..a87c978c1c 100644 --- a/panda/src/gobj/material.cxx +++ b/panda/src/gobj/material.cxx @@ -544,6 +544,11 @@ fillin(DatagramIterator &scan, BamReader *manager) { } _refractive_index = scan.get_stdfloat(); + if ((_flags & (F_base_color | F_metallic)) == (F_base_color | F_metallic)) { + // Compute the ambient, diffuse and specular settings. + set_base_color(_base_color); + } + } else { _ambient.read_datagram(scan); _diffuse.read_datagram(scan);