Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2022-01-04 16:31:40 +01:00
commit d46651c032
12 changed files with 105 additions and 84 deletions

View File

@ -347,16 +347,16 @@ jobs:
shell: powershell
run: |
$wc = New-Object System.Net.WebClient
$wc.DownloadFile("https://www.panda3d.org/download/panda3d-1.10.10/panda3d-1.10.10-tools-win64.zip", "thirdparty-tools.zip")
$wc.DownloadFile("https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-win64.zip", "thirdparty-tools.zip")
Expand-Archive -Path thirdparty-tools.zip
Move-Item -Path thirdparty-tools/panda3d-1.10.10/thirdparty -Destination .
Move-Item -Path thirdparty-tools/panda3d-1.10.11/thirdparty -Destination .
- name: Get thirdparty packages (macOS)
if: runner.os == 'macOS'
run: |
curl -O https://www.panda3d.org/download/panda3d-1.10.10/panda3d-1.10.10-tools-mac.tar.gz
tar -xf panda3d-1.10.10-tools-mac.tar.gz
mv panda3d-1.10.10/thirdparty thirdparty
rmdir panda3d-1.10.10
curl -O https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-mac.tar.gz
tar -xf panda3d-1.10.11-tools-mac.tar.gz
mv panda3d-1.10.11/thirdparty thirdparty
rmdir panda3d-1.10.11
(cd thirdparty/darwin-libs-a && rm -rf rocket)
- name: Set up Python 3.9
uses: actions/setup-python@v2

View File

@ -64,8 +64,8 @@ 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.10/panda3d-1.10.10-tools-win64.zip
- https://www.panda3d.org/download/panda3d-1.10.10/panda3d-1.10.10-tools-win32.zip
- https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-win64.zip
- https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-win32.zip
After acquiring these dependencies, you can build Panda3D from the command
prompt using the following command. Change the `--msvc-version` option based
@ -136,7 +136,7 @@ macOS
-----
On macOS, you will need to download a set of precompiled thirdparty packages in order to
compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.10.10/panda3d-1.10.10-tools-mac.tar.gz).
compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-mac.tar.gz).
After placing the thirdparty directory inside the panda3d source directory,
you may build Panda3D using a command like the following:

View File

@ -2406,7 +2406,13 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
return None
try:
fp = zip.open(fn.replace(os.path.sep, '/'), 'r')
zip_fn = fn.replace(os.path.sep, '/')
if zip_fn.startswith('deploy_libs/_tkinter.'):
# If we have a tkinter wheel on the path, ignore the
# _tkinter extension in deploy-libs.
if any(entry.endswith(".whl") and os.path.basename(entry).startswith("tkinter-") for entry in self.path):
return None
fp = zip.open(zip_fn, 'r')
except KeyError:
return None

View File

