Browse Source

Merge branch 'release/1.10.x'

rdb 4 years ago
parent
commit
9598065641

+ 2 - 0
direct/src/showbase/ShowBase.py

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

+ 13 - 3
makepanda/makepackage.py

@@ -215,7 +215,7 @@ def MakeDebugSymbolArchive(zipname, dirname):
     zip.close()
 
 
-def MakeInstallerLinux(version, debversion=None, rpmrelease=1,
+def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1,
                        python_versions=[], **kwargs):
     outputdir = GetOutputDir()
 
@@ -236,6 +236,8 @@ def MakeInstallerLinux(version, debversion=None, rpmrelease=1,
     major_version = '.'.join(version.split('.')[:2])
     if not debversion:
         debversion = version
+    if not rpmversion:
+        rpmversion = version
 
     # Clean and set up a directory to install Panda3D into
     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)
 
         # Write out the spec file.
-        txt = txt.replace("VERSION", version)
+        txt = txt.replace("VERSION", rpmversion)
         txt = txt.replace("RPMRELEASE", str(rpmrelease))
         txt = txt.replace("PANDASOURCE", pandasource)
         WriteFile("panda3d.spec", txt)
 
         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)
 
     else:
@@ -1024,6 +1026,13 @@ if __name__ == "__main__":
         help='Version number for .deb file',
         default=None,
     )
+    parser.add_option(
+        '',
+        '--rpmversion',
+        dest='rpmversion',
+        help='Version number for .rpm file',
+        default=None,
+    )
     parser.add_option(
         '',
         '--rpmrelease',
@@ -1093,6 +1102,7 @@ if __name__ == "__main__":
         optimize=GetOptimize(),
         compressor=options.compressor,
         debversion=options.debversion,
+        rpmversion=options.rpmversion,
         rpmrelease=options.rpmrelease,
         python_versions=ReadPythonVersionInfoFile(),
         installdir=options.installdir,

+ 19 - 11
makepanda/makepanda.py

@@ -67,6 +67,7 @@ DISTRIBUTOR=""
 VERSION=None
 DEBVERSION=None
 WHLVERSION=None
+RPMVERSION=None
 RPMRELEASE="1"
 GIT_COMMIT=None
 MAJOR_VERSION=None
@@ -169,7 +170,7 @@ def usage(problem):
 def parseopts(args):
     global INSTALLER,WHEEL,RUNTESTS,GENMAN,DISTRIBUTOR,VERSION
     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 COPY_PYTHON
 
@@ -184,7 +185,7 @@ def parseopts(args):
         "help","distributor=","verbose","tests",
         "optimize=","everything","nothing","installer","wheel","rtdist","nocolor",
         "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",
         "universal", "target=", "arch=", "git-commit=", "no-copy-python",
         "cggl-incdir=", "cggl-libdir=",
@@ -231,6 +232,7 @@ def parseopts(args):
             elif (option=="--override"): AddOverride(value.strip())
             elif (option=="--static"): SetLinkAllStatic(True)
             elif (option=="--debversion"): DEBVERSION=value
+            elif (option=="--rpmversion"): RPMVERSION=value
             elif (option=="--rpmrelease"): RPMRELEASE=value
             elif (option=="--git-commit"): GIT_COMMIT=value
             # Backward compatibility, OPENGL was renamed to GL
@@ -371,6 +373,9 @@ print("Version: %s" % VERSION)
 if DEBVERSION is None:
     DEBVERSION = VERSION
 
+if RPMVERSION is None:
+    RPMVERSION = VERSION
+
 MAJOR_VERSION = '.'.join(VERSION.split('.')[:2])
 
 # 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.
         cmd += " -fno-strict-aliasing"
 
-        if optlevel >= 3:
-            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"
+        # Certain clang versions crash when passing these math flags while
+        # compiling Objective-C++ code
+        if not src.endswith(".m") and not src.endswith(".mm"):
+            if optlevel >= 3:
+                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)
-        cmd += " -fno-unsafe-math-optimizations"
+            # Make sure this is off to avoid GCC/Eigen bug (see GitHub #228)
+            cmd += " -fno-unsafe-math-optimizations"
 
         if (optlevel==1): cmd += " -ggdb -D_DEBUG"
         if (optlevel==2): cmd += " -O1 -D_DEBUG"
@@ -6254,8 +6262,8 @@ if INSTALLER:
 
     MakeInstaller(version=VERSION, outputdir=GetOutputDir(),
                   optimize=GetOptimize(), compressor=COMPRESSOR,
-                  debversion=DEBVERSION, rpmrelease=RPMRELEASE,
-                  python_versions=python_versions)
+                  debversion=DEBVERSION, rpmversion=RPMVERSION,
+                  rpmrelease=RPMRELEASE, python_versions=python_versions)
 
 if WHEEL:
     ProgressOutput(100.0, "Building wheel")

+ 29 - 3
panda/src/device/winRawInputDevice.cxx

@@ -38,6 +38,9 @@ enum QuirkBits : int {
 
   // Axes on the right stick are swapped, using x for y and vice versa.
   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.
@@ -85,6 +88,10 @@ static const struct DeviceMapping {
   {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"}
   },
+  // FrSky Simulator
+  {0x0483, 0x5720, InputDevice::DeviceClass::gamepad, QB_rc_controller,
+    {0}
+  },
   {0},
 };
 
@@ -434,7 +441,11 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
         switch (usage) {
           case HID_USAGE_GENERIC_X:
           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) {
             axis = Axis::roll;
           } else {
@@ -443,8 +454,12 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
           break;
         case HID_USAGE_GENERIC_Y:
           if (_device_class == DeviceClass::gamepad) {
-            axis = Axis::left_y;
-            swap(cap.LogicalMin, cap.LogicalMax);
+            if (quirks & QB_rc_controller) {
+              axis = Axis::right_y;
+            } else {
+              axis = Axis::left_y;
+              swap(cap.LogicalMin, cap.LogicalMax);
+            }
           } else if (_device_class == DeviceClass::flight_stick) {
             axis = Axis::pitch;
           } else {
@@ -461,6 +476,8 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
               } else {
                 axis = InputDevice::Axis::right_x;
               }
+            } else if (quirks & QB_rc_controller) {
+              axis = InputDevice::Axis::left_y;
             } else if ((quirks & QB_no_analog_triggers) == 0) {
               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) {
                 axis = Axis::left_trigger;
               }
+            } else if (quirks & QB_rc_controller) {
+              axis = Axis::left_x;
             } else {
               axis = Axis::right_x;
             }
@@ -663,6 +682,13 @@ process_report(PCHAR ptr, size_t size) {
   if (status == HIDP_STATUS_SUCCESS) {
     for (ULONG di = 0; di < count; ++di) {
       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 (device_cat.is_debug()) {
             device_cat.debug()