From 2187ebaaa05c9860b4101630e4aa7e3a7a9075b5 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 8 Feb 2021 16:15:51 +0100 Subject: [PATCH 1/2] samples: Slight style tweaks to Roaming Ralph --- samples/roaming-ralph/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/roaming-ralph/main.py b/samples/roaming-ralph/main.py index 0290c3e74b..cfb54fdd19 100755 --- a/samples/roaming-ralph/main.py +++ b/samples/roaming-ralph/main.py @@ -231,10 +231,10 @@ class RoamingRalphDemo(ShowBase): # update his Z. If it hit anything else, or didn't hit anything, put # him back where he was last frame. - entries = list(self.ralphGroundHandler.getEntries()) + entries = list(self.ralphGroundHandler.entries) entries.sort(key=lambda x: x.getSurfacePoint(render).getZ()) - if len(entries) > 0 and entries[0].getIntoNode().getName() == "terrain": + if len(entries) > 0 and entries[0].getIntoNode().name == "terrain": self.ralph.setZ(entries[0].getSurfacePoint(render).getZ()) else: self.ralph.setPos(startpos) @@ -242,10 +242,10 @@ class RoamingRalphDemo(ShowBase): # Keep the camera at one foot above the terrain, # or two feet above ralph, whichever is greater. - entries = list(self.camGroundHandler.getEntries()) + entries = list(self.camGroundHandler.entries) entries.sort(key=lambda x: x.getSurfacePoint(render).getZ()) - if len(entries) > 0 and entries[0].getIntoNode().getName() == "terrain": + if len(entries) > 0 and entries[0].getIntoNode().name == "terrain": self.camera.setZ(entries[0].getSurfacePoint(render).getZ() + 1.0) if self.camera.getZ() < self.ralph.getZ() + 2.0: self.camera.setZ(self.ralph.getZ() + 2.0) From 03b96edfbcd340bfc8c561a1e56e4daf67781ac9 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 8 Feb 2021 16:16:20 +0100 Subject: [PATCH 2/2] interval: Fix ability to await Sequence objects --- direct/src/interval/cInterval_ext.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/direct/src/interval/cInterval_ext.cxx b/direct/src/interval/cInterval_ext.cxx index 9604f8003b..1225bae004 100644 --- a/direct/src/interval/cInterval_ext.cxx +++ b/direct/src/interval/cInterval_ext.cxx @@ -51,7 +51,10 @@ __await__(PyObject *self) { return nullptr; } - _this->start(); + // This may be overridden from Python (such as is the case for Sequence), so + // we call this via Python. + PyObject *result = PyObject_CallMethod(self, "start", nullptr); + Py_XDECREF(result); return Dtool_NewGenerator(self, &gen_next); }