@ -96,6 +96,7 @@ PACKAGE_DATA_DIRS = {
],
'pytz': [('pytz/zoneinfo/*', 'zoneinfo', ())],
'certifi': [('certifi/cacert.pem', '', {})],
'_tkinter_ext': [('_tkinter_ext/tcl/**', 'tcl', {})],
}
# Some dependencies have extra directories that need to be scanned for DLLs.
@ -140,21 +141,6 @@ def get_data(path):
FrozenImporter.find_spec = find_spec
FrozenImporter.get_data = get_data
# Set the TCL_LIBRARY directory to the location of the Tcl/Tk/Tix files.
import os
tcl_dir = os.path.join(os.path.dirname(sys.executable), 'tcl')
if os.path.isdir(tcl_dir):
for dir in os.listdir(tcl_dir):
sub_dir = os.path.join(tcl_dir, dir)
if os.path.isdir(sub_dir):
if dir.startswith('tcl'):
os.environ['TCL_LIBRARY'] = sub_dir
if dir.startswith('tk'):
os.environ['TK_LIBRARY'] = sub_dir
if dir.startswith('tix'):
os.environ['TIX_LIBRARY'] = sub_dir
del os
"""
SITE_PY_ANDROID = """
@ -595,10 +581,15 @@ class build_apps(setuptools.Command):
'-d', whldir,
'-r', self.requirements_path,
'--only-binary', ':all:',
'--platform', platform,
'--abi', abi_tag,
'--platform', platform,
]
if platform.startswith('linux_'):
# Also accept manylinux.
arch = platform[6:]
pip_args += ['--platform', 'manylinux2010_' + arch]
if self.use_optimized_wheels:
pip_args += [
'--extra-index-url', self.optimized_wheel_index
@ -766,6 +757,7 @@ class build_apps(setuptools.Command):
path = sys.path[:]
p3dwhl = None
wheelpaths = []
has_tkinter_wheel = False
if use_wheels:
wheelpaths = self.download_wheels(platform)
@ -775,6 +767,8 @@ class build_apps(setuptools.Command):
p3dwhlfn = whl
p3dwhl = self._get_zip_file(p3dwhlfn)
break
elif os.path.basename(whl).startswith('tkinter-'):
has_tkinter_wheel = True
else:
raise RuntimeError("Missing panda3d wheel for platform: {}".format(platform))
@ -787,6 +781,11 @@ class build_apps(setuptools.Command):
distutils.log.WARN
)
for whl in wheelpaths:
if os.path.basename(whl).startswith('tkinter-'):
has_tkinter_wheel = True
break
#whlfiles = {whl: self._get_zip_file(whl) for whl in wheelpaths}
# Add whl files to the path so they are picked up by modulefinder
@ -1026,6 +1025,10 @@ class build_apps(setuptools.Command):
for appname, scriptname in self.console_apps.items():
create_runtime(platform, appname, scriptname, True)
# Warn if tkinter is used but hasn't been added to requirements.txt
if not has_tkinter_wheel and '_tkinter' in freezer_modules:
self.warn("Detected use of tkinter, but tkinter is not specified in requirements.txt!")
# Copy extension modules
whl_modules = []
whl_modules_ext = ''
@ -1040,6 +1043,11 @@ class build_apps(setuptools.Command):
if not any(i.endswith(suffix) for suffix in ext_suffixes):
continue
if has_tkinter_wheel and i.startswith('deploy_libs/_tkinter.'):
# Ignore this one, we have a separate tkinter package
# nowadays that contains all the dependencies.
continue
base = os.path.basename(i)
module, _, ext = base.partition('.')
whl_modules.append(module)
@ -1111,22 +1119,6 @@ class build_apps(setuptools.Command):
search_path = get_search_path_for(source_path)
self.copy_with_dependencies(source_path, target_path, search_path)
# Copy over the tcl directory.
#TODO: get this to work on non-Windows platforms.
if sys.platform == "win32" and platform.startswith('win'):
tcl_dir = os.path.join(sys.prefix, 'tcl')
if os.path.isdir(tcl_dir) and 'tkinter' in freezer_modules:
self.announce('Copying Tcl files', distutils.log.INFO)
os.makedirs(os.path.join(binary_dir, 'tcl'))
for dir in os.listdir(tcl_dir):
sub_dir = os.path.join(tcl_dir, dir)
if os.path.isdir(sub_dir):
target_dir = os.path.join(binary_dir, 'tcl', dir)
self.announce('copying {0} -> {1}'.format(sub_dir, target_dir))
shutil.copytree(sub_dir, target_dir)
# Copy classes.dex on Android
if use_wheels and platform.startswith('android'):
self.copy(os.path.join(p3dwhlfn, 'deploy_libs', 'classes.dex'),
@ -1151,9 +1143,14 @@ class build_apps(setuptools.Command):
target_dir = os.path.join(data_dir, target_dir)
for wf in filenames:
if wf.endswith('/'):
# Skip directories.
continue
if wf.lower().startswith(source_dir.lower() + '/'):
if not srcglob.matches(wf.lower()):
continue
wf = wf.replace('/', os.sep)
relpath = wf[len(source_dir) + 1:]
source_path = os.path.join(whl, wf)

View File

@ -219,18 +219,10 @@ def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1,
python_versions=[], **kwargs):
outputdir = GetOutputDir()
# We pack the default Python 3 version that ships with Ubuntu.
python3_ver = None
# Only pack the versions of Python included with this Ubuntu version.
install_python_versions = []
# What's the system version of Python 3?
oscmd('python3 -V > "%s/tmp/python3_version.txt"' % (outputdir))
sys_python3_ver = '.'.join(ReadFile(outputdir + "/tmp/python3_version.txt").strip().split(' ')[1].split('.')[:2])
# Check that we built with support for it.
for version_info in python_versions:
if version_info["version"] == sys_python3_ver:
python3_ver = sys_python3_ver
if os.path.isdir("/usr/lib/python" + version_info["version"]):
install_python_versions.append(version_info)
major_version = '.'.join(version.split('.')[:2])
@ -317,9 +309,13 @@ def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1,
recommends = ReadFile("targetroot/debian/substvars_rec").replace("shlibs:Depends=", "").strip()
provides = "panda3d"
if python3_ver:
depends += ", python%s" % (python3_ver)
recommends += ", python-pmw, python3-tk (>= %s)" % (python3_ver)
# Require at least one of the Python versions we built for.
if install_python_versions:
depends += ", " + " | ".join("python" + version_info["version"] for version_info in install_python_versions)
# But recommend the system version of Python 3.
recommends += ", python3"
recommends += ", python3-tk"
provides += ", python3-panda3d"
if not PkgSkip("NVIDIACG"):
@ -336,7 +332,7 @@ def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1,
oscmd("chmod -R 755 targetroot/DEBIAN")
oscmd("chmod 644 targetroot/DEBIAN/control targetroot/DEBIAN/md5sums")
oscmd("chmod 644 targetroot/DEBIAN/conffiles targetroot/DEBIAN/symbols")
oscmd("fakeroot dpkg-deb -b targetroot %s_%s_%s.deb" % (pkg_name, pkg_version, pkg_arch))
oscmd("fakeroot dpkg-deb -Zxz -b targetroot %s_%s_%s.deb" % (pkg_name, pkg_version, pkg_arch))
elif rpmbuild_present:
# Invoke installpanda.py to install it into a temporary dir

