Browse Source

Merge branch 'release/1.10.x'

rdb 5 years ago
parent
commit
dcc08ac572

File diff suppressed because it is too large
+ 272 - 137
direct/src/showbase/ShowBase.py


+ 6 - 3
direct/src/showutil/TexMemWatcher.py

@@ -327,7 +327,10 @@ class TexMemWatcher(DirectObject):
 
         if self.dynamicLimit:
             # Choose a suitable limit by rounding to the next power of two.
-            self.limit = Texture.upToPower2(self.totalSize)
+            limit = 1
+            while limit < self.totalSize:
+                limit *= 2
+            self.limit = limit
 
         # Set our GSG to limit itself to no more textures than we
         # expect to display onscreen, so we don't go crazy with
@@ -883,7 +886,7 @@ class TexMemWatcher(DirectObject):
             matches.append((match, tp))
 
         if matches:
-            return max(matches)[1]
+            return max(matches, key=lambda match: match[0])[1]
         return None
 
     def findHolePieces(self, area):
@@ -937,7 +940,7 @@ class TexMemWatcher(DirectObject):
     def findLargestHole(self):
         holes = self.findAvailableHoles(0)
         if holes:
-            return max(holes)[1]
+            return max(holes, key=lambda hole: hole[0])[1]
         return None
 
     def findAvailableHoles(self, area, w = None, h = None):

+ 2 - 2
makepanda/makewheel.py

@@ -564,6 +564,7 @@ def makewheel(version, output_dir, platform=None):
         libs_dir = join(output_dir, "bin")
     else:
         libs_dir = join(output_dir, "lib")
+    ext_mod_dir = get_python_ext_module_dir()
     license_src = "LICENSE"
     readme_src = "README.md"
 
@@ -595,7 +596,7 @@ def makewheel(version, output_dir, platform=None):
     whl.lib_path = [libs_dir]
 
     if sys.platform == "win32":
-        whl.lib_path.append(join(output_dir, "python", "DLLs"))
+        whl.lib_path.append(ext_mod_dir)
 
     if platform.startswith("manylinux"):
         # On manylinux1, we pick up all libraries except for the ones specified
@@ -648,7 +649,6 @@ if __debug__:
     # And copy the extension modules from the Python installation into the
     # deploy_libs directory, for use by deploy-ng.
     ext_suffix = '.pyd' if sys.platform in ('win32', 'cygwin') else '.so'
-    ext_mod_dir = get_python_ext_module_dir()
 
     for file in os.listdir(ext_mod_dir):
         if file.endswith(ext_suffix):

+ 16 - 9
panda/src/cocoadisplay/cocoaGraphicsWindow.mm

@@ -1690,20 +1690,19 @@ handle_key_event(NSEvent *event) {
     return;
   }
 
