From 985ec3061c90af8248202eed612a0112ed91a012 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Dec 2021 20:37:14 +0100 Subject: [PATCH 1/7] makepanda: Fix deprecated spelling for threading API The new spelling is available since Python 2.6, so there is no chance of breakage here. --- makepanda/makepanda.py | 2 +- makepanda/makepandacore.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 19aa7cc626..d9bfb9e4e3 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -7093,7 +7093,7 @@ def ParallelMake(tasklist): # Create the workers for slave in range(THREADCOUNT): th = threading.Thread(target=BuildWorker, args=[taskqueue, donequeue]) - th.setDaemon(1) + th.daemon = True th.start() # Feed tasks to the workers. tasksqueued = 0 diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 4e03d3c2e2..b785a36089 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -24,7 +24,7 @@ SUFFIX_LIB = [".lib",".ilb"] VCS_DIRS = set(["CVS", "CVSROOT", ".git", ".hg", "__pycache__"]) VCS_FILES = set([".cvsignore", ".gitignore", ".gitmodules", ".hgignore"]) STARTTIME = time.time() -MAINTHREAD = threading.currentThread() +MAINTHREAD = threading.current_thread() OUTPUTDIR = "built" CUSTOM_OUTPUTDIR = False THIRDPARTYBASE = None @@ -243,7 +243,7 @@ def ProgressOutput(progress, msg, target = None): sys.stdout.flush() sys.stderr.flush() prefix = "" - thisthread = threading.currentThread() + thisthread = threading.current_thread() if thisthread is MAINTHREAD: if progress is None: prefix = "" @@ -273,7 +273,7 @@ def ProgressOutput(progress, msg, target = None): def exit(msg = ""): sys.stdout.flush() sys.stderr.flush() - if (threading.currentThread() == MAINTHREAD): + if threading.current_thread() == MAINTHREAD: SaveDependencyCache() print("Elapsed Time: " + PrettyTime(time.time() - STARTTIME)) print(msg) From 6419acb56f83c3fa8bd65f7dd1cdaa5fe380291f Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Dec 2021 20:37:50 +0100 Subject: [PATCH 2/7] actor: Fix deadlinks to renamed manual page in API reference --- direct/src/actor/Actor.py | 4 ++-- direct/src/actor/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index 1d3fd2b0c4..27708c6889 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -1,7 +1,7 @@ """Actor module: contains the Actor class. -See the :ref:`models-and-actors` page in the Programming Guide to learn -more about loading models and animated actors. +See the :ref:`loading-actors-and-animations` page in the Programming Guide +to learn more about loading animated models. """ __all__ = ['Actor'] diff --git a/direct/src/actor/__init__.py b/direct/src/actor/__init__.py index 14d116777f..191aacd08f 100644 --- a/direct/src/actor/__init__.py +++ b/direct/src/actor/__init__.py @@ -5,6 +5,6 @@ the lower-level :class:`panda3d.core.Character` implementation. It loads and controls an animated character and manages the animations playing on it. -See the :ref:`models-and-actors` page in the Programming Guide to learn -more about loading models and animated actors. +See the :ref:`loading-actors-and-animations` page in the Programming Guide +to learn more about loading animated models. """ From e2c26adcf03e8bdf739aef70115d6eb3b6d2d6b8 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Dec 2021 20:38:13 +0100 Subject: [PATCH 3/7] event: Mention that ButtonEvent API is not stable for Python use --- panda/src/event/buttonEvent.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/panda/src/event/buttonEvent.h b/panda/src/event/buttonEvent.h index 9da453a827..d80eabf701 100644 --- a/panda/src/event/buttonEvent.h +++ b/panda/src/event/buttonEvent.h @@ -42,6 +42,9 @@ class DatagramIterator; * keyboard (and other buttons for which there is a corresponding ButtonHandle * object), while keystroke events are defined across the entire Unicode * character set. + * + * This API should not be considered stable and may change in a future version + * of Panda3D. */ class EXPCL_PANDA_EVENT ButtonEvent { PUBLISHED: From 82ebf908fa07ca5e0fd42b82ba41864fb47109b6 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Dec 2021 20:38:31 +0100 Subject: [PATCH 4/7] gobj: Fix spelling error in doc of async-load-delay config variable --- panda/src/gobj/config_gobj.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index 07075a94a8..16a35981c5 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -487,7 +487,7 @@ PRC_DESC("If this is nonzero, it represents an artificial delay, " "in seconds, that is imposed on every asynchronous load attempt " "(within the thread). Its purpose is to help debug errors that " "may occur when an asynchronous load is delayed. The " - "delay is per-model, and all aync loads will be queued " + "delay is per-model, and all async loads will be queued " "up behind the delay--it is as if the time it takes to read a " "file is increased by this amount per read.")); From 24755bc8ebde6caec95b5995d75f3c59b7f5d4c1 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Dec 2021 20:40:29 +0100 Subject: [PATCH 5/7] gui: Allow OnscreenImage to be used before ShowBase is created Use TexturePool directly instead of a loader being present in the builtins Fixes #1209 --- direct/src/gui/OnscreenImage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/direct/src/gui/OnscreenImage.py b/direct/src/gui/OnscreenImage.py index fc3487cc72..a70d371b97 100644 --- a/direct/src/gui/OnscreenImage.py +++ b/direct/src/gui/OnscreenImage.py @@ -114,7 +114,9 @@ class OnscreenImage(DirectObject, NodePath): tex = image else: # It's a Texture file name - tex = loader.loadTexture(image) + tex = TexturePool.loadTexture(image) + if not tex: + raise IOError('Could not load texture: %s' % (image)) cm = CardMaker('OnscreenImage') cm.setFrame(-1, 1, -1, 1) self.assign(parent.attachNewNode(cm.generate(), sort)) From 420d1cee61fd85042eedd4e97eec024269725b03 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Dec 2021 20:43:07 +0100 Subject: [PATCH 6/7] makepanda: Fix unclosed file handles --- makepanda/makepandacore.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index b785a36089..97f79e951b 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1599,8 +1599,8 @@ def PkgConfigGetIncDirs(pkgname, tool = "pkg-config"): else: handle = os.popen(LocateBinary(tool) + " --cflags") result = handle.read().strip() - if len(result) == 0: return [] handle.close() + if len(result) == 0: return [] dirs = [] for opt in result.split(" "): if (opt.startswith("-I")): @@ -3637,7 +3637,8 @@ def UpdatePythonVersionInfoFile(new_info): json_data = [] if os.path.isfile(json_file) and not PkgSkip("PYTHON"): try: - json_data = json.load(open(json_file, 'r')) + with open(json_file, 'r') as fh: + json_data = json.load(fh) except: json_data = [] @@ -3655,7 +3656,9 @@ def UpdatePythonVersionInfoFile(new_info): if VERBOSE: print("Writing %s" % (json_file)) - json.dump(json_data, open(json_file, 'w'), indent=4) + + with open(json_file, 'w') as fh: + json.dump(json_data, fh, indent=4) def ReadPythonVersionInfoFile(): From 80892ede94a28edcdd0e6ed08de40b75ded972e3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 4 Dec 2021 13:31:09 +0200 Subject: [PATCH 7/7] assimp: Support compilation with Assimp 5.x Closes #1212 --- pandatool/src/assimp/pandaLogger.cxx | 9 +++++++++ pandatool/src/assimp/pandaLogger.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/pandatool/src/assimp/pandaLogger.cxx b/pandatool/src/assimp/pandaLogger.cxx index 2b92cfbc17..04745e2bc8 100644 --- a/pandatool/src/assimp/pandaLogger.cxx +++ b/pandatool/src/assimp/pandaLogger.cxx @@ -38,6 +38,15 @@ void PandaLogger::OnDebug(const char *message) { assimp_cat.debug() << message << "\n"; } +/** + * + */ +void PandaLogger::OnVerboseDebug(const char *message) { + if (assimp_cat.is_spam()) { + assimp_cat.spam() << message << "\n"; + } +} + /** * */ diff --git a/pandatool/src/assimp/pandaLogger.h b/pandatool/src/assimp/pandaLogger.h index dbd2165ce6..2fdbd44609 100644 --- a/pandatool/src/assimp/pandaLogger.h +++ b/pandatool/src/assimp/pandaLogger.h @@ -30,11 +30,17 @@ protected: INLINE bool attachStream(Assimp::LogStream*, unsigned int) { return false; }; + INLINE bool detachStream(Assimp::LogStream*, unsigned int) { + return false; + }; + + // Kept for compatibility with Assimp 4.x INLINE bool detatchStream(Assimp::LogStream*, unsigned int) { return false; }; void OnDebug(const char *message); + void OnVerboseDebug(const char *message); void OnError(const char *message); void OnInfo(const char *message); void OnWarn(const char *message);