Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2021-12-26 14:13:23 +01:00
commit 9598065641
4 changed files with 63 additions and 17 deletions

View File

@ -385,6 +385,8 @@ class ShowBase(DirectObject.DirectObject):
# Get a pointer to Panda's global ClockObject, used for # Get a pointer to Panda's global ClockObject, used for
# synchronizing events between Python and C. # synchronizing events between Python and C.
clock = ClockObject.getGlobalClock() clock = ClockObject.getGlobalClock()
#: This is the global :class:`~panda3d.core.ClockObject`.
self.clock = clock self.clock = clock
# Since we have already started up a TaskManager, and probably # Since we have already started up a TaskManager, and probably

View File

@ -215,7 +215,7 @@ def MakeDebugSymbolArchive(zipname, dirname):
zip.close() zip.close()
def MakeInstallerLinux(version, debversion=None, rpmrelease=1, def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1,
python_versions=[], **kwargs): python_versions=[], **kwargs):
outputdir = GetOutputDir() outputdir = GetOutputDir()
@ -236,6 +236,8 @@ def MakeInstallerLinux(version, debversion=None, rpmrelease=1,
major_version = '.'.join(version.split('.')[:2]) major_version = '.'.join(version.split('.')[:2])
if not debversion: if not debversion:
debversion = version debversion = version
if not rpmversion:
rpmversion = version
# Clean and set up a directory to install Panda3D into # Clean and set up a directory to install Panda3D into
oscmd("rm -rf targetroot data.tar.gz control.tar.gz panda3d.spec") oscmd("rm -rf targetroot data.tar.gz control.tar.gz panda3d.spec")
@ -372,13 +374,13 @@ def MakeInstallerLinux(version, debversion=None, rpmrelease=1,
txt += "/usr/bin/%s\n" % (base) txt += "/usr/bin/%s\n" % (base)
# Write out the spec file. # Write out the spec file.
txt = txt.replace("VERSION", version) txt = txt.replace("VERSION", rpmversion)
txt = txt.replace("RPMRELEASE", str(rpmrelease)) txt = txt.replace("RPMRELEASE", str(rpmrelease))
txt = txt.replace("PANDASOURCE", pandasource) txt = txt.replace("PANDASOURCE", pandasource)
WriteFile("panda3d.spec", txt) WriteFile("panda3d.spec", txt)
oscmd("fakeroot rpmbuild --define '_rpmdir "+pandasource+"' --buildroot '"+os.path.abspath("targetroot")+"' -bb panda3d.spec") oscmd("fakeroot rpmbuild --define '_rpmdir "+pandasource+"' --buildroot '"+os.path.abspath("targetroot")+"' -bb panda3d.spec")
oscmd("mv "+arch+"/panda3d-"+version+"-"+rpmrelease+"."+arch+".rpm .") oscmd("mv "+arch+"/panda3d-"+rpmversion+"-"+rpmrelease+"."+arch+".rpm .")
oscmd("rm -rf "+arch, True) oscmd("rm -rf "+arch, True)
else: else:
@ -1024,6 +1026,13 @@ if __name__ == "__main__":
help='Version number for .deb file', help='Version number for .deb file',
default=None, default=None,
) )
parser.add_option(
'',
'--rpmversion',
dest='rpmversion',
help='Version number for .rpm file',
default=None,
)
parser.add_option( parser.add_option(
'', '',
'--rpmrelease', '--rpmrelease',
@ -1093,6 +1102,7 @@ if __name__ == "__main__":
optimize=GetOptimize(), optimize=GetOptimize(),
compressor=options.compressor, compressor=options.compressor,
debversion=options.debversion, debversion=options.debversion,
rpmversion=options.rpmversion,
rpmrelease=options.rpmrelease, rpmrelease=options.rpmrelease,
python_versions=ReadPythonVersionInfoFile(), python_versions=ReadPythonVersionInfoFile(),
installdir=options.installdir, installdir=options.installdir,

View File

@ -67,6 +67,7 @@ DISTRIBUTOR=""
VERSION=None VERSION=None
DEBVERSION=None DEBVERSION=None
WHLVERSION=None WHLVERSION=None
RPMVERSION=None
RPMRELEASE="1" RPMRELEASE="1"
GIT_COMMIT=None GIT_COMMIT=None
MAJOR_VERSION=None MAJOR_VERSION=None
@ -169,7 +170,7 @@ def usage(problem):
def parseopts(args): def parseopts(args):
global INSTALLER,WHEEL,RUNTESTS,GENMAN,DISTRIBUTOR,VERSION global INSTALLER,WHEEL,RUNTESTS,GENMAN,DISTRIBUTOR,VERSION
global COMPRESSOR,THREADCOUNT,OSX_ARCHS global COMPRESSOR,THREADCOUNT,OSX_ARCHS
global DEBVERSION,WHLVERSION,RPMRELEASE,GIT_COMMIT global DEBVERSION,WHLVERSION,RPMVERSION,RPMRELEASE,GIT_COMMIT
global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER
global COPY_PYTHON global COPY_PYTHON
@ -184,7 +185,7 @@ def parseopts(args):
"help","distributor=","verbose","tests", "help","distributor=","verbose","tests",
"optimize=","everything","nothing","installer","wheel","rtdist","nocolor", "optimize=","everything","nothing","installer","wheel","rtdist","nocolor",
"version=","lzma","no-python","threads=","outputdir=","override=", "version=","lzma","no-python","threads=","outputdir=","override=",
"static","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=", "static","debversion=","rpmversion=","rpmrelease=","p3dsuffix=","rtdist-version=",
"directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl", "directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl",
"universal", "target=", "arch=", "git-commit=", "no-copy-python", "universal", "target=", "arch=", "git-commit=", "no-copy-python",
"cggl-incdir=", "cggl-libdir=", "cggl-incdir=", "cggl-libdir=",
@ -231,6 +232,7 @@ def parseopts(args):
elif (option=="--override"): AddOverride(value.strip()) elif (option=="--override"): AddOverride(value.strip())
elif (option=="--static"): SetLinkAllStatic(True) elif (option=="--static"): SetLinkAllStatic(True)
elif (option=="--debversion"): DEBVERSION=value elif (option=="--debversion"): DEBVERSION=value
elif (option=="--rpmversion"): RPMVERSION=value
elif (option=="--rpmrelease"): RPMRELEASE=value elif (option=="--rpmrelease"): RPMRELEASE=value
elif (option=="--git-commit"): GIT_COMMIT=value elif (option=="--git-commit"): GIT_COMMIT=value
# Backward compatibility, OPENGL was renamed to GL # Backward compatibility, OPENGL was renamed to GL
@ -371,6 +373,9 @@ print("Version: %s" % VERSION)
if DEBVERSION is None: if DEBVERSION is None:
DEBVERSION = VERSION DEBVERSION = VERSION
if RPMVERSION is None:
RPMVERSION = VERSION
MAJOR_VERSION = '.'.join(VERSION.split('.')[:2]) MAJOR_VERSION = '.'.join(VERSION.split('.')[:2])
# Now determine the distutils-style platform tag for the target system. # Now determine the distutils-style platform tag for the target system.
@ -1380,14 +1385,17 @@ def CompileCxx(obj,src,opts):
# Needed by both Python, Panda, Eigen, all of which break aliasing rules. # Needed by both Python, Panda, Eigen, all of which break aliasing rules.
cmd += " -fno-strict-aliasing" cmd += " -fno-strict-aliasing"
if optlevel >= 3: # Certain clang versions crash when passing these math flags while
cmd += " -ffast-math -fno-stack-protector" # compiling Objective-C++ code
if optlevel == 3: if not src.endswith(".m") and not src.endswith(".mm"):
# Fast math is nice, but we'd like to see NaN in dev builds. if optlevel >= 3:
cmd += " -fno-finite-math-only" cmd += " -ffast-math -fno-stack-protector"
if optlevel == 3:
# Fast math is nice, but we'd like to see NaN in dev builds.
cmd += " -fno-finite-math-only"
# Make sure this is off to avoid GCC/Eigen bug (see GitHub #228) # Make sure this is off to avoid GCC/Eigen bug (see GitHub #228)
cmd += " -fno-unsafe-math-optimizations" cmd += " -fno-unsafe-math-optimizations"
if (optlevel==1): cmd += " -ggdb -D_DEBUG" if (optlevel==1): cmd += " -ggdb -D_DEBUG"
if (optlevel==2): cmd += " -O1 -D_DEBUG" if (optlevel==2): cmd += " -O1 -D_DEBUG"
@ -6254,8 +6262,8 @@ if INSTALLER:
MakeInstaller(version=VERSION, outputdir=GetOutputDir(), MakeInstaller(version=VERSION, outputdir=GetOutputDir(),
optimize=GetOptimize(), compressor=COMPRESSOR, optimize=GetOptimize(), compressor=COMPRESSOR,
debversion=DEBVERSION, rpmrelease=RPMRELEASE, debversion=DEBVERSION, rpmversion=RPMVERSION,
python_versions=python_versions) rpmrelease=RPMRELEASE, python_versions=python_versions)
if WHEEL: if WHEEL:
ProgressOutput(100.0, "Building wheel") ProgressOutput(100.0, "Building wheel")

View File

@ -38,6 +38,9 @@ enum QuirkBits : int {
// Axes on the right stick are swapped, using x for y and vice versa. // Axes on the right stick are swapped, using x for y and vice versa.
QB_right_axes_swapped = 64, QB_right_axes_swapped = 64,
// Using an RC (drone) controller as a gamepad instead of a flight stick
QB_rc_controller = 128,
}; };
// Some nonstandard gamepads have different button mappings. // Some nonstandard gamepads have different button mappings.
@ -85,6 +88,10 @@ static const struct DeviceMapping {
{0x2563, 0x0523, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_no_analog_triggers, {0x2563, 0x0523, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_no_analog_triggers,
{"face_y", "face_b", "face_a", "face_x", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick"} {"face_y", "face_b", "face_a", "face_x", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick"}
}, },
// FrSky Simulator
{0x0483, 0x5720, InputDevice::DeviceClass::gamepad, QB_rc_controller,
{0}
},
{0}, {0},
}; };
@ -434,7 +441,11 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
switch (usage) { switch (usage) {
case HID_USAGE_GENERIC_X: case HID_USAGE_GENERIC_X:
if (_device_class == DeviceClass::gamepad) { if (_device_class == DeviceClass::gamepad) {
axis = Axis::left_x; if (quirks & QB_rc_controller) {
axis = Axis::right_x;
} else {
axis = Axis::left_x;
}
} else if (_device_class == DeviceClass::flight_stick) { } else if (_device_class == DeviceClass::flight_stick) {
axis = Axis::roll; axis = Axis::roll;
} else { } else {
@ -443,8 +454,12 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
break; break;
case HID_USAGE_GENERIC_Y: case HID_USAGE_GENERIC_Y:
if (_device_class == DeviceClass::gamepad) { if (_device_class == DeviceClass::gamepad) {
axis = Axis::left_y; if (quirks & QB_rc_controller) {
swap(cap.LogicalMin, cap.LogicalMax); axis = Axis::right_y;
} else {
axis = Axis::left_y;
swap(cap.LogicalMin, cap.LogicalMax);
}
} else if (_device_class == DeviceClass::flight_stick) { } else if (_device_class == DeviceClass::flight_stick) {
axis = Axis::pitch; axis = Axis::pitch;
} else { } else {
@ -461,6 +476,8 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
} else { } else {
axis = InputDevice::Axis::right_x; axis = InputDevice::Axis::right_x;
} }
} else if (quirks & QB_rc_controller) {
axis = InputDevice::Axis::left_y;
} else if ((quirks & QB_no_analog_triggers) == 0) { } else if ((quirks & QB_no_analog_triggers) == 0) {
axis = Axis::left_trigger; axis = Axis::left_trigger;
} }
@ -483,6 +500,8 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
if ((quirks & QB_no_analog_triggers) == 0) { if ((quirks & QB_no_analog_triggers) == 0) {
axis = Axis::left_trigger; axis = Axis::left_trigger;
} }
} else if (quirks & QB_rc_controller) {
axis = Axis::left_x;
} else { } else {
axis = Axis::right_x; axis = Axis::right_x;
} }
@ -663,6 +682,13 @@ process_report(PCHAR ptr, size_t size) {
if (status == HIDP_STATUS_SUCCESS) { if (status == HIDP_STATUS_SUCCESS) {
for (ULONG di = 0; di < count; ++di) { for (ULONG di = 0; di < count; ++di) {
if (data[di].DataIndex != _hat_data_index) { if (data[di].DataIndex != _hat_data_index) {
if (device_cat.is_spam()) {
device_cat.spam()
<< "Read RawValue " << data[di].RawValue
<< " for DataIndex " << data[di].DataIndex
<< " from raw device " << _path << "\n";
}
if (data[di].DataIndex >= _indices.size()) { if (data[di].DataIndex >= _indices.size()) {
if (device_cat.is_debug()) { if (device_cat.is_debug()) {
device_cat.debug() device_cat.debug()