Skip to content

Commit

Permalink
Merge branch 'master' into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
CFSworks committed Jun 4, 2019
2 parents 81f0fb7 + 2f97b76 commit 039f5af
Show file tree
Hide file tree
Showing 107 changed files with 2,260 additions and 365 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -4,11 +4,12 @@
/targetroot/
/dstroot/

# Core dumps
# Core dumps and traces
core
core.*
vgcore.*
*.core
*.trace

# Editor files/directories
*.save
Expand All @@ -26,6 +27,7 @@ vgcore.*
/+DESC
/+MANIFEST
/pkg-plist
/debug.ks

# Produced installer/executables
/*.exe
Expand All @@ -36,6 +38,7 @@ vgcore.*
/*.dmg
/*.whl
/*.txz
/*.apk

# CMake
/build/
Expand Down
1 change: 1 addition & 0 deletions BACKERS.md
Expand Up @@ -22,6 +22,7 @@ This is a list of all the people who are contributing financially to Panda3D. I
![Benefactors](https://opencollective.com/panda3d/tiers/benefactor.svg?avatarHeight=48&width=600)

* Sam Edwards
* Max Voss

## Backers

Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -24,7 +24,7 @@ Installing Panda3D
==================

The latest Panda3D SDK can be downloaded from
[this page](https://www.panda3d.org/download/sdk-1-10-2/).
[this page](https://www.panda3d.org/download/sdk-1-10-3/).
If you are familiar with installing Python packages, you can use
the following comand:

Expand Down Expand Up @@ -64,8 +64,8 @@ depending on whether you are on a 32-bit or 64-bit system, or you can
[click here](https://github.com/rdb/panda3d-thirdparty) for instructions on
building them from source.

https://www.panda3d.org/download/panda3d-1.10.2/panda3d-1.10.2-tools-win64.zip
https://www.panda3d.org/download/panda3d-1.10.2/panda3d-1.10.2-tools-win32.zip
https://www.panda3d.org/download/panda3d-1.10.3/panda3d-1.10.3-tools-win64.zip
https://www.panda3d.org/download/panda3d-1.10.3/panda3d-1.10.3-tools-win32.zip

After acquiring these dependencies, you may simply build Panda3D from the
command prompt using the following command. (Change `14.1` to `14` if you are
Expand Down Expand Up @@ -135,7 +135,7 @@ macOS
-----

On macOS, you will need to download a set of precompiled thirdparty packages in order to
compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.10.2/panda3d-1.10.2-tools-mac.tar.gz).
compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.10.3/panda3d-1.10.3-tools-mac.tar.gz).

After placing the thirdparty directory inside the panda3d source directory,
you may build Panda3D using a command like the following:
Expand Down
14 changes: 13 additions & 1 deletion direct/src/dist/commands.py
Expand Up @@ -13,6 +13,7 @@
import struct
import imp
import string
import time

import setuptools
import distutils.log
Expand All @@ -30,6 +31,15 @@
# Python 3 defines these subtypes of IOError, but Python 2 doesn't.
FileNotFoundError = IOError

# Warn the user. They might be using Python 2 by accident.
print("=================================================================")
print("WARNING: You are using Python 2, which will soon be discontinued.")
print("WARNING: Please use Python 3 for best results and continued")
print("WARNING: support after the EOL date of December 31st, 2019.")
print("=================================================================")
sys.stdout.flush()
time.sleep(4.0)


def _parse_list(input):
if isinstance(input, basestring):
Expand Down Expand Up @@ -229,7 +239,9 @@ def initialize_options(self):
self.requirements_path = os.path.join(os.getcwd(), 'requirements.txt')
self.use_optimized_wheels = True
self.optimized_wheel_index = ''
self.pypi_extra_indexes = []
self.pypi_extra_indexes = [
'https://archive.panda3d.org/thirdparty',
]
self.file_handlers = {}
self.exclude_dependencies = [
# Windows
Expand Down
19 changes: 14 additions & 5 deletions direct/src/filter/FilterManager.py
Expand Up @@ -124,7 +124,7 @@ def getScaledSize(self, mul, div, align):

return winx,winy

def renderSceneInto(self, depthtex=None, colortex=None, auxtex=None, auxbits=0, textures=None):
def renderSceneInto(self, depthtex=None, colortex=None, auxtex=None, auxbits=0, textures=None, fbprops=None):

""" Causes the scene to be rendered into the supplied textures
instead of into the original window. Puts a fullscreen quad
Expand Down Expand Up @@ -185,7 +185,10 @@ def renderSceneInto(self, depthtex=None, colortex=None, auxtex=None, auxbits=0,
# Choose the size of the offscreen buffer.

(winx, winy) = self.getScaledSize(1,1,1)
buffer = self.createBuffer("filter-base", winx, winy, texgroup)
if fbprops is not None:
buffer = self.createBuffer("filter-base", winx, winy, texgroup, fbprops=fbprops)
else:
buffer = self.createBuffer("filter-base", winx, winy, texgroup)

if (buffer == None):
return None
Expand Down Expand Up @@ -236,7 +239,7 @@ def renderSceneInto(self, depthtex=None, colortex=None, auxtex=None, auxbits=0,

return quad

def renderQuadInto(self, name="filter-stage", mul=1, div=1, align=1, depthtex=None, colortex=None, auxtex0=None, auxtex1=None):
def renderQuadInto(self, name="filter-stage", mul=1, div=1, align=1, depthtex=None, colortex=None, auxtex0=None, auxtex1=None, fbprops=None):

""" Creates an offscreen buffer for an intermediate
computation. Installs a quad into the buffer. Returns
Expand All @@ -250,7 +253,10 @@ def renderQuadInto(self, name="filter-stage", mul=1, div=1, align=1, depthtex=No

depthbits = bool(depthtex != None)

buffer = self.createBuffer(name, winx, winy, texgroup, depthbits)
if fbprops is not None:
buffer = self.createBuffer(name, winx, winy, texgroup, depthbits, fbprops=fbprops)
else:
buffer = self.createBuffer(name, winx, winy, texgroup, depthbits)

if (buffer == None):
return None
Expand Down Expand Up @@ -287,7 +293,7 @@ def renderQuadInto(self, name="filter-stage", mul=1, div=1, align=1, depthtex=No

return quad

def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1, fbprops=None):
""" Low-level buffer creation. Not intended for public use. """

winprops = WindowProperties()
Expand All @@ -297,6 +303,9 @@ def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
props.setRgbColor(1)
props.setDepthBits(depthbits)
props.setStereo(self.win.isStereo())
if fbprops is not None:
props.addProperties(fbprops)

depthtex, colortex, auxtex0, auxtex1 = texgroup
if (auxtex0 != None):
props.setAuxRgba(1)
Expand Down
21 changes: 18 additions & 3 deletions direct/src/gui/DirectOptionMenu.py
Expand Up @@ -22,10 +22,12 @@ def __init__(self, parent = None, **kw):
# List of items to display on the popup menu
('items', [], self.setItems),
# Initial item to display on menu button
# Can be an interger index or the same string as the button
# Can be an integer index or the same string as the button
('initialitem', None, DGG.INITOPT),
# Amount of padding to place around popup button indicator
('popupMarkerBorder', (.1, .1), None),
# The initial position of the popup marker
('popupMarker_pos', (0, 0, 0), None),
# Background color to use to highlight popup menu items
('highlightColor', (.5, .5, .5, 1), None),
# Extra scale to use on highlight popup menu items
Expand All @@ -42,6 +44,8 @@ def __init__(self, parent = None, **kw):
DirectButton.__init__(self, parent)
# Record any user specified frame size
self.initFrameSize = self['frameSize']
# Record any user specified popup marker position
self.initPopupMarkerPos = self['popupMarker_pos']
# Create a small rectangular marker to distinguish this button
# as a popup menu button
self.popupMarker = self.createcomponent(
Expand Down Expand Up @@ -168,8 +172,13 @@ def setItems(self):
else:
# Or base it upon largest item
bounds = [self.minX, self.maxX, self.minZ, self.maxZ]
pm.setPos(bounds[1] + pmw/2.0, 0,
bounds[2] + (bounds[3] - bounds[2])/2.0)
if self.initPopupMarkerPos:
# Use specified position
pmPos = list(self.initPopupMarkerPos)
else:
# Or base the position on the frame size.
pmPos = [bounds[1] + pmw/2.0, 0, bounds[2] + (bounds[3] - bounds[2])/2.0]
pm.setPos(pmPos[0], pmPos[1], pmPos[2])
# Adjust popup menu button to fit all items (or use user specified
# frame size
bounds[1] += pmw
Expand All @@ -184,6 +193,12 @@ def showPopupMenu(self, event = None):
Adjust popup position if default position puts it outside of
visible screen region
"""

# Needed attributes (such as minZ) won't be set unless the user has specified
# items to display. Let's assert that we've given items to work with.
items = self['items']
assert items and len(items) > 0, 'Cannot show an empty popup menu! You must add items!'

# Show the menu
self.popupMenu.show()
# Make sure its at the right scale
Expand Down
5 changes: 2 additions & 3 deletions direct/src/showbase/SfxPlayer.py
Expand Up @@ -53,6 +53,8 @@ def getLocalizedVolume(self, node, listenerNode = None, cutoff = None):
d = node.getDistance(listenerNode)
else:
d = node.getDistance(base.cam)
if not cutoff:
cutoff = self.cutoffDistance
if d == None or d > cutoff:
volume = 0
else:
Expand All @@ -70,9 +72,6 @@ def playSfx(
self, sfx, looping = 0, interrupt = 1, volume = None,
time = 0.0, node=None, listenerNode = None, cutoff = None):
if sfx:
if not cutoff:
cutoff = self.cutoffDistance

self.setFinalVolume(sfx, node, volume, listenerNode, cutoff)

# don't start over if it's already playing, unless
Expand Down
24 changes: 18 additions & 6 deletions direct/src/showbase/ShowBase.py
Expand Up @@ -829,9 +829,11 @@ def _doOpenWindow(self, props = None, fbprops = None, pipe = None,
win.requestProperties(props)

mainWindow = False
if self.win == None:
if self.win is None:
mainWindow = True
self.win = win
if hasattr(self, 'bufferViewer'):
self.bufferViewer.win = win

self.winList.append(win)

Expand Down Expand Up @@ -1677,13 +1679,19 @@ def getMeta(self):
return self.mouseWatcherNode.getModifierButtons().isDown(
KeyboardButton.meta())

def attachInputDevice(self, device, prefix=None):
def attachInputDevice(self, device, prefix=None, watch=False):
"""
This function attaches an input device to the data graph, which will
cause the device to be polled and generate events. If a prefix is
given and not None, it is used to prefix events generated by this
device, separated by a hyphen.
The watch argument can be set to True (as of Panda3D 1.10.3) to set up
the default MouseWatcher to receive inputs from this device, allowing
it to be polled via mouseWatcherNode and control user interfaces.
Setting this to True will also make it generate unprefixed events,
regardless of the specified prefix.
If you call this, you should consider calling detachInputDevice when
you are done with the device or when it is disconnected.
"""
Expand All @@ -1694,13 +1702,17 @@ def attachInputDevice(self, device, prefix=None):
idn = self.dataRoot.attachNewNode(InputDeviceNode(device, device.name))

# Setup the button thrower to generate events for the device.
bt = idn.attachNewNode(ButtonThrower(device.name))
if prefix is not None:
bt.node().setPrefix(prefix + '-')
if prefix is not None or not watch:
bt = idn.attachNewNode(ButtonThrower(device.name))
if prefix is not None:
bt.node().setPrefix(prefix + '-')
self.deviceButtonThrowers.append(bt)

assert self.notify.debug("Attached input device {0} with prefix {1}".format(device, prefix))
self.__inputDeviceNodes[device] = idn
self.deviceButtonThrowers.append(bt)

if watch:
idn.node().addChild(self.mouseWatcherNode)

def detachInputDevice(self, device):
"""
Expand Down
23 changes: 0 additions & 23 deletions direct/src/stdpy/threading.py
Expand Up @@ -201,17 +201,6 @@ class Lock(core.Mutex):
def __init__(self, name = "PythonLock"):
core.Mutex.__init__(self, name)

def acquire(self, blocking = True):
if blocking:
core.Mutex.acquire(self)
return True
else:
return core.Mutex.tryAcquire(self)

__enter__ = acquire

def __exit__(self, t, v, tb):
self.release()

class RLock(core.ReMutex):
""" This class provides a wrapper around Panda's ReMutex object.
Expand All @@ -221,18 +210,6 @@ class RLock(core.ReMutex):
def __init__(self, name = "PythonRLock"):
core.ReMutex.__init__(self, name)

def acquire(self, blocking = True):
if blocking:
core.ReMutex.acquire(self)
return True
else:
return core.ReMutex.tryAcquire(self)

__enter__ = acquire

def __exit__(self, t, v, tb):
self.release()


class Condition(core.ConditionVarFull):
""" This class provides a wrapper around Panda's ConditionVarFull
Expand Down
12 changes: 8 additions & 4 deletions direct/src/tkpanels/AnimPanel.py
Expand Up @@ -9,13 +9,16 @@
# Import Tkinter, Pmw, and the floater code from this directory tree.
from direct.tkwidgets.AppShell import *
from direct.showbase.TkGlobal import *
import Pmw, sys
import Pmw, sys, os
from direct.task import Task
from panda3d.core import Filename, getModelPath

if sys.version_info >= (3, 0):
from tkinter.simpledialog import askfloat
from tkinter.filedialog import askopenfilename
else:
from tkSimpleDialog import askfloat
from tkFileDialog import askopenfilename


FRAMES = 0
Expand Down Expand Up @@ -273,7 +276,7 @@ def loadAnim(self):
title = 'Load Animation',
parent = self.component('hull')
)
if (animFilename == ''):
if not animFilename:
# no file selected, canceled
return

Expand Down Expand Up @@ -369,8 +372,9 @@ def setDestroyCallBack(self, callBack):
def destroy(self):
# First clean up
taskMgr.remove(self.id + '_UpdateTask')
self.destroyCallBack()
self.destroyCallBack = None
if self.destroyCallBack is not None:
self.destroyCallBack()
self.destroyCallBack = None
AppShell.destroy(self)

class ActorControl(Pmw.MegaWidget):
Expand Down

0 comments on commit 039f5af

Please sign in to comment.