diff --git a/direct/src/controls/GravityWalker.py b/direct/src/controls/GravityWalker.py index 32c18c05f3..bf3ea8a9bd 100755 --- a/direct/src/controls/GravityWalker.py +++ b/direct/src/controls/GravityWalker.py @@ -71,90 +71,6 @@ class GravityWalker(DirectObject.DirectObject): self.isAirborne = 0 self.highMark = 0 - """ - def spawnTest(self): - assert self.notify.debugStateCall(self) - if not self.wantDebugIndicator: - return - from pandac.PandaModules import * - from direct.interval.IntervalGlobal import * - from toontown.coghq import MovingPlatform - - if hasattr(self, "platform"): - # Remove the prior instantiation: - self.moveIval.pause() - del self.moveIval - self.platform.destroy() - del self.platform - self.platform2.destroy() - del self.platform2 - - model = loader.loadModel('phase_9/models/cogHQ/platform1') - fakeId = id(self) - self.platform = MovingPlatform.MovingPlatform() - self.platform.setupCopyModel(fakeId, model, 'platformcollision') - self.platformRoot = render.attachNewNode("GravityWalker-spawnTest-%s"%fakeId) - self.platformRoot.setPos(base.localAvatar, Vec3(0.0, 0.0, 1.0)) - self.platformRoot.setHpr(base.localAvatar, Vec3.zero()) - self.platform.reparentTo(self.platformRoot) - - self.platform2 = MovingPlatform.MovingPlatform() - self.platform2.setupCopyModel(1+fakeId, model, 'platformcollision') - self.platform2Root = render.attachNewNode("GravityWalker-spawnTest2-%s"%fakeId) - self.platform2Root.setPos(base.localAvatar, Vec3(-16.0, 30.0, 1.0)) - self.platform2Root.setHpr(base.localAvatar, Vec3.zero()) - self.platform2.reparentTo(self.platform2Root) - - duration = 5 - self.moveIval = Parallel( - Sequence( - WaitInterval(0.3), - LerpPosInterval(self.platform, duration, - Vec3(0.0, 30.0, 0.0), - name='platformOut%s' % fakeId, - fluid = 1), - WaitInterval(0.3), - LerpPosInterval(self.platform, duration, - Vec3(0.0, 0.0, 0.0), - name='platformBack%s' % fakeId, - fluid = 1), - WaitInterval(0.3), - LerpPosInterval(self.platform, duration, - Vec3(0.0, 0.0, 30.0), - name='platformUp%s' % fakeId, - fluid = 1), - WaitInterval(0.3), - LerpPosInterval(self.platform, duration, - Vec3(0.0, 0.0, 0.0), - name='platformDown%s' % fakeId, - fluid = 1), - ), - Sequence( - WaitInterval(0.3), - LerpPosInterval(self.platform2, duration, - Vec3(0.0, -30.0, 0.0), - name='platform2Out%s' % fakeId, - fluid = 1), - WaitInterval(0.3), - LerpPosInterval(self.platform2, duration, - Vec3(0.0, 30.0, 30.0), - name='platform2Back%s' % fakeId, - fluid = 1), - WaitInterval(0.3), - LerpPosInterval(self.platform2, duration, - Vec3(0.0, -30.0, 0.0), - name='platform2Up%s' % fakeId, - fluid = 1), - WaitInterval(0.3), - LerpPosInterval(self.platform2, duration, - Vec3(0.0, 0.0, 0.0), - name='platformDown%s' % fakeId, - fluid = 1), - ), - name='platformIval%s' % fakeId, - ) - self.moveIval.loop() - """ def setWalkSpeed(self, forward, jump, reverse, rotate): assert self.notify.debugStateCall(self) self.avatarControlForwardSpeed=forward diff --git a/direct/src/controls/PhysicsWalker.py b/direct/src/controls/PhysicsWalker.py index fc6fe1ca70..de6ebcefa8 100755 --- a/direct/src/controls/PhysicsWalker.py +++ b/direct/src/controls/PhysicsWalker.py @@ -67,51 +67,6 @@ class PhysicsWalker(DirectObject.DirectObject): self.isAirborne = 0 self.highMark = 0 - """ - def spawnTest(self): - assert self.debugPrint("\n\nspawnTest()\n") - if not self.wantDebugIndicator: - return - from pandac.PandaModules import * - from direct.interval.IntervalGlobal import * - from toontown.coghq import MovingPlatform - - if hasattr(self, "platform"): - # Remove the prior instantiation: - self.moveIval.pause() - del self.moveIval - self.platform.destroy() - del self.platform - - model = loader.loadModel('phase_9/models/cogHQ/platform1') - fakeId = id(self) - self.platform = MovingPlatform.MovingPlatform() - self.platform.setupCopyModel(fakeId, model, 'platformcollision') - self.platformRoot = render.attachNewNode("physicsWalker-spawnTest-%s"%fakeId) - self.platformRoot.setPos(base.localAvatar, Vec3(0.0, 3.0, 1.0)) - self.platformRoot.setHpr(base.localAvatar, Vec3.zero()) - self.platform.reparentTo(self.platformRoot) - - startPos = Vec3(0.0, -15.0, 0.0) - endPos = Vec3(0.0, 15.0, 0.0) - distance = Vec3(startPos-endPos).length() - duration = distance/4 - self.moveIval = Sequence( - WaitInterval(0.3), - LerpPosInterval(self.platform, duration, - endPos, startPos=startPos, - name='platformOut%s' % fakeId, - fluid = 1), - WaitInterval(0.3), - LerpPosInterval(self.platform, duration, - startPos, startPos=endPos, - name='platformBack%s' % fakeId, - fluid = 1), - name='platformIval%s' % fakeId, - ) - self.moveIval.loop() - """ - def setWalkSpeed(self, forward, jump, reverse, rotate): assert self.debugPrint("setWalkSpeed()") self.avatarControlForwardSpeed=forward diff --git a/direct/src/showbase/Messenger.py b/direct/src/showbase/Messenger.py index 4ac1b96f56..f1b7bcc1a7 100644 --- a/direct/src/showbase/Messenger.py +++ b/direct/src/showbase/Messenger.py @@ -624,8 +624,9 @@ class Messenger: for key in list(acceptorDict.keys()): function, extraArgs, persistent = acceptorDict[key] object = self._getObject(key) - if (type(object) == types.InstanceType): - className = object.__class__.__name__ + objectClass = getattr(object, '__class__', None) + if objectClass: + className = objectClass.__name__ else: className = "Not a class" functionName = function.__name__ diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 721a67453e..2370742957 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -1652,17 +1652,15 @@ def itype(obj): # version of type that gives more complete information about instance types global dtoolSuperBase t = type(obj) - if t is types.InstanceType: - return '%s of >' % (repr(types.InstanceType)[:-1], - str(obj.__class__)) + if sys.version_info < (3, 0) and t is types.InstanceType: + return ">" % (obj.__class__) else: # C++ object instances appear to be types via type() # check if this is a C++ object if dtoolSuperBase is None: _getDtoolSuperBase() if isinstance(obj, dtoolSuperBase): - return '%s of %s>' % (repr(types.InstanceType)[:-1], - str(obj.__class__)) + return "" % (obj.__class__) return t def deeptype(obj, maxLen=100, _visitedIds=None): diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 54a410b57f..4f2abef8a9 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -554,6 +554,17 @@ if RUNTIME and not HOST_URL: # Set this to a nice default. HOST_URL = "https://runtime.panda3d.org/" +if not PkgSkip("PYTHON") and SDK["PYTHONVERSION"] == "python2.7": + warn_prefix = "%sWARNING:%s " % (GetColor("red"), GetColor()) + print("=========================================================================") + print(warn_prefix + "Python 2.7 will reach EOL after December 31, 2019, and will not") + print(warn_prefix + "be supported after that date. Please ensure you are prepared") + print(warn_prefix + "by planning your upgrade to Python 3 now.") + print("=========================================================================") + sys.stdout.flush() + # Give the user some time to contemplate their sins + time.sleep(6.0) + ######################################################################## ## ## Choose a Compiler. diff --git a/panda/src/device/inputDeviceSet.I b/panda/src/device/inputDeviceSet.I old mode 100755 new mode 100644 diff --git a/panda/src/device/inputDeviceSet.cxx b/panda/src/device/inputDeviceSet.cxx old mode 100755 new mode 100644 diff --git a/panda/src/device/inputDeviceSet.h b/panda/src/device/inputDeviceSet.h old mode 100755 new mode 100644 diff --git a/panda/src/ffmpeg/config_ffmpeg.cxx b/panda/src/ffmpeg/config_ffmpeg.cxx index 0dbe147d27..fddd9bb81d 100644 --- a/panda/src/ffmpeg/config_ffmpeg.cxx +++ b/panda/src/ffmpeg/config_ffmpeg.cxx @@ -17,8 +17,8 @@ #include "ffmpegVideoCursor.h" #include "ffmpegAudio.h" #include "ffmpegAudioCursor.h" - #include "movieTypeRegistry.h" +#include "pandaSystem.h" extern "C" { #include @@ -129,6 +129,9 @@ init_libffmpeg() { FfmpegVideo::register_with_read_factory(); FfmpegVideoCursor::register_with_read_factory(); + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("FFmpeg"); + // Register ffmpeg as catch-all audiovideo type. MovieTypeRegistry *reg = MovieTypeRegistry::get_global_ptr(); reg->register_audio_type(&FfmpegAudio::make, "*"); diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index bdeb26345f..b85a3e76c1 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -659,6 +659,10 @@ rebuild_bitplanes() { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } + + // Mark the GSG as supporting multisampling, so that it will respect an + // AntialiasAttrib with mode M_multisample. + glgsg->_supports_multisample = true; } else { glDisable(GL_MULTISAMPLE); } diff --git a/pandatool/src/deploy-stub/deploy-stub.c b/pandatool/src/deploy-stub/deploy-stub.c index 12079da46d..707694a8ca 100644 --- a/pandatool/src/deploy-stub/deploy-stub.c +++ b/pandatool/src/deploy-stub/deploy-stub.c @@ -75,6 +75,10 @@ static struct _inittab extensions[] = { #endif #endif +#ifdef _WIN32 +static wchar_t *log_pathw = NULL; +#endif + #if defined(_WIN32) && PY_VERSION_HEX < 0x03060000 static int supports_code_page(UINT cp) { if (cp == 0) { @@ -225,7 +229,8 @@ static int mkdir_parent(const char *path) { static int setup_logging(const char *path, int append) { #ifdef _WIN32 // Does it start with a tilde? Perform tilde expansion if so. - wchar_t pathw[MAX_PATH * 2]; + wchar_t *pathw = (wchar_t *)malloc(sizeof(wchar_t) * MAX_PATH); + pathw[0] = 0; size_t offset = 0; if (path[0] == '~' && (path[1] == 0 || path[1] == '/' || path[1] == '\\')) { // Strip off the tilde. @@ -233,6 +238,7 @@ static int setup_logging(const char *path, int append) { // Get the home directory path for the current user. if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, pathw))) { + free(pathw); return 0; } offset = wcslen(pathw); @@ -240,26 +246,30 @@ static int setup_logging(const char *path, int append) { // We need to convert the rest of the path from UTF-8 to UTF-16. if (MultiByteToWideChar(CP_UTF8, 0, path, -1, pathw + offset, - (int)(_countof(pathw) - offset)) == 0) { + (int)(MAX_PATH - offset)) == 0) { + free(pathw); return 0; } DWORD access = append ? FILE_APPEND_DATA : (GENERIC_READ | GENERIC_WRITE); int creation = append ? OPEN_ALWAYS : CREATE_ALWAYS; - HANDLE handle = CreateFileW(pathw, access, FILE_SHARE_DELETE | FILE_SHARE_READ, + HANDLE handle = CreateFileW(pathw, access, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL); if (handle == INVALID_HANDLE_VALUE) { // Make the parent directories first. mkdir_parent(pathw); - handle = CreateFileW(pathw, access, FILE_SHARE_DELETE | FILE_SHARE_READ, + handle = CreateFileW(pathw, access, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL); } if (handle == INVALID_HANDLE_VALUE) { + free(pathw); return 0; } + log_pathw = pathw; + if (append) { SetFilePointer(handle, 0, NULL, FILE_END); } @@ -282,7 +292,7 @@ static int setup_logging(const char *path, int append) { // Now replace the stdout and stderr file descriptors with one pointing to // our desired handle. - int fd = _open_osfhandle((intptr_t)handle, _O_WRONLY | _O_TEXT | (append ? _O_APPEND : 0)); + int fd = _open_osfhandle((intptr_t)handle, _O_WRONLY | _O_TEXT | _O_APPEND); _dup2(fd, _fileno(stdout)); _dup2(fd, _fileno(stderr)); _close(fd); @@ -421,6 +431,32 @@ int Py_FrozenMain(int argc, char **argv) #endif #if defined(MS_WINDOWS) && PY_VERSION_HEX < 0x03040000 + /* We can't rely on our overriding of the standard I/O to work on older + * versions of Python, since they are compiled with an incompatible CRT. + * The best solution I've found was to just replace sys.stdout/stderr with + * the log file reopened in append mode (which requires not locking it for + * write, and also passing in _O_APPEND above, and disabling buffering). + * It's not the most elegant solution, but it's better than crashing. */ +#if PY_MAJOR_VERSION < 3 + if (log_pathw != NULL) { + PyObject *uniobj = PyUnicode_FromWideChar(log_pathw, (Py_ssize_t)wcslen(log_pathw)); + PyObject *file = PyObject_CallFunction((PyObject*)&PyFile_Type, "Nsi", uniobj, "a", 0); + + if (file != NULL) { + PyFile_SetEncodingAndErrors(file, "utf-8", NULL); + + PySys_SetObject("stdout", file); + PySys_SetObject("stderr", file); + PySys_SetObject("__stdout__", file); + PySys_SetObject("__stderr__", file); + + /* Be sure to disable buffering, otherwise we'll get overlap */ + setbuf(stdout, (char *)NULL); + setbuf(stderr, (char *)NULL); + } + } + else +#endif if (!supports_code_page(GetConsoleOutputCP()) || !supports_code_page(GetConsoleCP())) { /* Same hack as before except for Python 2.7, which doesn't seem to have diff --git a/samples/fireflies/main.py b/samples/fireflies/main.py index 41527beb88..f5f7c2e2a1 100755 --- a/samples/fireflies/main.py +++ b/samples/fireflies/main.py @@ -65,7 +65,7 @@ class FireflyDemo(ShowBase): # doesn't support the necessary OpenGL extensions. if self.modelbuffer is None or self.lightbuffer is None: - self.t = addTitle("Toon Shader: Video driver does not support " + self.t = addTitle("Firefly Demo: Video driver does not support " "multiple render targets") return