From fc5a2e5e33157449ec100af2c6f8ee09641f538a Mon Sep 17 00:00:00 2001 From: Ed Swartz Date: Thu, 23 Apr 2015 11:20:24 -0500 Subject: [PATCH 01/22] Implement confined mouse mode for OS X. Note: it seems that using #set_pointer() will result in a long delay before an absolute mouse position is updated, even though deltas are reported. Thus, in CocoaPandaView, the mouse deltas are sent for both relative and confined modes, so client code (e.g. the "mouse modes" demo) will be able to recenter the mouse without choppy movement. --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 50 +++++++++++++++++-- panda/src/cocoadisplay/cocoaPandaView.mm | 5 +- panda/src/osxdisplay/osxGraphicsWindow.mm | 19 +++++++ samples/mouse-modes/main.py | 10 ++-- 4 files changed, 76 insertions(+), 8 deletions(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index efe9849ff5..5feef27535 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -1022,6 +1022,23 @@ set_properties_now(WindowProperties &properties) { } properties.clear_z_order(); } + + if (properties.has_mouse_mode()) { + switch (properties.get_mouse_mode()) { + case WindowProperties::M_absolute: + case WindowProperties::M_confined: // confined is maintained in mouse move event + CGAssociateMouseAndMouseCursorPosition(true); + _properties.set_mouse_mode(properties.get_mouse_mode()); + properties.clear_mouse_mode(); + break; + + case WindowProperties::M_relative: + CGAssociateMouseAndMouseCursorPosition(false); + _properties.set_mouse_mode(properties.get_mouse_mode()); + properties.clear_mouse_mode(); + break; + } + } } //////////////////////////////////////////////////////////////////// @@ -1670,6 +1687,8 @@ handle_mouse_button_event(int button, bool down) { //////////////////////////////////////////////////////////////////// void CocoaGraphicsWindow:: handle_mouse_moved_event(bool in_window, double x, double y, bool absolute) { + double nx, ny; + if (absolute) { if (cocoadisplay_cat.is_spam()) { if (in_window != _input_devices[0].get_pointer().get_in_window()) { @@ -1682,15 +1701,40 @@ handle_mouse_moved_event(bool in_window, double x, double y, bool absolute) { } // Strangely enough, in Cocoa, mouse Y coordinates are 1-based. - _input_devices[0].set_pointer(in_window, x, y - 1, - ClockObject::get_global_clock()->get_frame_time()); + nx = x; + ny = y - 1; } else { // We received deltas, so add it to the current mouse position. MouseData md = _input_devices[0].get_pointer(); - _input_devices[0].set_pointer_in_window(md.get_x() + x, md.get_y() + y); + nx = md.get_x() + x; + ny = md.get_y() + y; } + if (_properties.get_mouse_mode() == WindowProperties::M_confined + && !in_window) { + CGPoint point; + + nx = std::max(0., std::min((double) get_x_size() - 1, nx)); + ny = std::max(0., std::min((double) get_y_size() - 1, ny)); + + if (_properties.get_fullscreen()) { + point = CGPointMake(nx, ny + 1); + } else { + point = CGPointMake(nx + _properties.get_x_origin(), + ny + _properties.get_y_origin() + 1); + } + + if (CGWarpMouseCursorPosition(point) == kCGErrorSuccess) { + in_window = true; + } else { + cocoadisplay_cat.warning() << "Failed to return mouse pointer to window\n"; + } + } + + _input_devices[0].set_pointer(in_window, nx, ny, + ClockObject::get_global_clock()->get_frame_time()); + if (in_window != _mouse_hidden && _properties.get_cursor_hidden()) { // Hide the cursor if the mouse enters the window, // and unhide it when the mouse leaves the window. diff --git a/panda/src/cocoadisplay/cocoaPandaView.mm b/panda/src/cocoadisplay/cocoaPandaView.mm index bb7d03c832..8fa199e5c7 100644 --- a/panda/src/cocoadisplay/cocoaPandaView.mm +++ b/panda/src/cocoadisplay/cocoaPandaView.mm @@ -116,7 +116,10 @@ NSPoint loc = [self convertPoint:[event locationInWindow] fromView:nil]; BOOL inside = [self mouse:loc inRect:[self bounds]]; - if (_graphicsWindow->get_properties().get_mouse_mode() == WindowProperties::M_relative) { + // the correlation between mouse deltas and location + // are "debounced" apparently, so send deltas for both + // relative and confined modes + if (_graphicsWindow->get_properties().get_mouse_mode() != WindowProperties::M_absolute) { _graphicsWindow->handle_mouse_moved_event(inside, [event deltaX], [event deltaY], false); } else { _graphicsWindow->handle_mouse_moved_event(inside, loc.x, loc.y, true); diff --git a/panda/src/osxdisplay/osxGraphicsWindow.mm b/panda/src/osxdisplay/osxGraphicsWindow.mm index 3b18fd3914..36db5a55ce 100644 --- a/panda/src/osxdisplay/osxGraphicsWindow.mm +++ b/panda/src/osxdisplay/osxGraphicsWindow.mm @@ -2064,6 +2064,25 @@ set_properties_now(WindowProperties &properties) { properties.clear_minimized(); } + if (properties.has_mouse_mode()) { + switch (properties.get_mouse_mode()) { + case WindowProperties::M_absolute: + CGAssociateMouseAndMouseCursorPosition(true); + _properties.set_mouse_mode(WindowProperties::M_absolute); + properties.clear_mouse_mode(); + break; + + case WindowProperties::M_relative: + CGAssociateMouseAndMouseCursorPosition(false); + _properties.set_mouse_mode(WindowProperties::M_relative); + properties.clear_mouse_mode(); + break; + + case WindowProperties::M_confined: + break; + } + } + if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() << "set_properties_now Out....." << _properties << "\n"; diff --git a/samples/mouse-modes/main.py b/samples/mouse-modes/main.py index 50e81f550e..75ddbf08ea 100644 --- a/samples/mouse-modes/main.py +++ b/samples/mouse-modes/main.py @@ -34,7 +34,8 @@ class App(ShowBase): # Disable the camera trackball controls. self.disableMouse() - self.mouseMagnitude = 144 + # control mapping of mouse movement to box movement + self.mouseMagnitude = 1 self.rotateX, self.rotateY = 0, 0 @@ -146,7 +147,8 @@ class App(ShowBase): if self.manualRecenterMouse: # move mouse back to center self.recenterMouse() - + self.lastMouseX, self.lastMouseY = 0, 0 + # scale position and delta to pixels for user w, h = self.win.getSize() @@ -158,8 +160,8 @@ class App(ShowBase): int(dx*w), int(dy*h))) # rotate box by delta - self.rotateX += dx * 10 - self.rotateY += dy * 10 + self.rotateX += dx * 10 * self.mouseMagnitude + self.rotateY += dy * 10 * self.mouseMagnitude self.positionText.setText("Model rotation: {0}, {1}".format( int(self.rotateX*1000)/1000., int(self.rotateY*1000)/1000.)) From 8746fd22523ceea7c6407d340a7b3f04249c0ee0 Mon Sep 17 00:00:00 2001 From: Ed Swartz Date: Mon, 15 Jun 2015 09:57:24 -0500 Subject: [PATCH 02/22] Explicitly resizing window does not trigger event on OS X; do it ourselves --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index efe9849ff5..e92dabdac2 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -807,6 +807,11 @@ set_properties_now(WindowProperties &properties) { cocoadisplay_cat.debug() << "Setting size to " << width << ", " << height << "\n"; + // Cocoa doesn't send an event, and the other + // resize-window handlers will do nothing once the properties + // have been changed, so do this now + set_size_and_recalc(width, height); + _context_needs_update = true; properties.clear_size(); From 4916aaca545d7c905f082f76cacae73ab494c2c2 Mon Sep 17 00:00:00 2001 From: Ed Swartz Date: Mon, 10 Aug 2015 12:12:22 -0500 Subject: [PATCH 03/22] Add 'openal-device' configuration variable for selecting OpenAL device --- panda/src/audiotraits/config_openalAudio.cxx | 6 ++ panda/src/audiotraits/config_openalAudio.h | 2 + panda/src/audiotraits/openalAudioManager.cxx | 65 +++++++++++++++++++- panda/src/audiotraits/openalAudioManager.h | 3 + 4 files changed, 74 insertions(+), 2 deletions(-) diff --git a/panda/src/audiotraits/config_openalAudio.cxx b/panda/src/audiotraits/config_openalAudio.cxx index ab89ad775f..fe8cc6e128 100644 --- a/panda/src/audiotraits/config_openalAudio.cxx +++ b/panda/src/audiotraits/config_openalAudio.cxx @@ -27,6 +27,12 @@ ConfigureFn(config_openalAudio) { init_libOpenALAudio(); } +ConfigVariableString openal_device +("openal-device", "", + PRC_DESC("Specify the OpenAL device string for audio playback (no quotes). If this " + "is not specified, the OpenAL default device is used.")); + + //////////////////////////////////////////////////////////////////// // Function: init_libOpenALAudio // Description: Initializes the library. This must be called at diff --git a/panda/src/audiotraits/config_openalAudio.h b/panda/src/audiotraits/config_openalAudio.h index 9a122e2d90..646e13bdc8 100644 --- a/panda/src/audiotraits/config_openalAudio.h +++ b/panda/src/audiotraits/config_openalAudio.h @@ -27,4 +27,6 @@ NotifyCategoryDecl(openalAudio, EXPCL_OPENAL_AUDIO, EXPTP_OPENAL_AUDIO); extern EXPCL_OPENAL_AUDIO void init_libOpenALAudio(); extern "C" EXPCL_OPENAL_AUDIO Create_AudioManager_proc *get_audio_manager_func_openal_audio(); +extern ConfigVariableString openal_device; + #endif // CONFIG_OPENALAUDIO_H diff --git a/panda/src/audiotraits/openalAudioManager.cxx b/panda/src/audiotraits/openalAudioManager.cxx index 0a8faa896d..814ef7c69e 100644 --- a/panda/src/audiotraits/openalAudioManager.cxx +++ b/panda/src/audiotraits/openalAudioManager.cxx @@ -19,6 +19,7 @@ #include "config_audio.h" #include "config_util.h" #include "config_express.h" +#include "config_openalAudio.h" #include "openalAudioManager.h" #include "openalAudioSound.h" #include "virtualFileSystem.h" @@ -117,10 +118,11 @@ OpenALAudioManager() { // Initialization if (_active_managers == 0 || !_openal_active) { - _device = alcOpenDevice(NULL); // select the "preferred device" + string dev_name = get_audio_device(); + _device = alcOpenDevice(dev_name.empty() ? NULL : dev_name.c_str()); // select the user or preferred device if (!_device) { // this is a unique kind of error - audio_error("OpenALAudioManager: alcOpenDevice(NULL): ALC couldn't open device"); + audio_cat->error() << "OpenALAudioManager: alcOpenDevice(\"" << dev_name << "\"): ALC couldn't open device" << endl; } else { alcGetError(_device); // clear errors _context = alcCreateContext(_device, NULL); @@ -212,6 +214,65 @@ is_valid() { return _is_valid; } +//////////////////////////////////////////////////////////////////// +// Function: OpenALAudioManager::get_device_list +// Access: Private +// Description: Interrogate the system for audio devices. +//////////////////////////////////////////////////////////////////// +std::vector OpenALAudioManager:: +get_device_list() { + std::vector devList; + const char* deviceList = 0; + + if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") == AL_TRUE) { + audio_cat->debug() << "Using ALC_ENUMERATE_ALL_EXT" << endl; + deviceList = (const char*) alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); + } else if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE) { + audio_cat->debug() << "Using ALC_ENUMERATION_EXT" << endl; + deviceList = (const char*) alcGetString(NULL, ALC_DEVICE_SPECIFIER); + } + + if (deviceList) { + while (*deviceList) { + string dev = deviceList; + devList.push_back(dev); + audio_cat->debug() << " " << dev << endl; + deviceList += strlen(deviceList) + 1; + } + } + return devList; +} + +//////////////////////////////////////////////////////////////////// +// Function: OpenALAudioManager::get_audio_device +// Access: Private +// Description: Fetch the audio device matching one in the +// configuration, or bail and return blank. +//////////////////////////////////////////////////////////////////// +std::string OpenALAudioManager:: +get_audio_device() { + std::vector devList = get_device_list(); + if (devList.empty()) { + audio_cat->warning() << "No devices enumerated by OpenAL; using default" << endl; + return ""; + } + + std::string device = openal_device; + if (!device.empty()) { + if (std::find(devList.begin(), devList.end(), device) == devList.end()) { + audio_cat->warning() << "Requested OpenAL device " << device << " not detected; using default." << endl; + return ""; + } + + audio_cat->info() << "Using OpenAL device " << device << endl; + return device; + } + + // default + audio_cat->info() << "Using default OpenAL device" << endl; + return ""; +} + //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::make_current // Access: Private diff --git a/panda/src/audiotraits/openalAudioManager.h b/panda/src/audiotraits/openalAudioManager.h index 0dcc0e07e2..66b7ecedd1 100644 --- a/panda/src/audiotraits/openalAudioManager.h +++ b/panda/src/audiotraits/openalAudioManager.h @@ -116,6 +116,9 @@ class EXPCL_OPENAL_AUDIO OpenALAudioManager : public AudioManager { virtual void update(); private: + std::vector get_device_list(); + std::string get_audio_device(); + void make_current() const; bool can_use_audio(MovieAudioCursor *source); From 428f4ce0509a4328284c92794e9af495326a234b Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 21 Nov 2015 12:55:49 +0100 Subject: [PATCH 04/22] Fix faulty assertion in BulletTranslationalLimitMotor (with thanks to ThomasEgi) --- panda/src/bullet/bulletTranslationalLimitMotor.I | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/bullet/bulletTranslationalLimitMotor.I b/panda/src/bullet/bulletTranslationalLimitMotor.I index 2089dd9780..6f492dac63 100644 --- a/panda/src/bullet/bulletTranslationalLimitMotor.I +++ b/panda/src/bullet/bulletTranslationalLimitMotor.I @@ -177,7 +177,7 @@ set_stop_erp(const LVecBase3 &erp) { INLINE int BulletTranslationalLimitMotor:: get_current_limit(int axis) const { - nassertr((0 <- axis) && (axis <=2), false); + nassertr((0 <= axis) && (axis <= 2), false); return _motor.m_currentLimit[axis]; } From 4d2cf29816144ed59a1f88789852b0bae64c09a3 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 21 Nov 2015 16:55:06 +0100 Subject: [PATCH 05/22] Add libRocket to PandaSystem --- panda/src/rocket/config_rocket.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/panda/src/rocket/config_rocket.cxx b/panda/src/rocket/config_rocket.cxx index 26e4a83b5c..0bb8dd1c0a 100644 --- a/panda/src/rocket/config_rocket.cxx +++ b/panda/src/rocket/config_rocket.cxx @@ -53,6 +53,10 @@ init_librocket() { RocketInputHandler::init_type(); RocketRegion::init_type(); + if (rocket_cat->is_debug()) { + rocket_cat->debug() << "Initializing libRocket library.\n"; + } + RocketFileInterface* fi = new RocketFileInterface; Rocket::Core::SetFileInterface(fi); @@ -61,6 +65,10 @@ init_librocket() { Rocket::Core::Initialise(); + // Register that we have the libRocket system. + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("libRocket"); + #ifdef COMPILE_IN_DEFAULT_FONT #ifdef HAVE_FREETYPE // Load Panda's default compiled-in freetype font (Perspective Sans). From 9eb0a9196b5dbff1c3ee0c2e38f00a8525123213 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 21 Nov 2015 16:55:27 +0100 Subject: [PATCH 06/22] Fix Mac libRocket library issues in 1.9.0 (particularly on El Capitan) --- makepanda/makepanda.py | 106 +++++++++++++++++++++++++---------------- 1 file changed, 66 insertions(+), 40 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 70109e6a56..7f65dad759 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -779,9 +779,7 @@ if (COMPILER=="GCC"): rocket_libs = ("RocketCore", "RocketControls") if (GetOptimize() <= 3): rocket_libs += ("RocketDebugger",) - if (GetHost() != "darwin"): - # We use a statically linked libboost_python on OSX - rocket_libs += ("boost_python",) + rocket_libs += ("boost_python",) SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h") if not PkgSkip("PYTHON"): @@ -2700,9 +2698,15 @@ if tp_dir is not None: dylibs = set() if GetTarget() == 'darwin': + # Make a list of all the dylibs we ship, to figure out whether we should use + # install_name_tool to correct the library reference to point to our copy. for lib in glob.glob(tp_dir + "/*/lib/*.dylib"): dylibs.add(os.path.basename(lib)) + if not PkgSkip("PYTHON"): + for lib in glob.glob(tp_dir + "/*/lib/" + SDK["PYTHONVERSION"] + "/*.dylib"): + dylibs.add(os.path.basename(lib)) + for pkg in PkgListGet(): if PkgSkip(pkg): continue @@ -2713,48 +2717,68 @@ if tp_dir is not None: CopyAllFiles(GetOutputDir() + "/bin/", tp_pkg + "/bin/") if (PkgSkip("PYTHON")==0 and os.path.exists(tp_pkg + "/bin/" + SDK["PYTHONVERSION"])): CopyAllFiles(GetOutputDir() + "/bin/", tp_pkg + "/bin/" + SDK["PYTHONVERSION"] + "/") - else: + + elif GetTarget() == 'darwin': + tp_libs = glob.glob(tp_pkg + "/lib/*.dylib") + + if not PkgSkip("PYTHON"): + tp_libs += glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.dylib")) + tp_libs += glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.so")) + if pkg != 'PYTHON': + tp_libs += glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.py")) + + for tp_lib in tp_libs: + basename = os.path.basename(tp_lib) + if basename.endswith('.dylib'): + # It's a dynamic link library. Put it in the lib directory. + target = GetOutputDir() + "/lib/" + basename + dep_prefix = "@loader_path/../lib/" + lib_id = dep_prefix + basename + else: + # It's a Python module, like _rocketcore.so. Copy it to the root, because + # nowadays the 'lib' directory may no longer be on the PYTHONPATH. + target = GetOutputDir() + "/" + basename + dep_prefix = "@loader_path/lib/" + lib_id = basename + + if not NeedsBuild([target], [tp_lib]): + continue + + CopyFile(target, tp_lib) + if os.path.islink(target) or target.endswith('.py'): + continue + + # Correct the inter-library dependencies so that the build is relocatable. + oscmd('install_name_tool -id %s %s' % (lib_id, target)) + oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (target, GetOutputDir()), True) + + for line in open(GetOutputDir() + "/tmp/otool-libs.txt", "r"): + line = line.strip() + if not line or line.startswith(dep_prefix) or line.endswith(":"): + continue + + libdep = line.split(" ", 1)[0] + dep_basename = os.path.basename(libdep) + if dep_basename in dylibs: + oscmd("install_name_tool -change %s %s%s %s" % (libdep, dep_prefix, dep_basename, target), True) + + JustBuilt([target], [tp_lib]) + + for fwx in glob.glob(tp_pkg + "/*.framework"): + CopyTree(GetOutputDir() + "/Frameworks/" + os.path.basename(fwx), fwx) + + else: # Linux / FreeBSD case. for tp_lib in glob.glob(tp_pkg + "/lib/*.so*"): CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib) if not PkgSkip("PYTHON"): for tp_lib in glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.so*")): - CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib) - - if GetTarget() == 'darwin': - tp_libs = glob.glob(tp_pkg + "/lib/*.dylib") - - if not PkgSkip("PYTHON"): - tp_libs += glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.dylib")) - - for tp_lib in tp_libs: - basename = os.path.basename(tp_lib) - target = GetOutputDir() + "/lib/" + basename - if not NeedsBuild([target], [tp_lib]): - continue - - CopyFile(target, tp_lib) - if os.path.islink(target): - continue - - # Correct the inter-library dependencies so that the build is relocatable. - oscmd('install_name_tool -id @loader_path/../lib/%s %s' % (basename, target)) - oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (target, GetOutputDir()), True) - - for line in open(GetOutputDir() + "/tmp/otool-libs.txt", "r"): - line = line.strip() - if not line or line.startswith('@loader_path/../lib/') or line.endswith(":"): - continue - - libdep = line.split(" ", 1)[0] - dep_basename = os.path.basename(libdep) - if dep_basename in dylibs: - oscmd("install_name_tool -change %s @loader_path/../lib/%s %s" % (libdep, dep_basename, target), True) - - JustBuilt([target], [tp_lib]) - - for fwx in glob.glob(tp_pkg + "/*.framework"): - CopyTree(GetOutputDir() + "/Frameworks/" + os.path.basename(fwx), fwx) + base = os.path.basename(tp_lib) + if base.startswith('lib'): + CopyFile(GetOutputDir() + "/lib/" + base, tp_lib) + else: + # It's a Python module, like _rocketcore.so. + CopyFile(GetOutputDir() + "/" + base, tp_lib) if GetTarget() == 'windows': CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/") @@ -6738,6 +6762,8 @@ def MakeInstallerOSX(): oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") oscmd("cp -R %s/Frameworks dstroot/base/Developer/Panda3D/Frameworks" % GetOutputDir()) + oscmd("cp -R %s/*.so dstroot/base/Developer/Panda3D/" % GetOutputDir()) + oscmd("cp -R %s/*.py dstroot/base/Developer/Panda3D/" % GetOutputDir()) if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir()) From 75f7e70767d3b245b0c9bc1859d3a910eb78d23c Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 22 Nov 2015 00:22:22 +0100 Subject: [PATCH 07/22] Fix issue installing pdeploy-generated .pkg on OS X El Capitan --- direct/src/p3d/DeploymentTools.py | 72 +++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/direct/src/p3d/DeploymentTools.py b/direct/src/p3d/DeploymentTools.py index e55edc1d76..62289e09f1 100644 --- a/direct/src/p3d/DeploymentTools.py +++ b/direct/src/p3d/DeploymentTools.py @@ -5,6 +5,7 @@ to build for as many platforms as possible. """ __all__ = ["Standalone", "Installer"] import os, sys, subprocess, tarfile, shutil, time, zipfile, glob, socket, getpass, struct +import gzip from cStringIO import StringIO from direct.directnotify.DirectNotifyGlobal import * from direct.showbase.AppRunnerGlobal import appRunner @@ -977,7 +978,7 @@ class Installer: if self.licensefile: shutil.copyfile(self.licensefile.toOsSpecific(), Filename(output, "Contents/Resources/License.txt").toOsSpecific()) pkginfo = open(Filename(output, "Contents/PkgInfo").toOsSpecific(), "w") - pkginfo.write("pkmkrpkg1") + pkginfo.write("pmkrpkg1") pkginfo.close() pkginfo = open(Filename(output, "Contents/Resources/package_version").toOsSpecific(), "w") pkginfo.write("major: 1\nminor: 9") @@ -1062,18 +1063,18 @@ class Installer: plist.write('\n') plist.close() - if hasattr(tarfile, "PAX_FORMAT"): - archive = tarfile.open(Filename(output, "Contents/Archive.pax.gz").toOsSpecific(), "w:gz", format = tarfile.PAX_FORMAT, tarinfo = TarInfoRootOSX) - else: - archive = tarfile.open(Filename(output, "Contents/Archive.pax.gz").toOsSpecific(), "w:gz", tarinfo = TarInfoRootOSX) - archive.add(appfn.toOsSpecific(), appname) + # OS X El Capitan no longer accepts .pax archives - it must be a CPIO archive named .pax. + archive = gzip.open(Filename(output, "Contents/Archive.pax.gz").toOsSpecific(), 'wb') + self.__ino = 0 + self.__writeCPIO(archive, appfn, appname) + archive.write(b"0707070000000000000000000000000000000000010000000000000000000001300000000000TRAILER!!!\0") archive.close() # Put the .pkg into a zipfile - archive = Filename(output.getDirname(), "%s %s.zip" % (self.fullname, self.version)) + zip_fn = Filename(output.getDirname(), "%s %s.pkg.zip" % (self.fullname, self.version)) dir = Filename(output.getDirname()) dir.makeAbsolute() - zip = zipfile.ZipFile(archive.toOsSpecific(), 'w') + zip = zipfile.ZipFile(zip_fn.toOsSpecific(), 'w') for root, dirs, files in self.os_walk(output.toOsSpecific()): for name in files: file = Filename.fromOsSpecific(os.path.join(root, name)) @@ -1084,6 +1085,61 @@ class Installer: return output + def __writeCPIO(self, archive, fn, name): + """ Adds the given fn under the given name to the CPIO archive. """ + + st = os.lstat(fn.toOsSpecific()) + + archive.write(b"070707") # magic + archive.write(b"000000") # dev + + # Synthesize an inode number, different for each entry. + self.__ino += 1 + archive.write("%06o" % (self.__ino)) + + # Determine based on the type which mode to write. + if os.path.islink(fn.toOsSpecific()): + archive.write("%06o" % (st.st_mode)) + target = os.path.readlink(fn.toOsSpecific()).encode('utf-8') + size = len(target) + elif os.path.isdir(fn.toOsSpecific()): + archive.write(b"040755") + size = 0 + elif not fn.getExtension(): # Binary file? + archive.write(b"100755") + size = st.st_size + else: + archive.write(b"100644") + size = st.st_size + + archive.write("000000") # uid (root) + archive.write("000000") # gid (wheel) + archive.write("%06o" % (st.st_nlink)) + archive.write("000000") # rdev + archive.write("%011o" % (st.st_mtime)) + archive.write("%06o" % (len(name) + 1)) + archive.write("%011o" % (size)) + + # Write the filename, plus terminating NUL byte. + archive.write(name.encode('utf-8')) + archive.write(b"\0") + + # Copy the file data to the archive. + if os.path.islink(fn.toOsSpecific()): + archive.write(target) + elif size: + handle = open(fn.toOsSpecific(), 'rb') + data = handle.read(1024 * 1024) + while data: + archive.write(data) + data = handle.read(1024 * 1024) + handle.close() + + # If this is a directory, recurse. + if os.path.isdir(fn.toOsSpecific()): + for child in os.listdir(fn.toOsSpecific()): + self.__writeCPIO(archive, Filename(fn, child), name + "/" + child) + def buildNSIS(self, output, platform): # Check if we have makensis first makensis = None From f84b9e1f63a446a6eb9159e5d69e8fd9e7adf6e7 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 16:16:57 +0100 Subject: [PATCH 08/22] More reliable OpenAL device selection mechanism, add fallbacks, prefer "OpenAL Soft" over "Generic Software" --- panda/src/audiotraits/openalAudioManager.cxx | 158 ++++++++++++------- panda/src/audiotraits/openalAudioManager.h | 3 +- 2 files changed, 103 insertions(+), 58 deletions(-) diff --git a/panda/src/audiotraits/openalAudioManager.cxx b/panda/src/audiotraits/openalAudioManager.cxx index 814ef7c69e..792a326cf8 100644 --- a/panda/src/audiotraits/openalAudioManager.cxx +++ b/panda/src/audiotraits/openalAudioManager.cxx @@ -91,7 +91,7 @@ OpenALAudioManager() { _active = audio_active; _volume = audio_volume; _play_rate = 1.0f; - + _cache_limit = audio_cache_limit; _concurrent_sound_limit = 0; @@ -117,21 +117,50 @@ OpenALAudioManager() { _forward_up[5] = 0; // Initialization + audio_cat.init(); if (_active_managers == 0 || !_openal_active) { - string dev_name = get_audio_device(); - _device = alcOpenDevice(dev_name.empty() ? NULL : dev_name.c_str()); // select the user or preferred device - if (!_device) { - // this is a unique kind of error - audio_cat->error() << "OpenALAudioManager: alcOpenDevice(\"" << dev_name << "\"): ALC couldn't open device" << endl; + _device = NULL; + string dev_name = select_audio_device(); + + if (!dev_name.empty()) { + // Open a specific device by name. + audio_cat.info() << "Using OpenAL device " << dev_name << "\n"; + _device = alcOpenDevice(dev_name.c_str()); + + if (_device == NULL) { + audio_cat.error() + << "Couldn't open OpenAL device \"" << dev_name << "\", falling back to default device\n"; + } } else { + audio_cat.info() << "Using default OpenAL device\n"; + } + + if (_device == NULL) { + // Open the default device. + _device = alcOpenDevice(NULL); + + if (_device == NULL && dev_name != "OpenAL Soft") { + // Try the OpenAL Soft driver instead, which is fairly reliable. + _device = alcOpenDevice("OpenAL Soft"); + + if (_device == NULL) { + audio_cat.error() + << "Couldn't open default OpenAL device\n"; + } + } + } + + if (_device != NULL) { + // We managed to get a device open. alcGetError(_device); // clear errors _context = alcCreateContext(_device, NULL); - alc_audio_errcheck("alcCreateContext(_device, NULL)",_device); + alc_audio_errcheck("alcCreateContext(_device, NULL)", _device); if (_context != NULL) { _openal_active = true; } } } + // We increment _active_managers regardless of possible errors above. // The shutdown call will do the right thing when it's called, // either way. @@ -152,15 +181,15 @@ OpenALAudioManager() { audio_3d_set_drop_off_factor(audio_drop_off_factor); if (audio_cat.is_debug()) { - audio_cat->debug() + audio_cat.debug() << "ALC_DEVICE_SPECIFIER:" << alcGetString(_device, ALC_DEVICE_SPECIFIER) << endl; } } if (audio_cat.is_debug()) { - audio_cat->debug() << "AL_RENDERER:" << alGetString(AL_RENDERER) << endl; - audio_cat->debug() << "AL_VENDOR:" << alGetString(AL_VENDOR) << endl; - audio_cat->debug() << "AL_VERSION:" << alGetString(AL_VERSION) << endl; + audio_cat.debug() << "AL_RENDERER:" << alGetString(AL_RENDERER) << endl; + audio_cat.debug() << "AL_VENDOR:" << alGetString(AL_VENDOR) << endl; + audio_cat.debug() << "AL_VERSION:" << alGetString(AL_VERSION) << endl; } } @@ -215,62 +244,79 @@ is_valid() { } //////////////////////////////////////////////////////////////////// -// Function: OpenALAudioManager::get_device_list +// Function: OpenALAudioManager::select_audio_device // Access: Private -// Description: Interrogate the system for audio devices. +// Description: Enumerate the audio devices, selecting the one that +// is most appropriate or has been selected by the user. //////////////////////////////////////////////////////////////////// -std::vector OpenALAudioManager:: -get_device_list() { - std::vector devList; - const char* deviceList = 0; +string OpenALAudioManager:: +select_audio_device() { + string selected_device = openal_device; + const char *devices = NULL; + + // This extension gives us all audio paths on all drivers. if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") == AL_TRUE) { - audio_cat->debug() << "Using ALC_ENUMERATE_ALL_EXT" << endl; - deviceList = (const char*) alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); - } else if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE) { - audio_cat->debug() << "Using ALC_ENUMERATION_EXT" << endl; - deviceList = (const char*) alcGetString(NULL, ALC_DEVICE_SPECIFIER); - } + string default_device = alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); + devices = (const char *)alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); - if (deviceList) { - while (*deviceList) { - string dev = deviceList; - devList.push_back(dev); - audio_cat->debug() << " " << dev << endl; - deviceList += strlen(deviceList) + 1; + if (devices) { + audio_cat.debug() << "All OpenAL devices:\n"; + + while (*devices) { + string device(devices); + devices += device.size() + 1; + + if (audio_cat.is_debug()) { + if (device == selected_device) { + audio_cat.debug() << " " << device << " [selected]\n"; + } else if (device == default_device) { + audio_cat.debug() << " " << device << " [default]\n"; + } else { + audio_cat.debug() << " " << device << "\n"; + } + } + } } - } - return devList; -} - -//////////////////////////////////////////////////////////////////// -// Function: OpenALAudioManager::get_audio_device -// Access: Private -// Description: Fetch the audio device matching one in the -// configuration, or bail and return blank. -//////////////////////////////////////////////////////////////////// -std::string OpenALAudioManager:: -get_audio_device() { - std::vector devList = get_device_list(); - if (devList.empty()) { - audio_cat->warning() << "No devices enumerated by OpenAL; using default" << endl; - return ""; + } else { + audio_cat.debug() << "ALC_ENUMERATE_ALL_EXT not supported\n"; } - std::string device = openal_device; - if (!device.empty()) { - if (std::find(devList.begin(), devList.end(), device) == devList.end()) { - audio_cat->warning() << "Requested OpenAL device " << device << " not detected; using default." << endl; - return ""; + // This extension just gives us generic driver names, like "OpenAL Soft" + // and "Generic Software", rather than individual outputs. + if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE) { + string default_device = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); + devices = (const char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER); + + if (devices) { + audio_cat.debug() << "OpenAL drivers:\n"; + + while (*devices) { + string device(devices); + devices += device.size() + 1; + + if (selected_device.empty() && device == "OpenAL Soft" && + default_device == "Generic Software") { + // Prefer OpenAL Soft over the buggy Generic Software driver. + selected_device = "OpenAL Soft"; + } + + if (audio_cat.is_debug()) { + if (device == selected_device) { + audio_cat.debug() << " " << device << " [selected]\n"; + } else if (device == default_device) { + audio_cat.debug() << " " << device << " [default]\n"; + } else { + audio_cat.debug() << " " << device << "\n"; + } + } + } } - - audio_cat->info() << "Using OpenAL device " << device << endl; - return device; + } else { + audio_cat.debug() << "ALC_ENUMERATION_EXT not supported\n"; } - // default - audio_cat->info() << "Using default OpenAL device" << endl; - return ""; + return selected_device; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/audiotraits/openalAudioManager.h b/panda/src/audiotraits/openalAudioManager.h index 66b7ecedd1..3923f43a2e 100644 --- a/panda/src/audiotraits/openalAudioManager.h +++ b/panda/src/audiotraits/openalAudioManager.h @@ -116,8 +116,7 @@ class EXPCL_OPENAL_AUDIO OpenALAudioManager : public AudioManager { virtual void update(); private: - std::vector get_device_list(); - std::string get_audio_device(); + string select_audio_device(); void make_current() const; From d3a0603a7bc1069438a0eaffc0cc91099c55e3ac Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 16:18:25 +0100 Subject: [PATCH 09/22] Include Eigen headers in the Mac OS X SDK as well --- makepanda/makepanda.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 7f65dad759..a90e838b6c 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2807,8 +2807,8 @@ if (PkgSkip("PYTHON")==0 and os.path.isdir(GetThirdpartyBase()+"/Pmw")): ConditionalWriteFile(GetOutputDir()+'/include/ctl3d.h', '/* dummy file to make MAX happy */') # Since Eigen is included by all sorts of core headers, as a convenience -# to C++ users on Windows, we include it in the Panda include directory. -if not PkgSkip("EIGEN") and GetTarget() == "windows" and GetThirdpartyDir(): +# to C++ users on Win and Mac, we include it in the Panda include directory. +if not PkgSkip("EIGEN") and GetTarget() in ("windows", "darwin") and GetThirdpartyDir(): CopyTree(GetOutputDir()+'/include/Eigen', GetThirdpartyDir()+'eigen/include/Eigen') ######################################################################## From 1d86d604b288df9e89f46e60e5d89865bbeaa384 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 16:20:39 +0100 Subject: [PATCH 10/22] More reliable file copy behaviour - handle directory symlinks better, too --- makepanda/makepandacore.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index f67ca9754d..c766dc946b 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2504,8 +2504,12 @@ def CopyFile(dstfile, srcfile): if NeedsBuild([dstfile], [srcfile]): if os.path.islink(srcfile): # Preserve symlinks - if os.path.exists(dstfile): + if os.path.isfile(dstfile) or os.path.islink(dstfile): + print("Removing file %s" % (dstfile)) os.unlink(dstfile) + elif os.path.isdir(dstfile): + print("Removing directory %s" % (dstfile)) + shutil.rmtree(dstfile) os.symlink(os.readlink(srcfile), dstfile) else: WriteBinaryFile(dstfile, ReadBinaryFile(srcfile)) @@ -2536,24 +2540,37 @@ def CopyAllJavaSources(dir, skip=[]): JustBuilt([dstfile], [srcfile]) def CopyTree(dstdir, srcdir, omitVCS=True): - if (os.path.isdir(dstdir)): - for entry in os.listdir(srcdir): + if os.path.isdir(dstdir): + source_entries = os.listdir(srcdir) + for entry in source_entries: srcpth = os.path.join(srcdir, entry) dstpth = os.path.join(dstdir, entry) - if (os.path.isfile(srcpth)): + + if os.path.islink(srcpth) or os.path.isfile(srcpth): if not omitVCS or entry not in VCS_FILES: CopyFile(dstpth, srcpth) else: if not omitVCS or entry not in VCS_DIRS: CopyTree(dstpth, srcpth) + + # Delete files in dstdir that are not in srcdir. + for entry in os.listdir(dstdir): + if entry not in source_entries: + path = os.path.join(dstdir, entry) + if os.path.islink(path) or os.path.isfile(path): + os.remove(path) + elif os.path.isdir(path): + shutil.rmtree(path) else: if GetHost() == 'windows': srcdir = srcdir.replace('/', '\\') dstdir = dstdir.replace('/', '\\') cmd = 'xcopy /I/Y/E/Q "' + srcdir + '" "' + dstdir + '"' + oscmd(cmd) else: - cmd = 'cp -R -f ' + srcdir + ' ' + dstdir - oscmd(cmd) + if subprocess.call(['cp', '-R', '-f', srcdir, dstdir]) != 0: + exit("Copy failed.") + if omitVCS: DeleteVCS(dstdir) From a98d50cd6138a2631cca295faf75dee8115b4532 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 16:33:16 +0100 Subject: [PATCH 11/22] Fix for older OpenAL versions --- panda/src/audiotraits/openalAudioManager.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/panda/src/audiotraits/openalAudioManager.cxx b/panda/src/audiotraits/openalAudioManager.cxx index 792a326cf8..b5138a345b 100644 --- a/panda/src/audiotraits/openalAudioManager.cxx +++ b/panda/src/audiotraits/openalAudioManager.cxx @@ -28,6 +28,14 @@ #include +#ifndef ALC_DEFAULT_ALL_DEVICES_SPECIFIER +#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012 +#endif + +#ifndef ALC_ALL_DEVICES_SPECIFIER +#define ALC_ALL_DEVICES_SPECIFIER 0x1013 +#endif + TypeHandle OpenALAudioManager::_type_handle; ReMutex OpenALAudioManager::_lock; From 84d8298ee289b86da6858733af589e90ce7d3cef Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 17:06:53 +0100 Subject: [PATCH 12/22] Change location of Mac tools from /Developer/Tools/Panda3D to /Developer/Panda3D/bin, to fix relative loader_path issue --- makepanda/makepanda.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index a90e838b6c..b9d9074c3d 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -6781,17 +6781,18 @@ def MakeInstallerOSX(): # On OSX, just specifying -P is not enough to do that. oscmd("cp -R -P " + GetOutputDir() + "/" + base + " " + libname) - oscmd("mkdir -p dstroot/tools/Developer/Tools/Panda3D") - oscmd("mkdir -p dstroot/tools/Developer/Panda3D") + oscmd("mkdir -p dstroot/tools/Developer/Panda3D/bin") + oscmd("mkdir -p dstroot/tools/Developer/Tools") + oscmd("ln -s ../Panda3D/bin dstroot/tools/Developer/Tools/Panda3D") oscmd("mkdir -p dstroot/tools/etc/paths.d") # Trailing newline is important, works around a bug in OSX - WriteFile("dstroot/tools/etc/paths.d/Panda3D", "/Developer/Tools/Panda3D\n") + WriteFile("dstroot/tools/etc/paths.d/Panda3D", "/Developer/Panda3D/bin\n") oscmd("mkdir -p dstroot/tools/usr/local/share/man/man1") oscmd("cp doc/man/*.1 dstroot/tools/usr/local/share/man/man1/") for base in os.listdir(GetOutputDir()+"/bin"): - binname = "dstroot/tools/Developer/Tools/Panda3D/" + base + binname = "dstroot/tools/Developer/Panda3D/bin/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname) @@ -6882,7 +6883,7 @@ def MakeInstallerOSX(): dist.write(' \n') dist.write(' \n') dist.write(' \n') - dist.write(' \n') + dist.write(' \n') dist.write(' \n') dist.write(' \n') if PkgSkip("PYTHON")==0: From 0e063694d7a4c6bcf6504cd69a5ffaecf3f8cfa0 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 18:06:38 +0100 Subject: [PATCH 13/22] Reorganise installation choices in Mac OS X installer --- makepanda/makepanda.py | 97 ++++++++++++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 33 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index b9d9074c3d..2803e1cbcb 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -6754,7 +6754,6 @@ def MakeInstallerOSX(): if (os.path.exists("Panda3D-rw.dmg")): oscmd('rm -f Panda3D-rw.dmg') oscmd("mkdir -p dstroot/base/Developer/Panda3D/lib") - oscmd("mkdir -p dstroot/base/Developer/Panda3D/panda3d") oscmd("mkdir -p dstroot/base/Developer/Panda3D/etc") oscmd("cp %s/etc/Config.prc dstroot/base/Developer/Panda3D/etc/Config.prc" % GetOutputDir()) oscmd("cp %s/etc/Confauto.prc dstroot/base/Developer/Panda3D/etc/Confauto.prc" % GetOutputDir()) @@ -6762,24 +6761,18 @@ def MakeInstallerOSX(): oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") oscmd("cp -R %s/Frameworks dstroot/base/Developer/Panda3D/Frameworks" % GetOutputDir()) - oscmd("cp -R %s/*.so dstroot/base/Developer/Panda3D/" % GetOutputDir()) - oscmd("cp -R %s/*.py dstroot/base/Developer/Panda3D/" % GetOutputDir()) if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir()) - install_libs = [] - for base in os.listdir(GetOutputDir()+"/lib"): - if (not base.endswith(".a")): - install_libs.append("lib/"+base) - for base in os.listdir(GetOutputDir()+"/panda3d"): - if (not base.endswith(".a")): - install_libs.append("panda3d/"+base) + # Libraries that shouldn't be in base, but are instead in other modules. + no_base_libs = ['libp3ffmpeg', 'libp3fmod_audio', 'libfmodex', 'libfmodexL'] - for base in install_libs: - libname = "dstroot/base/Developer/Panda3D/" + base - # We really need to specify -R in order not to follow symlinks - # On OSX, just specifying -P is not enough to do that. - oscmd("cp -R -P " + GetOutputDir() + "/" + base + " " + libname) + for base in os.listdir(GetOutputDir()+"/lib"): + if not base.endswith(".a") and base.split('.')[0] not in no_base_libs: + libname = "dstroot/base/Developer/Panda3D/lib/" + base + # We really need to specify -R in order not to follow symlinks + # On OSX, just specifying -P is not enough to do that. + oscmd("cp -R -P " + GetOutputDir() + "/lib/" + base + " " + libname) oscmd("mkdir -p dstroot/tools/Developer/Panda3D/bin") oscmd("mkdir -p dstroot/tools/Developer/Tools") @@ -6799,12 +6792,14 @@ def MakeInstallerOSX(): if PkgSkip("PYTHON")==0: PV = SDK["PYTHONVERSION"].replace("python", "") oscmd("mkdir -p dstroot/pythoncode/usr/local/bin") - oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D") + oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/panda3d") oscmd("mkdir -p dstroot/pythoncode/Library/Python/%s/site-packages" % PV) WriteFile("dstroot/pythoncode/Library/Python/%s/site-packages/Panda3D.pth" % PV, "/Developer/Panda3D") oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/pandac" % GetOutputDir()) oscmd("cp -R %s/direct dstroot/pythoncode/Developer/Panda3D/direct" % GetOutputDir()) oscmd("ln -s %s dstroot/pythoncode/usr/local/bin/ppython" % SDK["PYTHONEXEC"]) + oscmd("cp -R %s/*.so dstroot/pythoncode/Developer/Panda3D/" % GetOutputDir()) + oscmd("cp -R %s/*.py dstroot/pythoncode/Developer/Panda3D/" % GetOutputDir()) if os.path.isdir(GetOutputDir()+"/Pmw"): oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/Pmw" % GetOutputDir()) compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/Pmw") @@ -6813,6 +6808,26 @@ def MakeInstallerOSX(): if ((base != "extensions") and (base != "extensions_native")): compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/direct/"+base) + for base in os.listdir(GetOutputDir()+"/panda3d"): + if base.endswith('.py') or base.endswith('.so'): + libname = "dstroot/pythoncode/Developer/Panda3D/panda3d/" + base + # We really need to specify -R in order not to follow symlinks + # On OSX, just specifying -P is not enough to do that. + oscmd("cp -R -P " + GetOutputDir() + "/panda3d/" + base + " " + libname) + + if not PkgSkip("FFMPEG"): + oscmd("mkdir -p dstroot/ffmpeg/Developer/Panda3D/lib") + oscmd("cp -R %s/lib/libp3ffmpeg.* dstroot/ffmpeg/Developer/Panda3D/lib/" % GetOutputDir()) + + #if not PkgSkip("OPENAL"): + # oscmd("mkdir -p dstroot/openal/Developer/Panda3D/lib") + # oscmd("cp -R %s/lib/libp3openal_audio.* dstroot/openal/Developer/Panda3D/lib/" % GetOutputDir()) + + if not PkgSkip("FMODEX"): + oscmd("mkdir -p dstroot/fmodex/Developer/Panda3D/lib") + oscmd("cp -R %s/lib/libp3fmod_audio.* dstroot/fmodex/Developer/Panda3D/lib/" % GetOutputDir()) + oscmd("cp -R %s/lib/libfmodex* dstroot/fmodex/Developer/Panda3D/lib/" % GetOutputDir()) + oscmd("mkdir -p dstroot/headers/Developer/Panda3D") oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % GetOutputDir()) @@ -6831,7 +6846,10 @@ def MakeInstallerOSX(): oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Resources/en.lproj/") pkgs = ["base", "tools", "headers"] - if PkgSkip("PYTHON")==0: pkgs.append("pythoncode") + if not PkgSkip("PYTHON"): pkgs.append("pythoncode") + if not PkgSkip("FFMPEG"): pkgs.append("ffmpeg") + #if not PkgSkip("OPENAL"): pkgs.append("openal") + if not PkgSkip("FMODEX"): pkgs.append("fmodex") if os.path.isdir("samples"): pkgs.append("samples") for pkg in pkgs: identifier = "org.panda3d.panda3d.%s.pkg" % pkg @@ -6872,13 +6890,8 @@ def MakeInstallerOSX(): dist.write(' \n') dist.write(' %s\n' % ReadFile("doc/LICENSE")) dist.write(' \n') - dist.write(' \n') - dist.write(' \n') - if PkgSkip("PYTHON")==0: - dist.write(' \n') - if os.path.isdir("samples"): - dist.write(' \n') - dist.write(' \n') + for pkg in pkgs: + dist.write(' \n' % (pkg)) dist.write(' \n') dist.write(' \n') dist.write(' \n') @@ -6886,24 +6899,42 @@ def MakeInstallerOSX(): dist.write(' \n') dist.write(' \n') dist.write(' \n') - if PkgSkip("PYTHON")==0: - dist.write(' \n') + + if not PkgSkip("PYTHON"): + dist.write(' \n') dist.write(' \n') dist.write(' \n') + + if not PkgSkip("FFMPEG"): + dist.write(' \n') + else: + dist.write(' It is not required for loading .wav or .ogg files, which Panda3D can read out of the box.">\n') + dist.write(' \n') + dist.write(' \n') + + #if not PkgSkip("OPENAL"): + # dist.write(' \n') + # dist.write(' \n') + # dist.write(' \n') + + if not PkgSkip("FMODEX"): + dist.write(' \n') + dist.write(' \n') + dist.write(' \n') + if os.path.isdir("samples"): dist.write(' \n') dist.write(' \n') dist.write(' \n') + dist.write(' \n') dist.write(' \n') dist.write(' \n') - dist.write(' file:./Contents/Packages/base.pkg\n' % (GetDirectorySize("dstroot/base") // 1024)) - dist.write(' file:./Contents/Packages/tools.pkg\n' % (GetDirectorySize("dstroot/tools") // 1024)) - if PkgSkip("PYTHON")==0: - dist.write(' file:./Contents/Packages/pythoncode.pkg\n' % (GetDirectorySize("dstroot/pythoncode") // 1024)) - if os.path.isdir("samples"): - dist.write(' file:./Contents/Packages/samples.pkg\n' % (GetDirectorySize("dstroot/samples") // 1024)) - dist.write(' file:./Contents/Packages/headers.pkg\n' % (GetDirectorySize("dstroot/headers") // 1024)) + for pkg in pkgs: + size = GetDirectorySize("dstroot/" + pkg) // 1024 + dist.write(' file:./Contents/Packages/%s.pkg\n' % (pkg, size, pkg)) dist.write('\n') dist.close() From 5580f1919e434405d7413905d7de08edede30e27 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 19:47:32 +0100 Subject: [PATCH 14/22] Update release notes and readme for 1.9.1 --- README.md | 6 +-- doc/ReleaseNotes | 103 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 89 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a4bd9f39d5..061497dd6d 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ are included as part of the Windows 7.1 SDK. You will also need to have the third-party dependency libraries available for the build scripts to use. These are available from one of these two URLs, depending on whether you are on a 32-bit or 64-bit system: -https://www.panda3d.org/download/panda3d-1.9.0/panda3d-1.9.0-tools-win32.zip -https://www.panda3d.org/download/panda3d-1.9.0/panda3d-1.9.0-tools-win64.zip +https://www.panda3d.org/download/panda3d-1.9.1/panda3d-1.9.1-tools-win32.zip +https://www.panda3d.org/download/panda3d-1.9.1/panda3d-1.9.1-tools-win64.zip After acquiring these dependencies, you may simply build Panda3D from the command prompt using the following command: @@ -97,7 +97,7 @@ Mac OS X -------- On Mac OS X, 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.9.0/panda3d-1.9.0-tools-mac.tar.gz). +compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.9.1/panda3d-1.9.1-tools-mac.tar.gz). After placing the thirdparty directory inside the panda3d source directory, you may build Panda3D using a command like the following: diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 3bb5d7f829..c0474af73b 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -3,31 +3,100 @@ This minor release fixes some important regressions and bugs found in 1.9.0, but also introduces a few minor features. -It also reintroduces the deployment pipeline that was absent from +It also reintroduces the deployment tools that were absent from the previous release. -* Textures were not being scaled to power-of-2 in some cases -* Fix various issues with shader inputs -* Bullet step function accidentally defaulted to step size of 0 -* Use model-path for finding libRocket assets -* Fix inconsistent behavior with non-power-of-2 textures in rocket -* Fix regression with memoryviews -* Fix symbol error when loading libp3ffmpeg on Mac OS X +The following issues were fixed: +* SDK now properly installs in Mac OS X "El Capitan" +* Windows 8.1+ no longer applies DPI virtualization to Panda window +* Fix ffmpeg library load issue on Mac OS X * Fix issues running maya2egg on Mac OS X -* PStats now tracks memory residency of graphics buffers -* Support wireframe and point rendering modes in OpenGL ES -* Add missing keys to libRocket keymap +* Fix compiler errors on different platforms +* Fix random crashes +* Fix crashes on shutdown in threaded pipeline +* More reliably and robustly handle failures opening OpenAL device +* Textures were not being scaled to power-of-2 in some cases +* Correct scaling of normal vectors with flatten operation +* Correct positioning of viewing axis when showing lens frustum +* Add dpi-window-resize option to auto-resize window on DPI change +* Fix assertions when alpha-file-channel references unknown channel +* Use OpenGL-style vertex colors by default on non-Windows systems +* Default vertex column alignment is now 4 bytes +* Add PNMImage premultiply/unpremultiply methods. * Fix incorrect parsing of numbers with exponents in Config.prc -* Various performance optimizations * Fix for reading URLs mounted via the virtual file system -* Improve GLSL error reporting -* Fix issue with model disappearing in rare cases with GLSL * Fix shader generator memory leaks and runtime performance -* Add M_confined mouse mode that keeps cursor in window +* Fix shader generator scaling of binormals and tangents * Expose _NET_WM_PID to window managers in X11 -* bam2egg supports collision sphere and plane solids -* Add sample program demonstrating mouse modes +* Fix a range of bugs in tinydisplay renderer. +* Don't error when setting lens far distance to infinity +* Allow passing custom lens to saveCubeMap/saveSphereMap +* Fix errors in saveCubeMap/saveSphereMap in threaded pipeline +* Fix DynamicTextFont.makeCopy() +* Make Texture memory size estimation more accurate +* Fix various window resizing issues +* Fix PandaSystem.getCompiler() value for clang (it reported gcc) +* x2egg no longer replaces face normals with vertex normals +* Include Eigen headers in Mac and Windows SDK +* Added geomipterrain-incorrect-normals setting, default=true +* Various performance optimizations +* Fixed various other bugs not listed here. + +Fixes and improvements for the runtime: +* Fix splash screen freezing in the X11 web plug-in +* pdeploy will now handle extracted files (eg. .ico and .cur) +* Added more options for customizing splash screen +* Fix missing xml and ast modules from morepy package +* Certificate dialog is now localized to various languages +* Pass on failing exit status from packaged application +* Fix issue installing pdeploy-generated .pkg on OS X 10.11 + +Fixes for the Python API: +* Fix mysterious and rare crash in tp_traverse +* Bullet step function accidentally defaulted to step size of 0 +* Fix overflow sizes of various integral types, eg. file offsets +* Fix regression with memoryviews +* Fix hasattr/getattr of vector classes for invalid attributes +* Allow passing a long to methods accepting an int +* Fix crash when passing None to Filename constructor +* MouseWatcherGroup was erroneously not exposed in 1.9.0 +* ShowBase no longer unmounts VFS when shutting down +* No longer requires setting PATH to import panda3d.* +* Fix WebcamVideo/MicrophoneAudio.getOptions() methods + +Changes relating to the OpenGL renderer: +* Various performance improvements +* Fix point/line thickness setting +* Improve GLSL error reporting +* Fix Intel driver issues, particularly with geometry shaders +* Add more error checking for parameter types +* Integer shader inputs were not being converted to float properly +* Fix crash passing an undersized array to a GLSL shader input +* p3d_ColorScale et al may now be declared as vec3 +* Fix flickering when using trans_model_to_apiview in Cg +* Support wireframe and point rendering modes in OpenGL ES +* Fix issue with model disappearing in rare cases with GLSL +* Fix ColorWriteAttrib not working as it should +* Allow deactivating PStats collectors for GPU timers +* Memory residency of graphics buffers now tracked by PStats +* Allow changing OpenGL coordinate system with gl-coordinate-system + +Fixes for libRocket integration: +* libRocket did not work on Mac OS X in 1.9.0 +* Fix inconsistent behavior with non-power-of-2 textures in rocket +* Use model-path for finding libRocket assets +* Add missing keys to libRocket keymap +* libRocket elements showed up white in tinydisplay + +Further additions: * Add -L (lighting) and -P (graphics pipe) pview options +* Add M_confined mouse mode that keeps cursor in window +* Add sample program demonstrating mouse modes +* bam2egg supports collision sphere and plane solids +* p3d_TransformTable GLSL input backported from 1.10 branch +* Add openal-device setting for selecting OpenAL audio output +* Add limited modification timestamp tracking for Ramdisk mounts +* Support for Autodesk Maya 2016 ------------------------ RELEASE 1.9.0 ------------------------ From e6b245c56dd4d81a43ea74caa1804f124e3a1b73 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 20:20:48 +0100 Subject: [PATCH 15/22] Remove annoying ":Packager(warning): No such file" warning --- direct/src/p3d/Packager.py | 7 +++++-- doc/ReleaseNotes | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 2f280b0584..92a7015e89 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -3764,8 +3764,7 @@ class Packager: self.__recurseDir(dirname, newDir, unprocessed = unprocessed) def __recurseDir(self, filename, newName, unprocessed = None, packageTree = None): - dirList = vfs.scanDirectory(filename) - if dirList: + if filename.isDirectory(): # It's a directory name. Recurse. prefix = newName if prefix and prefix[-1] != '/': @@ -3773,6 +3772,7 @@ class Packager: # First check if this is a Python package tree. If so, add it # implicitly as a module. + dirList = vfs.scanDirectory(filename) for subfile in dirList: filename = subfile.getFilename() if filename.getBasename() == '__init__.py': @@ -3784,6 +3784,9 @@ class Packager: self.__recurseDir(filename, prefix + filename.getBasename(), unprocessed = unprocessed) return + elif not filename.exists(): + # It doesn't exist. Perhaps it's a virtual file. Ignore it. + return # It's a file name. Add it. ext = filename.getExtension() diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index c0474af73b..fd42a853f3 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -49,6 +49,7 @@ Fixes and improvements for the runtime: * Fix missing xml and ast modules from morepy package * Certificate dialog is now localized to various languages * Pass on failing exit status from packaged application +* Remove annoying ":Packager(warning): No such file" warning * Fix issue installing pdeploy-generated .pkg on OS X 10.11 Fixes for the Python API: From 37509e7c9364f8bc643fc3fe823f65625eaf10aa Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 23:33:27 +0100 Subject: [PATCH 16/22] Fix makepanda --clean option when built dir doesn't exist yet --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 2803e1cbcb..f53a6a75ba 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -322,7 +322,7 @@ def parseopts(args): if RUNTIME or not is_win7: PkgDisable("TOUCHINPUT") - if clean_build: + if clean_build and os.path.isdir(GetOutputDir()): print("Deleting %s" % (GetOutputDir())) shutil.rmtree(GetOutputDir()) From 5ba93acf5cd6b1af0e8a6d67010dbc932c1291bd Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 23:33:38 +0100 Subject: [PATCH 17/22] Workaround to allow building the rtdist on Mac 10.11, which removes DYLD_LIBRARY_PATH --- makepanda/makepandacore.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index c766dc946b..95af98b493 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2481,6 +2481,10 @@ def SetupBuildEnvironment(compiler): dyldpath.insert(0, os.path.join(builtdir, 'lib')) os.environ["DYLD_LIBRARY_PATH"] = os.pathsep.join(dyldpath) + # OS X 10.11 removed DYLD_LIBRARY_PATH, but we still need to pass + # on our lib directory to ppackage, so add it to PATH instead. + os.environ["PATH"] = os.path.join(builtdir, 'lib') + ':' + os.environ.get("PATH", "") + # Workaround around compile issue on PCBSD if (os.path.exists("/usr/PCBSD")): os.environ["LD_LIBRARY_PATH"] += os.pathsep + "/usr/PCBSD/local/lib" From 5ac13fd2b1629567eb5d9a67162ab66c308e7ed8 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Nov 2015 23:46:36 +0100 Subject: [PATCH 18/22] Add ogv extension to default Packager extensions --- direct/src/p3d/Packager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 92a7015e89..7065e71a15 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -2430,7 +2430,7 @@ class Packager: # Binary files that are considered uncompressible, and are # copied without compression. - self.uncompressibleExtensions = [ 'mp3', 'ogg', 'wav', 'rml', 'rcss', 'otf' ] + self.uncompressibleExtensions = [ 'mp3', 'ogg', 'ogv', 'wav', 'rml', 'rcss', 'otf' ] # wav files are compressible, but p3openal_audio won't load # them compressed. # rml, rcss and otf files must be added here because From 414460a3b54e30d4b13082e53e014c6cb57332ab Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 24 Nov 2015 00:17:15 +0100 Subject: [PATCH 19/22] Fix a few issues with mouse mode sample --- samples/mouse-modes/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 samples/mouse-modes/main.py diff --git a/samples/mouse-modes/main.py b/samples/mouse-modes/main.py old mode 100644 new mode 100755 index 75ddbf08ea..c0b8ecbdef --- a/samples/mouse-modes/main.py +++ b/samples/mouse-modes/main.py @@ -67,7 +67,7 @@ class App(ShowBase): self.manualRecenterMouse = True # make a box to move with the mouse - self.model = self.loader.loadModel("box.egg") + self.model = self.loader.loadModel("box") self.model.reparentTo(self.render) self.cam.setPos(0, -5, 0) @@ -76,7 +76,7 @@ class App(ShowBase): self.mouseTask = taskMgr.add(self.mouseTask, "Mouse Task") def setMouseMode(self, mode): - print "Changing mode to",mode + print("Changing mode to %s" % mode) self.mouseMode = mode @@ -92,7 +92,7 @@ class App(ShowBase): actualMode = wp.getMouseMode() if self.mouseMode != actualMode: - print "ACTUAL MOUSE MODE:", actualMode + print("ACTUAL MOUSE MODE: %s" % actualMode) self.mouseMode = actualMode @@ -107,11 +107,11 @@ class App(ShowBase): def toggleRecenter(self): - print "Toggling re-center behavior" + print("Toggling re-center behavior") self.manualRecenterMouse = not self.manualRecenterMouse def toggleMouse(self): - print "Toggling mouse visibility" + print("Toggling mouse visibility") self.hideMouse = not self.hideMouse From 2e6a9ee08f13fd1eddb6b286aecac08b8617f6b6 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 24 Nov 2015 10:42:42 +0100 Subject: [PATCH 20/22] Update release notes with a few things I'd missed --- doc/ReleaseNotes | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index fd42a853f3..d1616722a7 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -7,13 +7,14 @@ It also reintroduces the deployment tools that were absent from the previous release. The following issues were fixed: -* SDK now properly installs in Mac OS X "El Capitan" +* SDK now properly installs in Mac OS X 10.11 "El Capitan" * Windows 8.1+ no longer applies DPI virtualization to Panda window * Fix ffmpeg library load issue on Mac OS X * Fix issues running maya2egg on Mac OS X * Fix compiler errors on different platforms -* Fix random crashes +* Fix various rare crashes * Fix crashes on shutdown in threaded pipeline +* Fix low-level threading crash on ARM machines * More reliably and robustly handle failures opening OpenAL device * Textures were not being scaled to power-of-2 in some cases * Correct scaling of normal vectors with flatten operation @@ -39,6 +40,8 @@ The following issues were fixed: * x2egg no longer replaces face normals with vertex normals * Include Eigen headers in Mac and Windows SDK * Added geomipterrain-incorrect-normals setting, default=true +* DisplayInformation resolution list was missing on Windows +* Upgrade FMOD and Bullet versions on Windows and Mac OS X * Various performance optimizations * Fixed various other bugs not listed here. @@ -48,6 +51,7 @@ Fixes and improvements for the runtime: * Added more options for customizing splash screen * Fix missing xml and ast modules from morepy package * Certificate dialog is now localized to various languages +* Fix packp3d error when Python file is not in a package * Pass on failing exit status from packaged application * Remove annoying ":Packager(warning): No such file" warning * Fix issue installing pdeploy-generated .pkg on OS X 10.11 @@ -55,7 +59,7 @@ Fixes and improvements for the runtime: Fixes for the Python API: * Fix mysterious and rare crash in tp_traverse * Bullet step function accidentally defaulted to step size of 0 -* Fix overflow sizes of various integral types, eg. file offsets +* Fix overflow of file offsets (eg. when seeking in huge files) * Fix regression with memoryviews * Fix hasattr/getattr of vector classes for invalid attributes * Allow passing a long to methods accepting an int @@ -89,7 +93,7 @@ Fixes for libRocket integration: * Add missing keys to libRocket keymap * libRocket elements showed up white in tinydisplay -Further additions: +New features: * Add -L (lighting) and -P (graphics pipe) pview options * Add M_confined mouse mode that keeps cursor in window * Add sample program demonstrating mouse modes From 2745f11b65041fbb670ce097ae792034ec098cb5 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 24 Nov 2015 12:54:14 +0100 Subject: [PATCH 21/22] Add back ability to change default relief and frameSize of DirectDialog --- direct/src/gui/DirectDialog.py | 7 ++++--- direct/src/gui/DirectGuiGlobals.py | 12 ++++++++---- doc/ReleaseNotes | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/direct/src/gui/DirectDialog.py b/direct/src/gui/DirectDialog.py index 44cb182ab0..17ace40dca 100644 --- a/direct/src/gui/DirectDialog.py +++ b/direct/src/gui/DirectDialog.py @@ -94,8 +94,8 @@ class DirectDialog(DirectFrame): ('text', '', None), ('text_align', TextNode.ALeft, None), ('text_scale', 0.06, None), - ('image', None, None), - ('relief', DGG.RAISED, None), + ('image', DGG.getDefaultDialogGeom(), None), + ('relief', DGG.getDefaultDialogRelief(), None), ('borderWidth', (0.01, 0.01), None), ('buttonTextList', [], DGG.INITOPT), ('buttonGeomList', [], DGG.INITOPT), @@ -316,7 +316,8 @@ class DirectDialog(DirectFrame): # reduce bottom by pad, button height and 2*button pad b = min(b - self['midPad'] - bpad[1] - bHeight - bpad[1], b) - pad[1] t = t + self['topPad'] + pad[1] - self['frameSize'] = (l, r, b, t) + if self['frameSize'] is None: + self['frameSize'] = (l, r, b, t) self['image_scale'] = (r - l, 1, t - b) # Center frame about text and buttons self['image_pos'] = ((l+r)*0.5, 0.0, (b+t)*0.5) diff --git a/direct/src/gui/DirectGuiGlobals.py b/direct/src/gui/DirectGuiGlobals.py index 167d2a99b4..7f42fd0a78 100644 --- a/direct/src/gui/DirectGuiGlobals.py +++ b/direct/src/gui/DirectGuiGlobals.py @@ -14,6 +14,7 @@ defaultFontFunc = TextNode.getDefaultFont defaultClickSound = None defaultRolloverSound = None defaultDialogGeom = None +defaultDialogRelief = PGFrameStyle.TBevelOut drawOrder = 100 panel = None @@ -132,13 +133,16 @@ def setDefaultFontFunc(newFontFunc): def getDefaultDialogGeom(): global defaultDialogGeom - if defaultDialogGeom == None: - defaultDialogGeom = loader.loadModel('models/gui/dialog_box_gui', okMissing = True) return defaultDialogGeom -def setDefaultDialogGeom(newDialogGeom): - global defaultDialogGeom +def getDefaultDialogRelief(): + global defaultDialogRelief + return defaultDialogRelief + +def setDefaultDialogGeom(newDialogGeom, relief=None): + global defaultDialogGeom, defaultDialogRelief defaultDialogGeom = newDialogGeom + defaultDialogRelief = relief def getDefaultDrawOrder(): return drawOrder diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index d1616722a7..da1575fcdd 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -67,6 +67,8 @@ Fixes for the Python API: * MouseWatcherGroup was erroneously not exposed in 1.9.0 * ShowBase no longer unmounts VFS when shutting down * No longer requires setting PATH to import panda3d.* +* DirectDialog default geom is once again respected +* DirectDialog no longer overrides custom frameSize * Fix WebcamVideo/MicrophoneAudio.getOptions() methods Changes relating to the OpenGL renderer: From 9348cf6b29cdfeb197b7454742e16cddc84491c1 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 24 Nov 2015 13:35:18 +0100 Subject: [PATCH 22/22] Prevent packp3d from including xml and panda3d modules in every .p3d --- direct/src/distributed/ClockDelta.py | 2 +- direct/src/p3d/panda3d.pdef | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/direct/src/distributed/ClockDelta.py b/direct/src/distributed/ClockDelta.py index 20f3274003..21c282cb85 100644 --- a/direct/src/distributed/ClockDelta.py +++ b/direct/src/distributed/ClockDelta.py @@ -1,7 +1,7 @@ # ClockDelta provides the ability to use clock synchronization for # distributed objects -from pandac.PandaModules import * +from panda3d.core import ClockObject from direct.directnotify import DirectNotifyGlobal from direct.showbase import DirectObject import math diff --git a/direct/src/p3d/panda3d.pdef b/direct/src/p3d/panda3d.pdef index beac7049b5..6527c87eb2 100644 --- a/direct/src/p3d/panda3d.pdef +++ b/direct/src/p3d/panda3d.pdef @@ -103,8 +103,6 @@ class panda3d(package): excludeModule('MySQLdb', '_mysql') - excludeModule('xml', 'xml.parsers.expat', 'xml.sax') - # Most of the core Panda3D DLL's will be included implicitly due to # being referenced by the above Python code. Here we name a few more # that are also needed, but aren't referenced by any code. Again,