View File

@ -433,7 +433,7 @@ elif target == 'linux' and (os.path.isfile("/lib/libc-2.17.so") or os.path.isfil
else:
PLATFORM = 'manylinux2014-i686'
elif target == 'linux' and (os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64/libc-2.24.so")) and os.path.isdir("/opt/python"):
elif target == 'linux' and (os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64-linux-gnu/libc-2.24.so")) and os.path.isdir("/opt/python"):
# Same sloppy check for manylinux_2_24.
if GetTargetArch() in ('x86_64', 'amd64'):
PLATFORM = 'manylinux_2_24-x86_64'

View File

@ -653,7 +653,7 @@ def makewheel(version, output_dir, platform=None):
platform = platform.replace("linux", "manylinux2010")
elif os.path.isfile("/lib/libc-2.17.so") or os.path.isfile("/lib64/libc-2.17.so"):
platform = platform.replace("linux", "manylinux2014")
elif os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64/libc-2.24.so"):
elif os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64-linux-gnu/libc-2.24.so"):
platform = platform.replace("linux", "manylinux_2_24")
platform = platform.replace('-', '_').replace('.', '_')
@ -785,6 +785,10 @@ if __debug__:
for file in sorted(os.listdir(ext_mod_dir)):
if file.endswith(ext_suffix):
if file.startswith('_tkinter.'):
# Tkinter is supplied in a separate wheel.
continue
source_path = os.path.join(ext_mod_dir, file)
if file.endswith('.pyd') and platform.startswith('cygwin'):

View File

@ -2158,6 +2158,7 @@ map_raw_key(unsigned short keycode) const {
case 0x07: return KeyboardButton::ascii_key('x');
case 0x08: return KeyboardButton::ascii_key('c');
case 0x09: return KeyboardButton::ascii_key('v');
case 0x0A: return KeyboardButton::ascii_key('<');
case 0x0B: return KeyboardButton::ascii_key('b');
case 0x0C: return KeyboardButton::ascii_key('q');
case 0x0D: return KeyboardButton::ascii_key('w');

View File

@ -962,7 +962,7 @@ map_button(int code, DeviceClass device_class, int quirks) {
KeyboardButton::ascii_key('.'),
ButtonHandle::none(),
ButtonHandle::none(),
ButtonHandle::none(),
KeyboardButton::ascii_key('<'),
KeyboardButton::f11(),
KeyboardButton::f12(),
ButtonHandle::none(),

View File

@ -881,36 +881,17 @@ do_premunge(GraphicsStateGuardianBase *gsg,
GeomTransformer &transformer) {
Thread *current_thread = Thread::get_current_thread();
// Cache munged vertex data, so that we don't duplicate vertex data
// unnecessarily.
std::map<CPT(GeomVertexData), CPT(GeomVertexData)> munged_vdata;
OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
GeomList::iterator gi;
PT(GeomList) geoms = cdata->modify_geoms();
for (GeomEntry &entry : *geoms) {
for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
GeomEntry &entry = (*gi);
CPT(RenderState) geom_state = node_state->compose(entry._state);
CPT(Geom) geom = entry._geom.get_read_pointer();
PT(GeomMunger) munger = gsg->get_geom_munger(geom_state, current_thread);
CPT(GeomVertexData) vdata = geom->get_vertex_data();
auto it = munged_vdata.find(vdata);
if (it != munged_vdata.end()) {
vdata = it->second;
} else {
CPT(GeomVertexData) old_vdata = std::move(vdata);
vdata = munger->premunge_data(old_vdata);
munged_vdata[std::move(old_vdata)] = vdata;
}
CPT(Geom) pgeom = geom;
munger->premunge_geom(pgeom, vdata);
PT(Geom) geom_copy = pgeom->make_copy();
geom_copy->set_vertex_data(vdata);
entry._geom = std::move(geom_copy);
entry._geom = transformer.premunge_geom(geom, munger);
}
}
CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);

View File

@ -33,6 +33,10 @@
#define WM_TOUCH 0x0240
#endif
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
#if WINVER < 0x0601
// Not used on Windows XP, but we still need to define it.
#define TOUCH_COORD_TO_PIXEL(l) ((l) / 100)
@ -1808,6 +1812,31 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
}
break;
case WM_MOUSEHWHEEL:
{
int delta = GET_WHEEL_DELTA_WPARAM(wparam);
POINT point;
GetCursorPos(&point);
ScreenToClient(hwnd, &point);
double time = get_message_time();
if (delta >= 0) {
while (delta > 0) {
handle_keypress(MouseButton::wheel_right(), point.x, point.y, time);
handle_keyrelease(MouseButton::wheel_right(), time);
delta -= WHEEL_DELTA;
}
} else {
while (delta < 0) {
handle_keypress(MouseButton::wheel_left(), point.x, point.y, time);
handle_keyrelease(MouseButton::wheel_left(), time);
delta += WHEEL_DELTA;
}
}
return 0;
}
break;
case WM_IME_SETCONTEXT:
if (!ime_hide)
@ -2651,6 +2680,10 @@ lookup_key(WPARAM wparam) const {
case VK_LMENU: return KeyboardButton::lalt();
case VK_RMENU: return KeyboardButton::ralt();
case VK_LWIN: return KeyboardButton::lmeta();
case VK_RWIN: return KeyboardButton::rmeta();
case VK_APPS: return KeyboardButton::menu();
default:
int key = MapVirtualKey(wparam, 2);
if (isascii(key) && key != 0) {
@ -2796,6 +2829,7 @@ lookup_raw_key(LPARAM lparam) const {
// A few additional keys don't fit well in the above table.
switch (vsc) {
case 86: return KeyboardButton::ascii_key('<'); // Between lshift and z
case 87: return KeyboardButton::f11();
case 88: return KeyboardButton::f12();
default: return ButtonHandle::none();
@ -2815,10 +2849,10 @@ get_keyboard_map() const {
wchar_t text[256];
UINT vsc = 0;
unsigned short ex_vsc[] = {0x57, 0x58,
unsigned short ex_vsc[] = {0x56, 0x57, 0x58,
0x011c, 0x011d, 0x0135, 0x0137, 0x0138, 0x0145, 0x0147, 0x0148, 0x0149, 0x014b, 0x014d, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x015b, 0x015c, 0x015d};
for (int k = 1; k < 84 + 17; ++k) {
for (int k = 1; k < 84 + sizeof(ex_vsc) / sizeof(short); ++k) {
if (k >= 84) {
vsc = ex_vsc[k - 84];
} else {

View File

@ -2230,6 +2230,8 @@ get_mouse_button(XButtonEvent &button_event) {
return MouseButton::wheel_left();
} else if (index == x_wheel_right_button) {
return MouseButton::wheel_right();
} else if (index >= 8) {
return MouseButton::button(index - 5);
} else {
return MouseButton::button(index - 1);
}