+  TISInputSourceRef input_source = TISCopyCurrentKeyboardLayoutInputSource();
+  CFDataRef layout_data = (CFDataRef)TISGetInputSourceProperty(input_source, kTISPropertyUnicodeKeyLayoutData);
+  const UCKeyboardLayout *layout = (const UCKeyboardLayout *)CFDataGetBytePtr(layout_data);
+
   if ([event type] == NSKeyDown) {
     // Translate it to a unicode character for keystrokes.  I would use
     // interpretKeyEvents and insertText, but that doesn't handle dead keys.
-    TISInputSourceRef input_source = TISCopyCurrentKeyboardLayoutInputSource();
-    CFDataRef layout_data = (CFDataRef)TISGetInputSourceProperty(input_source, kTISPropertyUnicodeKeyLayoutData);
-    const UCKeyboardLayout *layout = (const UCKeyboardLayout *)CFDataGetBytePtr(layout_data);
-
     UInt32 modifier_state = (modifierFlags >> 16) & 0xFF;
     UniChar ustr[8];
     UniCharCount length;
 
     UCKeyTranslate(layout, [event keyCode], kUCKeyActionDown, modifier_state,
                    LMGetKbdType(), 0, &_dead_key_state, sizeof(ustr), &length, ustr);
-    CFRelease(input_source);
 
     for (int i = 0; i < length; ++i) {
       UniChar c = ustr[i];
@@ -1719,17 +1718,25 @@ handle_key_event(NSEvent *event) {
     }
   }
 
-  NSString *str = [event charactersIgnoringModifiers];
-  if (str == nil || [str length] == 0) {
+  // [NSEvent charactersIgnoringModifiers] doesn't ignore the shift key, so we
+  // need to do what that method is doing manually.
+  _dead_key_state = 0;
+  UniChar c;
+  UniCharCount length;
+  UCKeyTranslate(layout, [event keyCode], kUCKeyActionDisplay,
+    0, LMGetKbdType(), kUCKeyTranslateNoDeadKeysMask, &_dead_key_state,
+    sizeof(c), &length, &c);
+  CFRelease(input_source);
+
+  if (length != 1) {
     return;
   }
-  nassertv_always([str length] == 1);
-  unichar c = [str characterAtIndex: 0];
 
   ButtonHandle button = map_key(c);
 
   if (button == ButtonHandle::none()) {
     // That done, continue trying to find out the button handle.
+    NSString *str = [[NSString alloc] initWithCharacters:&c length:length];
     if ([str canBeConvertedToEncoding: NSASCIIStringEncoding]) {
       // Nhm, ascii character perhaps?
       str = [str lowercaseString];

+ 4 - 1
panda/src/collide/collisionTraverser.cxx

@@ -248,7 +248,10 @@ clear_colliders() {
 }
 
 /**
- *
+ * Perform the traversal. Begins at the indicated root and detects all
+ * collisions with any of its collider objects against nodes at or below the
+ * indicated root, calling the appropriate CollisionHandler for each detected
+ * collision.
  */
 void CollisionTraverser::
 traverse(const NodePath &root) {

+ 4 - 0
panda/src/device/evdevInputDevice.cxx

@@ -595,6 +595,8 @@ init_device() {
               _buttons.push_back(ButtonState(GamepadButton::hat_left()));
               _buttons.push_back(ButtonState(GamepadButton::hat_right()));
             }
+            _buttons[_dpad_left_button]._state = S_up;
+            _buttons[_dpad_left_button+1]._state = S_up;
           }
           break;
         case ABS_HAT0Y:
@@ -608,6 +610,8 @@ init_device() {
               _buttons.push_back(ButtonState(GamepadButton::hat_up()));
               _buttons.push_back(ButtonState(GamepadButton::hat_down()));
             }
+            _buttons[_dpad_up_button]._state = S_up;
+            _buttons[_dpad_up_button+1]._state = S_up;
           }
           break;
         case ABS_HAT2X:

+ 4 - 0
panda/src/device/linuxJoystickDevice.cxx

@@ -234,6 +234,8 @@ open_device() {
             add_button(GamepadButton::hat_left());
             add_button(GamepadButton::hat_right());
           }
+          _buttons[_dpad_left_button]._state = S_up;
+          _buttons[_dpad_left_button+1]._state = S_up;
           axis = Axis::none;
         }
         break;
@@ -250,6 +252,8 @@ open_device() {
             add_button(GamepadButton::hat_up());
             add_button(GamepadButton::hat_down());
           }
+          _buttons[_dpad_up_button]._state = S_up;
+          _buttons[_dpad_up_button+1]._state = S_up;
           axis = Axis::none;
         }
         break;

+ 4 - 4
panda/src/gobj/geomVertexArrayData.cxx

@@ -23,7 +23,7 @@
 #include "configVariableInt.h"
 #include "simpleAllocator.h"
 #include "vertexDataBuffer.h"
-#include "texture.h"
+#include "pbitops.h"
 
 using std::max;
 using std::min;
@@ -631,7 +631,7 @@ set_num_rows(int n) {
     if (new_size > orig_reserved_size) {
       // Add more rows.  Go up to the next power of two bytes, mainly to
       // reduce the number of allocs needed.
-      size_t new_reserved_size = (size_t)Texture::up_to_power_2((int)new_size);
+      size_t new_reserved_size = (size_t)1 << get_next_higher_bit(new_size - 1);
       nassertr(new_reserved_size >= new_size, false);
 
       _cdata->_buffer.clean_realloc(new_reserved_size);
@@ -818,7 +818,7 @@ copy_subdata_from(size_t to_start, size_t to_size,
     size_t needed_size = to_buffer_orig_size + from_size - to_size;
     size_t to_buffer_orig_reserved_size = to_buffer.get_reserved_size();
     if (needed_size > to_buffer_orig_reserved_size) {
-      size_t new_reserved_size = (size_t)Texture::up_to_power_2((int)needed_size);
+      size_t new_reserved_size = (size_t)1 << get_next_higher_bit(needed_size - 1);
       to_buffer.clean_realloc(new_reserved_size);
     }
     to_buffer.set_size(needed_size);
@@ -891,7 +891,7 @@ set_subdata(size_t start, size_t size, const vector_uchar &data) {
     size_t needed_size = to_buffer_orig_size + from_size - size;
     size_t to_buffer_orig_reserved_size = to_buffer.get_reserved_size();
     if (needed_size > to_buffer_orig_reserved_size) {
-      size_t new_reserved_size = (size_t)Texture::up_to_power_2((int)needed_size);
+      size_t new_reserved_size = (size_t)1 << get_next_higher_bit(needed_size - 1);
       to_buffer.clean_realloc(new_reserved_size);
     }
     to_buffer.set_size(needed_size);

Some files were not shown because too many files changed in this diff