Skip to content

Commit 0ac3618

Browse files
committed
Merge branch 'release/1.10.x'
2 parents 5d6b4f4 + 7f0ac22 commit 0ac3618

File tree

13 files changed

+178
-65
lines changed

13 files changed

+178
-65
lines changed

direct/src/gui/DirectOptionMenu.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ def __init__(self, parent = None, **kw):
2222
# List of items to display on the popup menu
2323
('items', [], self.setItems),
2424
# Initial item to display on menu button
25-
# Can be an interger index or the same string as the button
25+
# Can be an integer index or the same string as the button
2626
('initialitem', None, DGG.INITOPT),
2727
# Amount of padding to place around popup button indicator
2828
('popupMarkerBorder', (.1, .1), None),
29+
# The initial position of the popup marker
30+
('popupMarker_pos', (0, 0, 0), None),
2931
# Background color to use to highlight popup menu items
3032
('highlightColor', (.5, .5, .5, 1), None),
3133
# Extra scale to use on highlight popup menu items
@@ -42,6 +44,8 @@ def __init__(self, parent = None, **kw):
4244
DirectButton.__init__(self, parent)
4345
# Record any user specified frame size
4446
self.initFrameSize = self['frameSize']
47+
# Record any user specified popup marker position
48+
self.initPopupMarkerPos = self['popupMarker_pos']
4549
# Create a small rectangular marker to distinguish this button
4650
# as a popup menu button
4751
self.popupMarker = self.createcomponent(
@@ -168,8 +172,13 @@ def setItems(self):
168172
else:
169173
# Or base it upon largest item
170174
bounds = [self.minX, self.maxX, self.minZ, self.maxZ]
171-
pm.setPos(bounds[1] + pmw/2.0, 0,
172-
bounds[2] + (bounds[3] - bounds[2])/2.0)
175+
if self.initPopupMarkerPos:
176+
# Use specified position
177+
pmPos = list(self.initPopupMarkerPos)
178+
else:
179+
# Or base the position on the frame size.
180+
pmPos = [bounds[1] + pmw/2.0, 0, bounds[2] + (bounds[3] - bounds[2])/2.0]
181+
pm.setPos(pmPos[0], pmPos[1], pmPos[2])
173182
# Adjust popup menu button to fit all items (or use user specified
174183
# frame size
175184
bounds[1] += pmw
@@ -184,6 +193,12 @@ def showPopupMenu(self, event = None):
184193
Adjust popup position if default position puts it outside of
185194
visible screen region
186195
"""
196+
197+
# Needed attributes (such as minZ) won't be set unless the user has specified
198+
# items to display. Let's assert that we've given items to work with.
199+
items = self['items']
200+
assert items and len(items) > 0, 'Cannot show an empty popup menu! You must add items!'
201+
187202
# Show the menu
188203
self.popupMenu.show()
189204
# Make sure its at the right scale

direct/src/showbase/SfxPlayer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def getLocalizedVolume(self, node, listenerNode = None, cutoff = None):
5353
d = node.getDistance(listenerNode)
5454
else:
5555
d = node.getDistance(base.cam)
56+
if not cutoff:
57+
cutoff = self.cutoffDistance
5658
if d == None or d > cutoff:
5759
volume = 0
5860
else:
@@ -70,9 +72,6 @@ def playSfx(
7072
self, sfx, looping = 0, interrupt = 1, volume = None,
7173
time = 0.0, node=None, listenerNode = None, cutoff = None):
7274
if sfx:
73-
if not cutoff:
74-
cutoff = self.cutoffDistance
75-
7675
self.setFinalVolume(sfx, node, volume, listenerNode, cutoff)
7776

7877
# don't start over if it's already playing, unless

direct/src/tkpanels/AnimPanel.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99
# Import Tkinter, Pmw, and the floater code from this directory tree.
1010
from direct.tkwidgets.AppShell import *
1111
from direct.showbase.TkGlobal import *
12-
import Pmw, sys
12+
import Pmw, sys, os
1313
from direct.task import Task
14+
from panda3d.core import Filename, getModelPath
1415

1516
if sys.version_info >= (3, 0):
1617
from tkinter.simpledialog import askfloat
18+
from tkinter.filedialog import askopenfilename
1719
else:
1820
from tkSimpleDialog import askfloat
21+
from tkFileDialog import askopenfilename
1922

2023

2124
FRAMES = 0
@@ -273,7 +276,7 @@ def loadAnim(self):
273276
title = 'Load Animation',
274277
parent = self.component('hull')
275278
)
276-
if (animFilename == ''):
279+
if not animFilename:
277280
# no file selected, canceled
278281
return
279282

@@ -369,8 +372,9 @@ def setDestroyCallBack(self, callBack):
369372
def destroy(self):
370373
# First clean up
371374
taskMgr.remove(self.id + '_UpdateTask')
372-
self.destroyCallBack()
373-
self.destroyCallBack = None
375+
if self.destroyCallBack is not None:
376+
self.destroyCallBack()
377+
self.destroyCallBack = None
374378
AppShell.destroy(self)
375379

376380
class ActorControl(Pmw.MegaWidget):

direct/src/tkwidgets/Valuator.py

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -656,25 +656,35 @@ def printToLog():
656656
pButton.pack(expand = 1, fill = BOTH)
657657

658658
# Update menu
659-
menu = vgp.component('menubar').component('Valuator Group-menu')
659+
menubar = vgp.component('menubar')
660+
menubar.deletemenuitems('Valuator Group', 1, 1)
661+
660662
# Some helper functions
661663
# Clear color
662-
menu.insert_command(index = 1, label = 'Clear Color',
663-
command = lambda: nodePath.clearColor())
664+
menubar.addmenuitem(
665+
'Valuator Group', 'command',
666+
label='Clear Color', command=lambda: nodePath.clearColor())
664667
# Set Clear Transparency
665-
menu.insert_command(index = 2, label = 'Set Transparency',
666-
command = lambda: nodePath.setTransparency(1))
667-
menu.insert_command(
668-
index = 3, label = 'Clear Transparency',
669-
command = lambda: nodePath.clearTransparency())
668+
menubar.addmenuitem(
669+
'Valuator Group', 'command',
670+
label='Set Transparency', command=lambda: nodePath.setTransparency(1))
671+
menubar.addmenuitem(
672+
'Valuator Group', 'command',
673+
label='Clear Transparency', command=lambda: nodePath.clearTransparency())
670674

671675

672676
# System color picker
673-
menu.insert_command(index = 4, label = 'Popup Color Picker',
674-
command = popupColorPicker)
677+
menubar.addmenuitem(
678+
'Valuator Group', 'command',
679+
label='Popup Color Picker', command=popupColorPicker)
680+
681+
menubar.addmenuitem(
682+
'Valuator Group', 'command',
683+
label='Print to log', command=printToLog)
675684

676-
menu.insert_command(index = 5, label = 'Print to log',
677-
command = printToLog)
685+
menubar.addmenuitem(
686+
'Valuator Group', 'command', 'Dismiss Valuator Group panel',
687+
label='Dismiss', command=vgp.destroy)
678688

679689
def setNodePathColor(color):
680690
nodePath.setColor(color[0]/255.0, color[1]/255.0,
@@ -724,18 +734,23 @@ def printToLog():
724734
# Update menu button
725735
vgp.component('menubar').component('Valuator Group-button')['text'] = (
726736
'Light Control Panel')
737+
727738
# Add a print button which will also serve as a color tile
728739
pButton = Button(vgp.interior(), text = 'Print to Log',
729740
bg = getTkColorString(initColor),
730741
command = printToLog)
731742
pButton.pack(expand = 1, fill = BOTH)
743+
732744
# Update menu
733-
menu = vgp.component('menubar').component('Valuator Group-menu')
745+
menubar = vgp.component('menubar')
734746
# System color picker
735-
menu.insert_command(index = 4, label = 'Popup Color Picker',
736-
command = popupColorPicker)
737-
menu.insert_command(index = 5, label = 'Print to log',
738-
command = printToLog)
747+
menubar.addmenuitem(
748+
'Valuator Group', 'command',
749+
label='Popup Color Picker', command=popupColorPicker)
750+
menubar.addmenuitem(
751+
'Valuator Group', 'command',
752+
label='Print to log', command=printToLog)
753+
739754
def setLightColor(color):
740755
light.setColor(Vec4(color[0]/255.0, color[1]/255.0,
741756
color[2]/255.0, color[3]/255.0))

dtool/src/interrogate/interfaceMakerPythonNative.cxx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4952,13 +4952,14 @@ write_function_instance(ostream &out, FunctionRemap *remap,
49524952
expected_params += "NoneType";
49534953

49544954
} else if (TypeManager::is_char(type)) {
4955-
indent(out, indent_level) << "char " << param_name << default_expr << ";\n";
4955+
indent(out, indent_level) << "char *" << param_name << "_str;\n";
4956+
indent(out, indent_level) << "Py_ssize_t " << param_name << "_len;\n";
49564957

4957-
format_specifiers += "c";
4958-
parameter_list += ", &" + param_name;
4958+
format_specifiers += "s#";
4959+
parameter_list += ", &" + param_name + "_str, &" + param_name + "_len";
4960+
extra_param_check << " && " << param_name << "_len == 1";
49594961

4960-
// extra_param_check << " && isascii(" << param_name << ")";
4961-
pexpr_string = "(char) " + param_name;
4962+
pexpr_string = param_name + "_str[0]";
49624963
expected_params += "char";
49634964
only_pyobjects = false;
49644965

makepanda/test_wheel.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,34 @@
1717
def test_wheel(wheel, verbose=False):
1818
envdir = tempfile.mkdtemp(prefix="venv-")
1919
print("Setting up virtual environment in {0}".format(envdir))
20+
sys.stdout.flush()
2021

22+
# Make sure pip is up-to-date first.
23+
subprocess.call([sys.executable, "-B", "-m", "pip", "install", "-U", "pip"])
24+
25+
# Create a virtualenv.
2126
if sys.version_info >= (3, 0):
22-
subprocess.call([sys.executable, "-m", "venv", "--clear", envdir])
27+
subprocess.call([sys.executable, "-B", "-m", "venv", "--clear", envdir])
2328
else:
24-
subprocess.call([sys.executable, "-m", "virtualenv", "--clear", envdir])
29+
subprocess.call([sys.executable, "-B", "-m", "virtualenv", "--clear", envdir])
2530

26-
# Make sure pip is up-to-date first.
27-
if subprocess.call([sys.executable, "-m", "pip", "install", "-U", "pip"]) != 0:
31+
# Determine the path to the Python interpreter.
32+
if sys.platform == "win32":
33+
python = os.path.join(envdir, "Scripts", "python.exe")
34+
else:
35+
python = os.path.join(envdir, "bin", "python")
36+
37+
# Upgrade pip inside the environment too.
38+
if subprocess.call([python, "-m", "pip", "install", "-U", "pip"]) != 0:
2839
shutil.rmtree(envdir)
2940
sys.exit(1)
3041

3142
# Install pytest into the environment, as well as our wheel.
32-
if sys.platform == "win32":
33-
pip = os.path.join(envdir, "Scripts", "pip.exe")
34-
else:
35-
pip = os.path.join(envdir, "bin", "pip")
36-
if subprocess.call([pip, "install", "pytest", wheel]) != 0:
43+
if subprocess.call([python, "-m", "pip", "install", "pytest", wheel]) != 0:
3744
shutil.rmtree(envdir)
3845
sys.exit(1)
3946

4047
# Run the test suite.
41-
if sys.platform == "win32":
42-
python = os.path.join(envdir, "Scripts", "python.exe")
43-
else:
44-
python = os.path.join(envdir, "bin", "python")
4548
test_cmd = [python, "-m", "pytest", "tests"]
4649
if verbose:
4750
test_cmd.append("--verbose")

panda/src/collide/collisionTraverser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class EXPCL_PANDA_COLLIDE CollisionTraverser : public Namable {
5151
INLINE bool get_respect_prev_transform() const;
5252
MAKE_PROPERTY(respect_prev_transform, get_respect_prev_transform,
5353
set_respect_prev_transform);
54+
MAKE_PROPERTY(respect_prev_transform, get_respect_prev_transform,
55+
set_respect_prev_transform);
5456

5557
void add_collider(const NodePath &collider, CollisionHandler *handler);
5658
bool remove_collider(const NodePath &collider);

panda/src/device/evdevInputDevice.cxx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ enum QuirkBits {
6262
// We only connect it if it is reporting any events, because when Steam is
6363
// running, the Steam controller is muted in favour of a dummy Xbox device.
6464
QB_steam_controller = 32,
65+
66+
// Axes on the right stick are swapped, using x for y and vice versa.
67+
QB_right_axes_swapped = 64,
6568
};
6669

6770
static const struct DeviceMapping {
@@ -81,7 +84,7 @@ static const struct DeviceMapping {
8184
// Steam Controller (wireless)
8285
{0x28de, 0x1142, InputDevice::DeviceClass::unknown, QB_steam_controller},
8386
// Jess Tech Colour Rumble Pad
84-
{0x0f30, 0x0111, InputDevice::DeviceClass::gamepad, 0},
87+
{0x0f30, 0x0111, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_right_axes_swapped},
8588
// SPEED Link SL-6535-SBK-01
8689
{0x0079, 0x0006, InputDevice::DeviceClass::gamepad, 0},
8790
// 8bitdo N30 Pro Controller
@@ -488,7 +491,11 @@ init_device() {
488491
break;
489492
case ABS_Z:
490493
if (quirks & QB_rstick_from_z) {
491-
axis = InputDevice::Axis::right_x;
494+
if (quirks & QB_right_axes_swapped) {
495+
axis = InputDevice::Axis::right_y;
496+
} else {
497+
axis = InputDevice::Axis::right_x;
498+
}
492499
} else if (_device_class == DeviceClass::gamepad) {
493500
axis = InputDevice::Axis::left_trigger;
494501
have_analog_triggers = true;
@@ -514,7 +521,11 @@ init_device() {
514521
break;
515522
case ABS_RZ:
516523
if (quirks & QB_rstick_from_z) {
517-
axis = InputDevice::Axis::right_y;
524+
if (quirks & QB_right_axes_swapped) {
525+
axis = InputDevice::Axis::right_x;
526+
} else {
527+
axis = InputDevice::Axis::right_y;
528+
}
518529
} else if (_device_class == DeviceClass::gamepad) {
519530
axis = InputDevice::Axis::right_trigger;
520531
have_analog_triggers = true;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy