mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Merge branch 'release/1.10.x'
This commit is contained in:
commit
dcc08ac572
File diff suppressed because it is too large
Load Diff
@ -327,7 +327,10 @@ class TexMemWatcher(DirectObject):
|
|||||||
|
|
||||||
if self.dynamicLimit:
|
if self.dynamicLimit:
|
||||||
# Choose a suitable limit by rounding to the next power of two.
|
# 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
|
# Set our GSG to limit itself to no more textures than we
|
||||||
# expect to display onscreen, so we don't go crazy with
|
# expect to display onscreen, so we don't go crazy with
|
||||||
@ -883,7 +886,7 @@ class TexMemWatcher(DirectObject):
|
|||||||
matches.append((match, tp))
|
matches.append((match, tp))
|
||||||
|
|
||||||
if matches:
|
if matches:
|
||||||
return max(matches)[1]
|
return max(matches, key=lambda match: match[0])[1]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def findHolePieces(self, area):
|
def findHolePieces(self, area):
|
||||||
@ -937,7 +940,7 @@ class TexMemWatcher(DirectObject):
|
|||||||
def findLargestHole(self):
|
def findLargestHole(self):
|
||||||
holes = self.findAvailableHoles(0)
|
holes = self.findAvailableHoles(0)
|
||||||
if holes:
|
if holes:
|
||||||
return max(holes)[1]
|
return max(holes, key=lambda hole: hole[0])[1]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def findAvailableHoles(self, area, w = None, h = None):
|
def findAvailableHoles(self, area, w = None, h = None):
|
||||||
|
@ -564,6 +564,7 @@ def makewheel(version, output_dir, platform=None):
|
|||||||
libs_dir = join(output_dir, "bin")
|
libs_dir = join(output_dir, "bin")
|
||||||
else:
|
else:
|
||||||
libs_dir = join(output_dir, "lib")
|
libs_dir = join(output_dir, "lib")
|
||||||
|
ext_mod_dir = get_python_ext_module_dir()
|
||||||
license_src = "LICENSE"
|
license_src = "LICENSE"
|
||||||
readme_src = "README.md"
|
readme_src = "README.md"
|
||||||
|
|
||||||
@ -595,7 +596,7 @@ def makewheel(version, output_dir, platform=None):
|
|||||||
whl.lib_path = [libs_dir]
|
whl.lib_path = [libs_dir]
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
whl.lib_path.append(join(output_dir, "python", "DLLs"))
|
whl.lib_path.append(ext_mod_dir)
|
||||||
|
|
||||||
if platform.startswith("manylinux"):
|
if platform.startswith("manylinux"):
|
||||||
# On manylinux1, we pick up all libraries except for the ones specified
|
# 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
|
# And copy the extension modules from the Python installation into the
|
||||||
# deploy_libs directory, for use by deploy-ng.
|
# deploy_libs directory, for use by deploy-ng.
|
||||||
ext_suffix = '.pyd' if sys.platform in ('win32', 'cygwin') else '.so'
|
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):
|
for file in os.listdir(ext_mod_dir):
|
||||||
if file.endswith(ext_suffix):
|
if file.endswith(ext_suffix):
|
||||||
|
@ -1690,20 +1690,19 @@ handle_key_event(NSEvent *event) {
|
|||||||
return;
|
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) {
|
if ([event type] == NSKeyDown) {
|
||||||
// Translate it to a unicode character for keystrokes. I would use
|
// Translate it to a unicode character for keystrokes. I would use
|
||||||
// interpretKeyEvents and insertText, but that doesn't handle dead keys.
|
// 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;
|
UInt32 modifier_state = (modifierFlags >> 16) & 0xFF;
|
||||||
UniChar ustr[8];
|
UniChar ustr[8];
|
||||||
UniCharCount length;
|
UniCharCount length;
|
||||||
|
|
||||||
UCKeyTranslate(layout, [event keyCode], kUCKeyActionDown, modifier_state,
|
UCKeyTranslate(layout, [event keyCode], kUCKeyActionDown, modifier_state,
|
||||||
LMGetKbdType(), 0, &_dead_key_state, sizeof(ustr), &length, ustr);
|
LMGetKbdType(), 0, &_dead_key_state, sizeof(ustr), &length, ustr);
|
||||||
CFRelease(input_source);
|
|
||||||
|
|
||||||
for (int i = 0; i < length; ++i) {
|
for (int i = 0; i < length; ++i) {
|
||||||
UniChar c = ustr[i];
|
UniChar c = ustr[i];
|
||||||
@ -1719,17 +1718,25 @@ handle_key_event(NSEvent *event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *str = [event charactersIgnoringModifiers];
|
// [NSEvent charactersIgnoringModifiers] doesn't ignore the shift key, so we
|
||||||
if (str == nil || [str length] == 0) {
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
nassertv_always([str length] == 1);
|
|
||||||
unichar c = [str characterAtIndex: 0];
|
|
||||||
|
|
||||||
ButtonHandle button = map_key(c);
|
ButtonHandle button = map_key(c);
|
||||||
|
|
||||||
if (button == ButtonHandle::none()) {
|
if (button == ButtonHandle::none()) {
|
||||||
// That done, continue trying to find out the button handle.
|
// That done, continue trying to find out the button handle.
|
||||||
|
NSString *str = [[NSString alloc] initWithCharacters:&c length:length];
|
||||||
if ([str canBeConvertedToEncoding: NSASCIIStringEncoding]) {
|
if ([str canBeConvertedToEncoding: NSASCIIStringEncoding]) {
|
||||||
// Nhm, ascii character perhaps?
|
// Nhm, ascii character perhaps?
|
||||||
str = [str lowercaseString];
|
str = [str lowercaseString];
|
||||||
|
@ -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::
|
void CollisionTraverser::
|
||||||
traverse(const NodePath &root) {
|
traverse(const NodePath &root) {
|
||||||
|
@ -595,6 +595,8 @@ init_device() {
|
|||||||
_buttons.push_back(ButtonState(GamepadButton::hat_left()));
|
_buttons.push_back(ButtonState(GamepadButton::hat_left()));
|
||||||
_buttons.push_back(ButtonState(GamepadButton::hat_right()));
|
_buttons.push_back(ButtonState(GamepadButton::hat_right()));
|
||||||
}
|
}
|
||||||
|
_buttons[_dpad_left_button]._state = S_up;
|
||||||
|
_buttons[_dpad_left_button+1]._state = S_up;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ABS_HAT0Y:
|
case ABS_HAT0Y:
|
||||||
@ -608,6 +610,8 @@ init_device() {
|
|||||||
_buttons.push_back(ButtonState(GamepadButton::hat_up()));
|
_buttons.push_back(ButtonState(GamepadButton::hat_up()));
|
||||||
_buttons.push_back(ButtonState(GamepadButton::hat_down()));
|
_buttons.push_back(ButtonState(GamepadButton::hat_down()));
|
||||||
}
|
}
|
||||||
|
_buttons[_dpad_up_button]._state = S_up;
|
||||||
|
_buttons[_dpad_up_button+1]._state = S_up;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ABS_HAT2X:
|
case ABS_HAT2X:
|
||||||
|
@ -234,6 +234,8 @@ open_device() {
|
|||||||
add_button(GamepadButton::hat_left());
|
add_button(GamepadButton::hat_left());
|
||||||
add_button(GamepadButton::hat_right());
|
add_button(GamepadButton::hat_right());
|
||||||
}
|
}
|
||||||
|
_buttons[_dpad_left_button]._state = S_up;
|
||||||
|
_buttons[_dpad_left_button+1]._state = S_up;
|
||||||
axis = Axis::none;
|
axis = Axis::none;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -250,6 +252,8 @@ open_device() {
|
|||||||
add_button(GamepadButton::hat_up());
|
add_button(GamepadButton::hat_up());
|
||||||
add_button(GamepadButton::hat_down());
|
add_button(GamepadButton::hat_down());
|
||||||
}
|
}
|
||||||
|
_buttons[_dpad_up_button]._state = S_up;
|
||||||
|
_buttons[_dpad_up_button+1]._state = S_up;
|
||||||
axis = Axis::none;
|
axis = Axis::none;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "configVariableInt.h"
|
#include "configVariableInt.h"
|
||||||
#include "simpleAllocator.h"
|
#include "simpleAllocator.h"
|
||||||
#include "vertexDataBuffer.h"
|
#include "vertexDataBuffer.h"
|
||||||
#include "texture.h"
|
#include "pbitops.h"
|
||||||
|
|
||||||
using std::max;
|
using std::max;
|
||||||
using std::min;
|
using std::min;
|
||||||
@ -631,7 +631,7 @@ set_num_rows(int n) {
|
|||||||
if (new_size > orig_reserved_size) {
|
if (new_size > orig_reserved_size) {
|
||||||
// Add more rows. Go up to the next power of two bytes, mainly to
|
// Add more rows. Go up to the next power of two bytes, mainly to
|
||||||
// reduce the number of allocs needed.
|
// 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);
|
nassertr(new_reserved_size >= new_size, false);
|
||||||
|
|
||||||
_cdata->_buffer.clean_realloc(new_reserved_size);
|
_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 needed_size = to_buffer_orig_size + from_size - to_size;
|
||||||
size_t to_buffer_orig_reserved_size = to_buffer.get_reserved_size();
|
size_t to_buffer_orig_reserved_size = to_buffer.get_reserved_size();
|
||||||
if (needed_size > to_buffer_orig_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.clean_realloc(new_reserved_size);
|
||||||
}
|
}
|
||||||
to_buffer.set_size(needed_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 needed_size = to_buffer_orig_size + from_size - size;
|
||||||
size_t to_buffer_orig_reserved_size = to_buffer.get_reserved_size();
|
size_t to_buffer_orig_reserved_size = to_buffer.get_reserved_size();
|
||||||
if (needed_size > to_buffer_orig_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.clean_realloc(new_reserved_size);
|
||||||
}
|
}
|
||||||
to_buffer.set_size(needed_size);
|
to_buffer.set_size(needed_size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user