From de2e35ee9a654893ef81e0a93d54566ba33e4900 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 12 Mar 2018 18:32:48 -0600 Subject: [PATCH 01/55] pandabase: Remove unused defines from pandasymbols --- panda/src/pandabase/pandasymbols.h | 86 ------------------------------ 1 file changed, 86 deletions(-) diff --git a/panda/src/pandabase/pandasymbols.h b/panda/src/pandabase/pandasymbols.h index 6c817f56bd..59d8a28bd8 100644 --- a/panda/src/pandabase/pandasymbols.h +++ b/panda/src/pandabase/pandasymbols.h @@ -21,14 +21,6 @@ C++-style comments, since this file is occasionally included by a C file. */ -#ifdef BUILDING_CFTALK - #define EXPCL_CFTALK EXPORT_CLASS - #define EXPTP_CFTALK EXPORT_TEMPL -#else - #define EXPCL_CFTALK IMPORT_CLASS - #define EXPTP_CFTALK IMPORT_TEMPL -#endif - #ifdef BUILDING_COLLADA #define EXPCL_COLLADA EXPORT_CLASS #define EXPTP_COLLADA EXPORT_TEMPL @@ -53,14 +45,6 @@ #define EXPTP_FRAMEWORK IMPORT_TEMPL #endif -#ifdef BUILDING_LINUX_AUDIO - #define EXPCL_LINUX_AUDIO EXPORT_CLASS - #define EXPTP_LINUX_AUDIO EXPORT_TEMPL -#else - #define EXPCL_LINUX_AUDIO IMPORT_CLASS - #define EXPTP_LINUX_AUDIO IMPORT_TEMPL -#endif - #ifdef BUILDING_MILES_AUDIO #define EXPCL_MILES_AUDIO EXPORT_CLASS #define EXPTP_MILES_AUDIO EXPORT_TEMPL @@ -77,14 +61,6 @@ #define EXPTP_FMOD_AUDIO IMPORT_TEMPL #endif -#ifdef BUILDING_OCULUSVR - #define EXPCL_OCULUSVR EXPORT_CLASS - #define EXPTP_OCULUSVR EXPORT_TEMPL -#else - #define EXPCL_OCULUSVR IMPORT_CLASS - #define EXPTP_OCULUSVR IMPORT_TEMPL -#endif - #ifdef BUILDING_OPENAL_AUDIO #define EXPCL_OPENAL_AUDIO EXPORT_CLASS #define EXPTP_OPENAL_AUDIO EXPORT_TEMPL @@ -117,14 +93,6 @@ #define EXPTP_PANDABULLET IMPORT_TEMPL #endif -#ifdef BUILDING_PANDACR - #define EXPCL_PANDACR EXPORT_CLASS - #define EXPTP_PANDACR EXPORT_TEMPL -#else - #define EXPCL_PANDACR IMPORT_CLASS - #define EXPTP_PANDACR IMPORT_TEMPL -#endif - #ifdef BUILDING_PANDADX #define EXPCL_PANDADX EXPORT_CLASS #define EXPTP_PANDADX EXPORT_TEMPL @@ -245,14 +213,6 @@ #define EXPTP_ROCKET IMPORT_TEMPL #endif -#ifdef BUILDING_SHADER - #define EXPCL_SHADER EXPORT_CLASS - #define EXPTP_SHADER EXPORT_TEMPL -#else - #define EXPCL_SHADER IMPORT_CLASS - #define EXPTP_SHADER IMPORT_TEMPL -#endif - #ifdef BUILDING_TINYDISPLAY #define EXPCL_TINYDISPLAY EXPORT_CLASS #define EXPTP_TINYDISPLAY EXPORT_TEMPL @@ -281,51 +241,11 @@ #define INLINE_LINMATH __forceinline #define INLINE_MATHUTIL __forceinline -#ifdef BUILDING_PANDA -#define INLINE_GRAPH __forceinline -#define INLINE_DISPLAY __forceinline -#else -#define INLINE_GRAPH -#define DONT_INLINE_GRAPH -#define INLINE_DISPLAY -#define DONT_INLINE_DISPLAY -#endif - #else #define INLINE_LINMATH INLINE #define INLINE_MATHUTIL INLINE -#define INLINE_GRAPH INLINE -#define INLINE_DISPLAY INLINE #endif -#define INLINE_CHAR INLINE -#define INLINE_CHAT INLINE -#define INLINE_CHAN INLINE -#define INLINE_CHANCFG INLINE -#define INLINE_COLLIDE INLINE -#define INLINE_CULL INLINE -#define INLINE_DEVICE INLINE -#define INLINE_DGRAPH INLINE -#define INLINE_GOBJ INLINE -#define INLINE_GRUTIL INLINE -#define INLINE_GSGBASE INLINE -#define INLINE_GSGMISC INLINE -#define INLINE_LIGHT INLINE -#define INLINE_PARAMETRICS INLINE -#define INLINE_SGRATTRIB INLINE -#define INLINE_SGMANIP INLINE -#define INLINE_SGRAPH INLINE -#define INLINE_SGRAPHUTIL INLINE -#define INLINE_SWITCHNODE INLINE -#define INLINE_TEXT INLINE -#define INLINE_TFORM INLINE -#define INLINE_LERP INLINE -#define INLINE_LOADER INLINE -#define INLINE_PUTIL INLINE -#define INLINE_EFFECTS INLINE -#define INLINE_GUI INLINE -#define INLINE_AUDIO INLINE - #define EXPCL_PANDA_PGRAPH EXPCL_PANDA #define EXPTP_PANDA_PGRAPH EXPTP_PANDA @@ -408,9 +328,6 @@ #define EXPCL_PANDA_TFORM EXPCL_PANDA #define EXPTP_PANDA_TFORM EXPTP_PANDA -#define EXPCL_PANDA_LERP EXPCL_PANDA -#define EXPTP_PANDA_LERP EXPTP_PANDA - #define EXPCL_PANDA_PUTIL EXPCL_PANDA #define EXPTP_PANDA_PUTIL EXPTP_PANDA @@ -420,7 +337,4 @@ #define EXPCL_PANDA_PGUI EXPCL_PANDA #define EXPTP_PANDA_PGUI EXPTP_PANDA -#define EXPCL_PANDA_PANDABASE EXPCL_PANDA -#define EXPTP_PANDA_PANDABASE EXPTP_PANDA - #endif From 350f437fbe15e5c4da650df053ae034ac2bc5755 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 12 Mar 2018 18:53:01 -0600 Subject: [PATCH 02/55] pandabase: Alphabetically sort pandasymbols.h [skip ci] --- panda/src/pandabase/pandasymbols.h | 94 +++++++++++++++--------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/panda/src/pandabase/pandasymbols.h b/panda/src/pandabase/pandasymbols.h index 59d8a28bd8..dafb15e7f1 100644 --- a/panda/src/pandabase/pandasymbols.h +++ b/panda/src/pandabase/pandasymbols.h @@ -37,6 +37,14 @@ #define EXPTP_FFMPEG IMPORT_TEMPL #endif +#ifdef BUILDING_FMOD_AUDIO + #define EXPCL_FMOD_AUDIO EXPORT_CLASS + #define EXPTP_FMOD_AUDIO EXPORT_TEMPL +#else + #define EXPCL_FMOD_AUDIO IMPORT_CLASS + #define EXPTP_FMOD_AUDIO IMPORT_TEMPL +#endif + #ifdef BUILDING_FRAMEWORK #define EXPCL_FRAMEWORK EXPORT_CLASS #define EXPTP_FRAMEWORK EXPORT_TEMPL @@ -53,14 +61,6 @@ #define EXPTP_MILES_AUDIO IMPORT_TEMPL #endif -#ifdef BUILDING_FMOD_AUDIO - #define EXPCL_FMOD_AUDIO EXPORT_CLASS - #define EXPTP_FMOD_AUDIO EXPORT_TEMPL -#else - #define EXPCL_FMOD_AUDIO IMPORT_CLASS - #define EXPTP_FMOD_AUDIO IMPORT_TEMPL -#endif - #ifdef BUILDING_OPENAL_AUDIO #define EXPCL_OPENAL_AUDIO EXPORT_CLASS #define EXPTP_OPENAL_AUDIO EXPORT_TEMPL @@ -173,14 +173,6 @@ #define EXPTP_PANDAPHYSX IMPORT_TEMPL #endif -#ifdef BUILDING_PANDASPEEDTREE - #define EXPCL_PANDASPEEDTREE EXPORT_CLASS - #define EXPTP_PANDASPEEDTREE EXPORT_TEMPL -#else - #define EXPCL_PANDASPEEDTREE IMPORT_CLASS - #define EXPTP_PANDASPEEDTREE IMPORT_TEMPL -#endif - #ifdef BUILDING_PANDASKEL #define EXPCL_PANDASKEL EXPORT_CLASS #define EXPTP_PANDASKEL EXPORT_TEMPL @@ -189,6 +181,14 @@ #define EXPTP_PANDASKEL IMPORT_TEMPL #endif +#ifdef BUILDING_PANDASPEEDTREE + #define EXPCL_PANDASPEEDTREE EXPORT_CLASS + #define EXPTP_PANDASPEEDTREE EXPORT_TEMPL +#else + #define EXPCL_PANDASPEEDTREE IMPORT_CLASS + #define EXPTP_PANDASPEEDTREE IMPORT_TEMPL +#endif + #ifdef BUILDING_PANDAWIN #define EXPCL_PANDAWIN EXPORT_CLASS #define EXPTP_PANDAWIN EXPORT_TEMPL @@ -247,20 +247,8 @@ #endif -#define EXPCL_PANDA_PGRAPH EXPCL_PANDA -#define EXPTP_PANDA_PGRAPH EXPTP_PANDA - -#define EXPCL_PANDA_PGRAPHNODES EXPCL_PANDA -#define EXPTP_PANDA_PGRAPHNODES EXPTP_PANDA - -#define EXPCL_PANDA_RECORDER EXPCL_PANDA -#define EXPTP_PANDA_RECORDER EXPTP_PANDA - -#define EXPCL_PANDA_PIPELINE EXPCL_PANDA -#define EXPTP_PANDA_PIPELINE EXPTP_PANDA - -#define EXPCL_PANDA_GRUTIL EXPCL_PANDA -#define EXPTP_PANDA_GRUTIL EXPTP_PANDA +#define EXPCL_PANDA_AUDIO EXPCL_PANDA +#define EXPTP_PANDA_AUDIO EXPTP_PANDA #define EXPCL_PANDA_CHAN EXPCL_PANDA #define EXPTP_PANDA_CHAN EXPTP_PANDA @@ -268,9 +256,6 @@ #define EXPCL_PANDA_CHAR EXPCL_PANDA #define EXPTP_PANDA_CHAR EXPTP_PANDA -#define EXPCL_PANDA_PSTATCLIENT EXPCL_PANDA -#define EXPTP_PANDA_PSTATCLIENT EXPTP_PANDA - #define EXPCL_PANDA_COLLIDE EXPCL_PANDA #define EXPTP_PANDA_COLLIDE EXPTP_PANDA @@ -292,6 +277,9 @@ #define EXPCL_PANDA_GOBJ EXPCL_PANDA #define EXPTP_PANDA_GOBJ EXPTP_PANDA +#define EXPCL_PANDA_GRUTIL EXPCL_PANDA +#define EXPTP_PANDA_GRUTIL EXPTP_PANDA + #define EXPCL_PANDA_GSGBASE EXPCL_PANDA #define EXPTP_PANDA_GSGBASE EXPTP_PANDA @@ -304,37 +292,49 @@ #define EXPCL_PANDA_MOVIES EXPCL_PANDA #define EXPTP_PANDA_MOVIES EXPTP_PANDA -#define EXPCL_PANDA_NET EXPCL_PANDA -#define EXPTP_PANDA_NET EXPTP_PANDA - #define EXPCL_PANDA_NATIVENET EXPCL_PANDA #define EXPTP_PANDA_NATIVENET EXPTP_PANDA +#define EXPCL_PANDA_NET EXPCL_PANDA +#define EXPTP_PANDA_NET EXPTP_PANDA + #define EXPCL_PANDA_PARAMETRICS EXPCL_PANDA #define EXPTP_PANDA_PARAMETRICS EXPTP_PANDA -#define EXPCL_PANDA_PNMIMAGETYPES EXPCL_PANDA -#define EXPTP_PANDA_PNMIMAGETYPES EXPTP_PANDA +#define EXPCL_PANDA_PGRAPH EXPCL_PANDA +#define EXPTP_PANDA_PGRAPH EXPTP_PANDA + +#define EXPCL_PANDA_PGRAPHNODES EXPCL_PANDA +#define EXPTP_PANDA_PGRAPHNODES EXPTP_PANDA + +#define EXPCL_PANDA_PGUI EXPCL_PANDA +#define EXPTP_PANDA_PGUI EXPTP_PANDA + +#define EXPCL_PANDA_PIPELINE EXPCL_PANDA +#define EXPTP_PANDA_PIPELINE EXPTP_PANDA #define EXPCL_PANDA_PNMIMAGE EXPCL_PANDA #define EXPTP_PANDA_PNMIMAGE EXPTP_PANDA +#define EXPCL_PANDA_PNMIMAGETYPES EXPCL_PANDA +#define EXPTP_PANDA_PNMIMAGETYPES EXPTP_PANDA + #define EXPCL_PANDA_PNMTEXT EXPCL_PANDA #define EXPTP_PANDA_PNMTEXT EXPTP_PANDA +#define EXPCL_PANDA_PSTATCLIENT EXPCL_PANDA +#define EXPTP_PANDA_PSTATCLIENT EXPTP_PANDA + +#define EXPCL_PANDA_PUTIL EXPCL_PANDA +#define EXPTP_PANDA_PUTIL EXPTP_PANDA + +#define EXPCL_PANDA_RECORDER EXPCL_PANDA +#define EXPTP_PANDA_RECORDER EXPTP_PANDA + #define EXPCL_PANDA_TEXT EXPCL_PANDA #define EXPTP_PANDA_TEXT EXPTP_PANDA #define EXPCL_PANDA_TFORM EXPCL_PANDA #define EXPTP_PANDA_TFORM EXPTP_PANDA -#define EXPCL_PANDA_PUTIL EXPCL_PANDA -#define EXPTP_PANDA_PUTIL EXPTP_PANDA - -#define EXPCL_PANDA_AUDIO EXPCL_PANDA -#define EXPTP_PANDA_AUDIO EXPTP_PANDA - -#define EXPCL_PANDA_PGUI EXPCL_PANDA -#define EXPTP_PANDA_PGUI EXPTP_PANDA - #endif From 32aceab7b4e9ea46cd8975dc5df15ba9129decce Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Thu, 15 Mar 2018 12:47:09 -0600 Subject: [PATCH 03/55] grutil: Fix missing EXPCL_PANDA_GRUTIL --- panda/src/grutil/sceneGraphAnalyzerMeter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/grutil/sceneGraphAnalyzerMeter.h b/panda/src/grutil/sceneGraphAnalyzerMeter.h index a788ef2f2b..a20066d9d7 100644 --- a/panda/src/grutil/sceneGraphAnalyzerMeter.h +++ b/panda/src/grutil/sceneGraphAnalyzerMeter.h @@ -36,7 +36,7 @@ class ClockObject; * channel or window. If this is done, it creates a DisplayRegion for itself * and renders itself in the upper-right-hand corner. */ -class EXPCL_PANDA SceneGraphAnalyzerMeter : public TextNode { +class EXPCL_PANDA_GRUTIL SceneGraphAnalyzerMeter : public TextNode { PUBLISHED: explicit SceneGraphAnalyzerMeter(const string &name, PandaNode *node); virtual ~SceneGraphAnalyzerMeter(); From 477e6b75613d31920eaf287a5624d99bd531ef7d Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Thu, 15 Mar 2018 12:50:22 -0600 Subject: [PATCH 04/55] dxml: EXPCL_PANDA -> EXPCL_PANDA_DXML --- panda/src/dxml/config_dxml.h | 12 ++++++------ panda/src/pandabase/pandasymbols.h | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/panda/src/dxml/config_dxml.h b/panda/src/dxml/config_dxml.h index 4596df95bb..ca2113f678 100644 --- a/panda/src/dxml/config_dxml.h +++ b/panda/src/dxml/config_dxml.h @@ -28,17 +28,17 @@ #define TIXML_USE_STL #endif -NotifyCategoryDecl(dxml, EXPCL_PANDA, EXPTP_PANDA); +NotifyCategoryDecl(dxml, EXPCL_PANDA_DXML, EXPTP_PANDA_DXML); -extern EXPCL_PANDA void init_libdxml(); +extern EXPCL_PANDA_DXML void init_libdxml(); class TiXmlDocument; class TiXmlNode; BEGIN_PUBLISH -EXPCL_PANDA TiXmlDocument *read_xml_stream(istream &in); -EXPCL_PANDA void write_xml_stream(ostream &out, TiXmlDocument *doc); -EXPCL_PANDA void print_xml(TiXmlNode *xnode); -EXPCL_PANDA void print_xml_to_file(const Filename &filename, TiXmlNode *xnode); +EXPCL_PANDA_DXML TiXmlDocument *read_xml_stream(istream &in); +EXPCL_PANDA_DXML void write_xml_stream(ostream &out, TiXmlDocument *doc); +EXPCL_PANDA_DXML void print_xml(TiXmlNode *xnode); +EXPCL_PANDA_DXML void print_xml_to_file(const Filename &filename, TiXmlNode *xnode); END_PUBLISH #endif diff --git a/panda/src/pandabase/pandasymbols.h b/panda/src/pandabase/pandasymbols.h index dafb15e7f1..b1dad6e422 100644 --- a/panda/src/pandabase/pandasymbols.h +++ b/panda/src/pandabase/pandasymbols.h @@ -271,6 +271,9 @@ #define EXPCL_PANDA_DISPLAY EXPCL_PANDA #define EXPTP_PANDA_DISPLAY EXPTP_PANDA +#define EXPCL_PANDA_DXML EXPCL_PANDA +#define EXPTP_PANDA_DXML EXPTP_PANDA + #define EXPCL_PANDA_EVENT EXPCL_PANDA #define EXPTP_PANDA_EVENT EXPTP_PANDA From adbab8deae333f735a7fde44f464833dd437c914 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 16 Mar 2018 21:22:23 +0100 Subject: [PATCH 05/55] x11display: reenable confined mode on window reconfigure Fixes #280 --- panda/src/x11display/x11GraphicsWindow.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index c57a580aa7..0a1539bd42 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -446,6 +446,21 @@ process_events() { XConfigureWindow(_display, _xwindow, value_mask, &changes); } } + + // If the window was reconfigured, we may need to re-confine the mouse + // pointer. See GitHub bug #280. + if (_properties.get_mouse_mode() == WindowProperties::M_confined) { + X11_Cursor cursor = None; + if (_properties.get_cursor_hidden()) { + x11GraphicsPipe *x11_pipe; + DCAST_INTO_V(x11_pipe, _pipe); + cursor = x11_pipe->get_hidden_cursor(); + } + + XGrabPointer(_display, _xwindow, True, 0, GrabModeAsync, GrabModeAsync, + _xwindow, cursor, CurrentTime); + } + changed_properties = true; } From 2031409a6e62dd9ff4aeca7bca01ba6601d6070a Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 18 Mar 2018 00:27:05 -0600 Subject: [PATCH 06/55] gobj: Fix missing include --- panda/src/gobj/geomLinestripsAdjacency.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/panda/src/gobj/geomLinestripsAdjacency.cxx b/panda/src/gobj/geomLinestripsAdjacency.cxx index b8c69fc240..11d14ab319 100644 --- a/panda/src/gobj/geomLinestripsAdjacency.cxx +++ b/panda/src/gobj/geomLinestripsAdjacency.cxx @@ -13,6 +13,7 @@ #include "geomLinestripsAdjacency.h" #include "geomLines.h" +#include "geomLinesAdjacency.h" #include "geomVertexRewriter.h" #include "pStatTimer.h" #include "bamReader.h" From a4c1b443710c6208fb0b29ca4f56899fc75714f1 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 19 Mar 2018 21:20:10 -0600 Subject: [PATCH 07/55] dtoolbase: Remove EXPORT_TEMPLATES define As of f69354d9fa603ac05dfd924af3844f749fd50cdd, this is just always expected on all platforms. If it's not defined, TemplateClass::_type_handle won't link correctly with some compilers (e.g. Clang) and the lack of 'extern template class' will result in duplicated code in any case. In short, turning it off causes problems. makepanda also always turns this on, so it doesn't represent any optional feature or autodetected platform-specific behavior anyway. --- dtool/src/dtoolbase/dtoolbase_cc.h | 2 +- makepanda/makepanda.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index eb84f1fccd..dee66e04da 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -257,7 +257,7 @@ template typename remove_reference::type &&move(T &&t) { #endif -#if !defined(LINK_ALL_STATIC) && defined(EXPORT_TEMPLATES) +#ifndef LINK_ALL_STATIC // This macro must be used to export an instantiated template class from a // DLL. If the template class name itself contains commas, it may be // necessary to first define a macro for the class name, to allow proper macro diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 1c8c95724d..59633ea892 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2253,7 +2253,6 @@ DTOOL_CONFIG=[ ("SUPPORT_FIXED_FUNCTION", '1', '1'), ("DO_MEMORY_USAGE", 'UNDEF', 'UNDEF'), ("DO_PIPELINING", '1', '1'), - ("EXPORT_TEMPLATES", 'yes', 'yes'), ("DEFAULT_PATHSEP", '";"', '":"'), ("WORDS_BIGENDIAN", 'UNDEF', 'UNDEF'), ("HAVE_NAMESPACE", '1', '1'), From cfd70ebeadd15074f00b3266cc1a1629014cf5fd Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 19 Mar 2018 21:41:23 -0600 Subject: [PATCH 08/55] general: Remove '#pragma interface'/'#pragma implementation' The GCC documentation states that, as of GCC 2.7.2, these aren't necessary for proper program behavior. The documentation further discourages their use because they don't suppress unnecessary code duplication. The Panda codebase these days uses "extern template class" instead, which tells the compiler not to perform implicit template expansion because an explicit template expansion is available for linking elsewhere in the program. This is a more compiler-neutral way of achieving the same thing as '#pragma interface', making '#pragma interface' not only redundant, it could also mask problems in the "extern template class" machinery. --- dtool/src/dtoolutil/vector_double.cxx | 5 ----- dtool/src/dtoolutil/vector_double.h | 5 ----- dtool/src/dtoolutil/vector_float.cxx | 5 ----- dtool/src/dtoolutil/vector_float.h | 5 ----- dtool/src/dtoolutil/vector_int.cxx | 5 ----- dtool/src/dtoolutil/vector_int.h | 5 ----- dtool/src/dtoolutil/vector_string.cxx | 5 ----- dtool/src/dtoolutil/vector_string.h | 5 ----- dtool/src/dtoolutil/vector_uchar.cxx | 5 ----- dtool/src/dtoolutil/vector_uchar.h | 5 ----- panda/src/chan/animChannel.cxx | 5 ----- panda/src/chan/animChannel.h | 6 ------ panda/src/chan/movingPartMatrix.cxx | 5 ----- panda/src/chan/movingPartMatrix.h | 5 ----- panda/src/chan/movingPartScalar.cxx | 5 ----- panda/src/chan/movingPartScalar.h | 5 ----- panda/src/chan/vector_PartGroupStar.cxx | 5 ----- panda/src/chan/vector_PartGroupStar.h | 5 ----- panda/src/display/graphicsWindowInputDevice.cxx | 5 ----- panda/src/display/graphicsWindowInputDevice.h | 5 ----- panda/src/egg/pt_EggMaterial.cxx | 5 ----- panda/src/egg/pt_EggMaterial.h | 5 ----- panda/src/egg/pt_EggTexture.cxx | 5 ----- panda/src/egg/pt_EggTexture.h | 5 ----- panda/src/egg/pt_EggVertex.cxx | 5 ----- panda/src/egg/pt_EggVertex.h | 5 ----- panda/src/egg/vector_PT_EggMaterial.cxx | 5 ----- panda/src/egg/vector_PT_EggMaterial.h | 5 ----- panda/src/egg/vector_PT_EggTexture.cxx | 5 ----- panda/src/egg/vector_PT_EggTexture.h | 5 ----- panda/src/egg/vector_PT_EggVertex.cxx | 5 ----- panda/src/egg/vector_PT_EggVertex.h | 5 ----- panda/src/event/eventParameter.cxx | 5 ----- panda/src/event/eventParameter.h | 5 ----- panda/src/event/pt_Event.cxx | 5 ----- panda/src/event/pt_Event.h | 5 ----- panda/src/express/pta_double.cxx | 5 ----- panda/src/express/pta_double.h | 5 ----- panda/src/express/pta_float.cxx | 5 ----- panda/src/express/pta_float.h | 5 ----- panda/src/express/pta_int.cxx | 5 ----- panda/src/express/pta_int.h | 5 ----- panda/src/express/pta_uchar.cxx | 5 ----- panda/src/express/pta_uchar.h | 5 ----- panda/src/mathutil/linmath_events.cxx | 5 ----- panda/src/mathutil/linmath_events.h | 5 ----- panda/src/mathutil/pta_LMatrix3.cxx | 5 ----- panda/src/mathutil/pta_LMatrix3.h | 5 ----- panda/src/mathutil/pta_LMatrix4.cxx | 5 ----- panda/src/mathutil/pta_LMatrix4.h | 5 ----- panda/src/mathutil/pta_LVecBase2.cxx | 5 ----- panda/src/mathutil/pta_LVecBase2.h | 5 ----- panda/src/mathutil/pta_LVecBase3.cxx | 5 ----- panda/src/mathutil/pta_LVecBase3.h | 5 ----- panda/src/mathutil/pta_LVecBase4.cxx | 5 ----- panda/src/mathutil/pta_LVecBase4.h | 5 ----- panda/src/putil/bitMask.cxx | 5 ----- panda/src/putil/bitMask.h | 5 ----- panda/src/putil/doubleBitMask.cxx | 5 ----- panda/src/putil/doubleBitMask.h | 5 ----- panda/src/putil/paramValue.cxx | 5 ----- panda/src/putil/paramValue.h | 5 ----- panda/src/putil/pta_ushort.cxx | 5 ----- panda/src/putil/pta_ushort.h | 5 ----- panda/src/putil/vector_typedWritable.cxx | 5 ----- panda/src/putil/vector_typedWritable.h | 5 ----- panda/src/putil/vector_ulong.cxx | 5 ----- panda/src/putil/vector_ulong.h | 5 ----- panda/src/putil/vector_ushort.cxx | 5 ----- panda/src/putil/vector_ushort.h | 5 ----- panda/src/putil/vector_writable.cxx | 5 ----- panda/src/putil/vector_writable.h | 5 ----- 72 files changed, 361 deletions(-) diff --git a/dtool/src/dtoolutil/vector_double.cxx b/dtool/src/dtoolutil/vector_double.cxx index a6def549af..e275c5ac8c 100644 --- a/dtool/src/dtoolutil/vector_double.cxx +++ b/dtool/src/dtoolutil/vector_double.cxx @@ -19,8 +19,3 @@ #define NAME vector_double #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/dtool/src/dtoolutil/vector_double.h b/dtool/src/dtoolutil/vector_double.h index 6757bddc7a..5e00afd598 100644 --- a/dtool/src/dtoolutil/vector_double.h +++ b/dtool/src/dtoolutil/vector_double.h @@ -30,9 +30,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/dtool/src/dtoolutil/vector_float.cxx b/dtool/src/dtoolutil/vector_float.cxx index a84b030a56..3d2d1233c5 100644 --- a/dtool/src/dtoolutil/vector_float.cxx +++ b/dtool/src/dtoolutil/vector_float.cxx @@ -19,8 +19,3 @@ #define NAME vector_float #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/dtool/src/dtoolutil/vector_float.h b/dtool/src/dtoolutil/vector_float.h index 36d9f200f9..b9033a5ce7 100644 --- a/dtool/src/dtoolutil/vector_float.h +++ b/dtool/src/dtoolutil/vector_float.h @@ -30,9 +30,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/dtool/src/dtoolutil/vector_int.cxx b/dtool/src/dtoolutil/vector_int.cxx index 1bb9423b7e..3032da29f4 100644 --- a/dtool/src/dtoolutil/vector_int.cxx +++ b/dtool/src/dtoolutil/vector_int.cxx @@ -19,8 +19,3 @@ #define NAME vector_int #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/dtool/src/dtoolutil/vector_int.h b/dtool/src/dtoolutil/vector_int.h index 56436a956f..b149c3ddd3 100644 --- a/dtool/src/dtoolutil/vector_int.h +++ b/dtool/src/dtoolutil/vector_int.h @@ -30,9 +30,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/dtool/src/dtoolutil/vector_string.cxx b/dtool/src/dtoolutil/vector_string.cxx index 0e5df2ce1d..72239b28ac 100644 --- a/dtool/src/dtoolutil/vector_string.cxx +++ b/dtool/src/dtoolutil/vector_string.cxx @@ -19,8 +19,3 @@ #define NAME vector_string #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/dtool/src/dtoolutil/vector_string.h b/dtool/src/dtoolutil/vector_string.h index d34ab7b301..117baf8543 100644 --- a/dtool/src/dtoolutil/vector_string.h +++ b/dtool/src/dtoolutil/vector_string.h @@ -30,9 +30,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/dtool/src/dtoolutil/vector_uchar.cxx b/dtool/src/dtoolutil/vector_uchar.cxx index 07434032dd..e3473584d4 100644 --- a/dtool/src/dtoolutil/vector_uchar.cxx +++ b/dtool/src/dtoolutil/vector_uchar.cxx @@ -19,8 +19,3 @@ #define NAME vector_uchar #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/dtool/src/dtoolutil/vector_uchar.h b/dtool/src/dtoolutil/vector_uchar.h index 608472ae7e..bf8d989990 100644 --- a/dtool/src/dtoolutil/vector_uchar.h +++ b/dtool/src/dtoolutil/vector_uchar.h @@ -30,9 +30,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/chan/animChannel.cxx b/panda/src/chan/animChannel.cxx index 66fc1329f4..dfaf152b7b 100644 --- a/panda/src/chan/animChannel.cxx +++ b/panda/src/chan/animChannel.cxx @@ -15,11 +15,6 @@ #include "compose_matrix.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class AnimChannel; template class AnimChannel; diff --git a/panda/src/chan/animChannel.h b/panda/src/chan/animChannel.h index 1c7fd639fc..4137196f52 100644 --- a/panda/src/chan/animChannel.h +++ b/panda/src/chan/animChannel.h @@ -122,10 +122,4 @@ typedef AnimChannel AnimChannelScalar; #include "animChannel.I" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/chan/movingPartMatrix.cxx b/panda/src/chan/movingPartMatrix.cxx index 29ed1f79be..6477728e0d 100644 --- a/panda/src/chan/movingPartMatrix.cxx +++ b/panda/src/chan/movingPartMatrix.cxx @@ -21,11 +21,6 @@ #include "bamWriter.h" #include "config_chan.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class MovingPart; TypeHandle MovingPartMatrix::_type_handle; diff --git a/panda/src/chan/movingPartMatrix.h b/panda/src/chan/movingPartMatrix.h index 78352423fc..3c232e63d0 100644 --- a/panda/src/chan/movingPartMatrix.h +++ b/panda/src/chan/movingPartMatrix.h @@ -72,9 +72,4 @@ private: #include "movingPartMatrix.I" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/chan/movingPartScalar.cxx b/panda/src/chan/movingPartScalar.cxx index ed49cddf63..abebb49a32 100644 --- a/panda/src/chan/movingPartScalar.cxx +++ b/panda/src/chan/movingPartScalar.cxx @@ -19,11 +19,6 @@ #include "bamWriter.h" #include "config_chan.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class MovingPart; TypeHandle MovingPartScalar::_type_handle; diff --git a/panda/src/chan/movingPartScalar.h b/panda/src/chan/movingPartScalar.h index 5e45e95e4a..90bd049ee5 100644 --- a/panda/src/chan/movingPartScalar.h +++ b/panda/src/chan/movingPartScalar.h @@ -70,9 +70,4 @@ private: #include "movingPartScalar.I" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/chan/vector_PartGroupStar.cxx b/panda/src/chan/vector_PartGroupStar.cxx index e0f6554731..d31dd613bb 100644 --- a/panda/src/chan/vector_PartGroupStar.cxx +++ b/panda/src/chan/vector_PartGroupStar.cxx @@ -19,8 +19,3 @@ #define NAME vector_PartGroupStar #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/chan/vector_PartGroupStar.h b/panda/src/chan/vector_PartGroupStar.h index 988635dc33..4e5098a8a8 100644 --- a/panda/src/chan/vector_PartGroupStar.h +++ b/panda/src/chan/vector_PartGroupStar.h @@ -32,9 +32,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/display/graphicsWindowInputDevice.cxx b/panda/src/display/graphicsWindowInputDevice.cxx index 4e0b0a08c2..89d6e9d5b4 100644 --- a/panda/src/display/graphicsWindowInputDevice.cxx +++ b/panda/src/display/graphicsWindowInputDevice.cxx @@ -23,11 +23,6 @@ #include "vector_src.cxx" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - /** * Defines a new InputDevice for the window. Most windows will have exactly * one InputDevice: a keyboard/mouse pair. Some may also add joystick data, diff --git a/panda/src/display/graphicsWindowInputDevice.h b/panda/src/display/graphicsWindowInputDevice.h index 7523ea7e91..5cdff54f29 100644 --- a/panda/src/display/graphicsWindowInputDevice.h +++ b/panda/src/display/graphicsWindowInputDevice.h @@ -142,9 +142,4 @@ private: #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/egg/pt_EggMaterial.cxx b/panda/src/egg/pt_EggMaterial.cxx index 2750824e5a..af0ae82e6f 100644 --- a/panda/src/egg/pt_EggMaterial.cxx +++ b/panda/src/egg/pt_EggMaterial.cxx @@ -13,11 +13,6 @@ #include "pt_EggMaterial.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase; template class PointerTo; template class ConstPointerTo; diff --git a/panda/src/egg/pt_EggMaterial.h b/panda/src/egg/pt_EggMaterial.h index 218de12074..7c5e5f083e 100644 --- a/panda/src/egg/pt_EggMaterial.h +++ b/panda/src/egg/pt_EggMaterial.h @@ -31,9 +31,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, ConstPointerTo PT_EggMaterial; typedef ConstPointerTo CPT_EggMaterial; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/egg/pt_EggTexture.cxx b/panda/src/egg/pt_EggTexture.cxx index 8a90ad2a24..ea2336996f 100644 --- a/panda/src/egg/pt_EggTexture.cxx +++ b/panda/src/egg/pt_EggTexture.cxx @@ -13,11 +13,6 @@ #include "pt_EggTexture.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase; template class PointerTo; template class ConstPointerTo; diff --git a/panda/src/egg/pt_EggTexture.h b/panda/src/egg/pt_EggTexture.h index 15a9738f96..bc61025fb6 100644 --- a/panda/src/egg/pt_EggTexture.h +++ b/panda/src/egg/pt_EggTexture.h @@ -31,9 +31,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, ConstPointerTo typedef PointerTo PT_EggTexture; typedef ConstPointerTo CPT_EggTexture; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/egg/pt_EggVertex.cxx b/panda/src/egg/pt_EggVertex.cxx index b1b932328b..9c974e8e63 100644 --- a/panda/src/egg/pt_EggVertex.cxx +++ b/panda/src/egg/pt_EggVertex.cxx @@ -13,11 +13,6 @@ #include "pt_EggVertex.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase; template class PointerTo; template class ConstPointerTo; diff --git a/panda/src/egg/pt_EggVertex.h b/panda/src/egg/pt_EggVertex.h index 483a893a13..5c2922b51d 100644 --- a/panda/src/egg/pt_EggVertex.h +++ b/panda/src/egg/pt_EggVertex.h @@ -31,9 +31,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, ConstPointerTo) typedef PointerTo PT_EggVertex; typedef ConstPointerTo CPT_EggVertex; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/egg/vector_PT_EggMaterial.cxx b/panda/src/egg/vector_PT_EggMaterial.cxx index ce183b5aa0..d504d36ca9 100644 --- a/panda/src/egg/vector_PT_EggMaterial.cxx +++ b/panda/src/egg/vector_PT_EggMaterial.cxx @@ -19,8 +19,3 @@ #define NAME vector_PT_EggMaterial #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/egg/vector_PT_EggMaterial.h b/panda/src/egg/vector_PT_EggMaterial.h index 0aaab728a7..0878ba71c0 100644 --- a/panda/src/egg/vector_PT_EggMaterial.h +++ b/panda/src/egg/vector_PT_EggMaterial.h @@ -35,9 +35,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/egg/vector_PT_EggTexture.cxx b/panda/src/egg/vector_PT_EggTexture.cxx index f95063202e..bdd2acf2da 100644 --- a/panda/src/egg/vector_PT_EggTexture.cxx +++ b/panda/src/egg/vector_PT_EggTexture.cxx @@ -19,8 +19,3 @@ #define NAME vector_PT_EggTexture #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/egg/vector_PT_EggTexture.h b/panda/src/egg/vector_PT_EggTexture.h index 44849ec364..12d5f91212 100644 --- a/panda/src/egg/vector_PT_EggTexture.h +++ b/panda/src/egg/vector_PT_EggTexture.h @@ -35,9 +35,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/egg/vector_PT_EggVertex.cxx b/panda/src/egg/vector_PT_EggVertex.cxx index 0343a4771b..61deffdeac 100644 --- a/panda/src/egg/vector_PT_EggVertex.cxx +++ b/panda/src/egg/vector_PT_EggVertex.cxx @@ -19,8 +19,3 @@ #define NAME vector_PT_EggVertex #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/egg/vector_PT_EggVertex.h b/panda/src/egg/vector_PT_EggVertex.h index 6827f35783..8d04bccc17 100644 --- a/panda/src/egg/vector_PT_EggVertex.h +++ b/panda/src/egg/vector_PT_EggVertex.h @@ -35,9 +35,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/event/eventParameter.cxx b/panda/src/event/eventParameter.cxx index 45780e5ff0..e5e55a1bac 100644 --- a/panda/src/event/eventParameter.cxx +++ b/panda/src/event/eventParameter.cxx @@ -14,11 +14,6 @@ #include "eventParameter.h" #include "dcast.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class ParamValue; template class ParamValue; diff --git a/panda/src/event/eventParameter.h b/panda/src/event/eventParameter.h index b0cbcc1376..65dbf550c8 100644 --- a/panda/src/event/eventParameter.h +++ b/panda/src/event/eventParameter.h @@ -86,9 +86,4 @@ typedef ParamWstring EventStoreWstring; #include "eventParameter.I" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/event/pt_Event.cxx b/panda/src/event/pt_Event.cxx index 095ce8b56b..66b4897052 100644 --- a/panda/src/event/pt_Event.cxx +++ b/panda/src/event/pt_Event.cxx @@ -13,11 +13,6 @@ #include "pt_Event.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase; template class PointerTo; template class ConstPointerTo; diff --git a/panda/src/event/pt_Event.h b/panda/src/event/pt_Event.h index 6c59b8fecd..ce5d8cea39 100644 --- a/panda/src/event/pt_Event.h +++ b/panda/src/event/pt_Event.h @@ -32,9 +32,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_EVENT, EXPTP_PANDA_EVENT, ConstPointerTo PT_Event; typedef ConstPointerTo CPT_Event; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/express/pta_double.cxx b/panda/src/express/pta_double.cxx index efb3ec3086..0acc113075 100644 --- a/panda/src/express/pta_double.cxx +++ b/panda/src/express/pta_double.cxx @@ -13,11 +13,6 @@ #include "pta_double.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/express/pta_double.h b/panda/src/express/pta_double.h index 2cb239513f..4db51677eb 100644 --- a/panda/src/express/pta_double.h +++ b/panda/src/express/pta_double.h @@ -34,9 +34,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, ConstPointerToArra typedef PointerToArray PTA_double; typedef ConstPointerToArray CPTA_double; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/express/pta_float.cxx b/panda/src/express/pta_float.cxx index 3d75ca4ac4..f1cfd87a64 100644 --- a/panda/src/express/pta_float.cxx +++ b/panda/src/express/pta_float.cxx @@ -13,11 +13,6 @@ #include "pta_float.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/express/pta_float.h b/panda/src/express/pta_float.h index b2f14953f9..fd84774654 100644 --- a/panda/src/express/pta_float.h +++ b/panda/src/express/pta_float.h @@ -34,9 +34,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, ConstPointerToArra typedef PointerToArray PTA_float; typedef ConstPointerToArray CPTA_float; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/express/pta_int.cxx b/panda/src/express/pta_int.cxx index 417838605c..6dab4d03c8 100644 --- a/panda/src/express/pta_int.cxx +++ b/panda/src/express/pta_int.cxx @@ -13,11 +13,6 @@ #include "pta_int.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/express/pta_int.h b/panda/src/express/pta_int.h index 16a2c504e3..93ed0bb900 100644 --- a/panda/src/express/pta_int.h +++ b/panda/src/express/pta_int.h @@ -34,9 +34,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, ConstPointerToArra typedef PointerToArray PTA_int; typedef ConstPointerToArray CPTA_int; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/express/pta_uchar.cxx b/panda/src/express/pta_uchar.cxx index 58b4b508c0..919eb2bc14 100644 --- a/panda/src/express/pta_uchar.cxx +++ b/panda/src/express/pta_uchar.cxx @@ -13,11 +13,6 @@ #include "pta_uchar.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/express/pta_uchar.h b/panda/src/express/pta_uchar.h index 5715480cd8..1552c6bcab 100644 --- a/panda/src/express/pta_uchar.h +++ b/panda/src/express/pta_uchar.h @@ -38,9 +38,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, ConstPointerToArra typedef PointerToArray PTA_uchar; typedef ConstPointerToArray CPTA_uchar; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/mathutil/linmath_events.cxx b/panda/src/mathutil/linmath_events.cxx index a116cc696a..8dba9c22a4 100644 --- a/panda/src/mathutil/linmath_events.cxx +++ b/panda/src/mathutil/linmath_events.cxx @@ -12,8 +12,3 @@ */ #include "linmath_events.h" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/mathutil/linmath_events.h b/panda/src/mathutil/linmath_events.h index d5d3cea907..aec3436316 100644 --- a/panda/src/mathutil/linmath_events.h +++ b/panda/src/mathutil/linmath_events.h @@ -27,9 +27,4 @@ typedef ParamVecBase2 EventStoreVec2; typedef ParamVecBase3 EventStoreVec3; typedef ParamMatrix4 EventStoreMat4; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/mathutil/pta_LMatrix3.cxx b/panda/src/mathutil/pta_LMatrix3.cxx index e6a273a9fb..fb761a54d7 100644 --- a/panda/src/mathutil/pta_LMatrix3.cxx +++ b/panda/src/mathutil/pta_LMatrix3.cxx @@ -13,11 +13,6 @@ #include "pta_LMatrix3.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/mathutil/pta_LMatrix3.h b/panda/src/mathutil/pta_LMatrix3.h index ccd88e156c..3b0de0672b 100644 --- a/panda/src/mathutil/pta_LMatrix3.h +++ b/panda/src/mathutil/pta_LMatrix3.h @@ -64,9 +64,4 @@ typedef PTA_LMatrix3d PTAMat3d; typedef CPTA_LMatrix3d CPTAMat3d; #endif // CPPPARSER -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/mathutil/pta_LMatrix4.cxx b/panda/src/mathutil/pta_LMatrix4.cxx index 02ba4d48da..11b70bef07 100644 --- a/panda/src/mathutil/pta_LMatrix4.cxx +++ b/panda/src/mathutil/pta_LMatrix4.cxx @@ -13,11 +13,6 @@ #include "pta_LMatrix4.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/mathutil/pta_LMatrix4.h b/panda/src/mathutil/pta_LMatrix4.h index ef5888b465..61ba1495ff 100644 --- a/panda/src/mathutil/pta_LMatrix4.h +++ b/panda/src/mathutil/pta_LMatrix4.h @@ -70,9 +70,4 @@ typedef PTA_LMatrix4d PTAMat4d; typedef CPTA_LMatrix4d CPTAMat4d; #endif // CPPPARSER -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/mathutil/pta_LVecBase2.cxx b/panda/src/mathutil/pta_LVecBase2.cxx index 6c232034df..0f631c452f 100644 --- a/panda/src/mathutil/pta_LVecBase2.cxx +++ b/panda/src/mathutil/pta_LVecBase2.cxx @@ -13,11 +13,6 @@ #include "pta_LVecBase2.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/mathutil/pta_LVecBase2.h b/panda/src/mathutil/pta_LVecBase2.h index b4296df5da..2d87312cd1 100644 --- a/panda/src/mathutil/pta_LVecBase2.h +++ b/panda/src/mathutil/pta_LVecBase2.h @@ -79,9 +79,4 @@ typedef PTA_LVecBase2d PTAVecBase2d; typedef CPTA_LVecBase2d CPTAVecBase2d; #endif // CPPPARSER -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/mathutil/pta_LVecBase3.cxx b/panda/src/mathutil/pta_LVecBase3.cxx index 7248c2638c..501fd86cf6 100644 --- a/panda/src/mathutil/pta_LVecBase3.cxx +++ b/panda/src/mathutil/pta_LVecBase3.cxx @@ -13,11 +13,6 @@ #include "pta_LVecBase3.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/mathutil/pta_LVecBase3.h b/panda/src/mathutil/pta_LVecBase3.h index f883e1acbb..73492e26d6 100644 --- a/panda/src/mathutil/pta_LVecBase3.h +++ b/panda/src/mathutil/pta_LVecBase3.h @@ -79,9 +79,4 @@ typedef PTA_LVecBase3d PTAVecBase3d; typedef CPTA_LVecBase3d CPTAVecBase3d; #endif // CPPPARSER -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/mathutil/pta_LVecBase4.cxx b/panda/src/mathutil/pta_LVecBase4.cxx index b06d7340a4..a638ebdd22 100644 --- a/panda/src/mathutil/pta_LVecBase4.cxx +++ b/panda/src/mathutil/pta_LVecBase4.cxx @@ -13,11 +13,6 @@ #include "pta_LVecBase4.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/mathutil/pta_LVecBase4.h b/panda/src/mathutil/pta_LVecBase4.h index 0d966002c0..e62351ca4a 100644 --- a/panda/src/mathutil/pta_LVecBase4.h +++ b/panda/src/mathutil/pta_LVecBase4.h @@ -88,9 +88,4 @@ typedef PTA_LVecBase4d PTAVecBase4d; typedef CPTA_LVecBase4d CPTAVecBase4d; #endif // CPPPARSER -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/putil/bitMask.cxx b/panda/src/putil/bitMask.cxx index 385d773695..8e51315eb2 100644 --- a/panda/src/putil/bitMask.cxx +++ b/panda/src/putil/bitMask.cxx @@ -13,11 +13,6 @@ #include "bitMask.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class BitMask; template class BitMask; template class BitMask; diff --git a/panda/src/putil/bitMask.h b/panda/src/putil/bitMask.h index ff9b15db97..5333562025 100644 --- a/panda/src/putil/bitMask.h +++ b/panda/src/putil/bitMask.h @@ -172,9 +172,4 @@ typedef BitMask64 BitMaskNative; #error No definition for NATIVE_WORDSIZE--should be defined in dtoolbase.h. #endif // NATIVE_WORDSIZE -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/putil/doubleBitMask.cxx b/panda/src/putil/doubleBitMask.cxx index 7d68b48dbe..c35d11613a 100644 --- a/panda/src/putil/doubleBitMask.cxx +++ b/panda/src/putil/doubleBitMask.cxx @@ -13,10 +13,5 @@ #include "doubleBitMask.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class DoubleBitMask; template class DoubleBitMask; diff --git a/panda/src/putil/doubleBitMask.h b/panda/src/putil/doubleBitMask.h index 3b3f521ec2..d229eb03a6 100644 --- a/panda/src/putil/doubleBitMask.h +++ b/panda/src/putil/doubleBitMask.h @@ -144,9 +144,4 @@ typedef DoubleBitMask DoubleBitMaskNative; EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, DoubleBitMask); typedef DoubleBitMask QuadBitMaskNative; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/putil/paramValue.cxx b/panda/src/putil/paramValue.cxx index e2ee6dadf1..6937a27faa 100644 --- a/panda/src/putil/paramValue.cxx +++ b/panda/src/putil/paramValue.cxx @@ -14,11 +14,6 @@ #include "paramValue.h" #include "dcast.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class ParamValue; template class ParamValue; diff --git a/panda/src/putil/paramValue.h b/panda/src/putil/paramValue.h index a75b4360b3..b17b2c9c37 100644 --- a/panda/src/putil/paramValue.h +++ b/panda/src/putil/paramValue.h @@ -209,9 +209,4 @@ typedef ParamMatrix3f ParamMatrix3; typedef ParamMatrix4f ParamMatrix4; #endif -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/putil/pta_ushort.cxx b/panda/src/putil/pta_ushort.cxx index 6323614b99..6163184397 100644 --- a/panda/src/putil/pta_ushort.cxx +++ b/panda/src/putil/pta_ushort.cxx @@ -13,11 +13,6 @@ #include "pta_ushort.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif - template class PointerToBase >; template class PointerToArrayBase; template class PointerToArray; diff --git a/panda/src/putil/pta_ushort.h b/panda/src/putil/pta_ushort.h index 51bf61927d..6424ddb237 100644 --- a/panda/src/putil/pta_ushort.h +++ b/panda/src/putil/pta_ushort.h @@ -34,9 +34,4 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, ConstPointerToArray< typedef PointerToArray PTA_ushort; typedef ConstPointerToArray CPTA_ushort; -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/putil/vector_typedWritable.cxx b/panda/src/putil/vector_typedWritable.cxx index 7c306f959f..8759e17d13 100644 --- a/panda/src/putil/vector_typedWritable.cxx +++ b/panda/src/putil/vector_typedWritable.cxx @@ -19,8 +19,3 @@ #define NAME vector_typedWritable #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/putil/vector_typedWritable.h b/panda/src/putil/vector_typedWritable.h index 61e87d19fa..9648c6ef58 100644 --- a/panda/src/putil/vector_typedWritable.h +++ b/panda/src/putil/vector_typedWritable.h @@ -34,9 +34,4 @@ class TypedWritable; #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/putil/vector_ulong.cxx b/panda/src/putil/vector_ulong.cxx index 58f63aed5c..930b461e31 100644 --- a/panda/src/putil/vector_ulong.cxx +++ b/panda/src/putil/vector_ulong.cxx @@ -19,8 +19,3 @@ #define NAME vector_ulong #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/putil/vector_ulong.h b/panda/src/putil/vector_ulong.h index 7f86a91d4d..c7a3ba2a6e 100644 --- a/panda/src/putil/vector_ulong.h +++ b/panda/src/putil/vector_ulong.h @@ -32,9 +32,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/putil/vector_ushort.cxx b/panda/src/putil/vector_ushort.cxx index 274aa9bed0..fd7252ad52 100644 --- a/panda/src/putil/vector_ushort.cxx +++ b/panda/src/putil/vector_ushort.cxx @@ -19,8 +19,3 @@ #define NAME vector_ushort #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/putil/vector_ushort.h b/panda/src/putil/vector_ushort.h index f336da3236..3ec5c7d07b 100644 --- a/panda/src/putil/vector_ushort.h +++ b/panda/src/putil/vector_ushort.h @@ -32,9 +32,4 @@ #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif diff --git a/panda/src/putil/vector_writable.cxx b/panda/src/putil/vector_writable.cxx index 3faefc0c2f..ce7fb138c3 100644 --- a/panda/src/putil/vector_writable.cxx +++ b/panda/src/putil/vector_writable.cxx @@ -18,8 +18,3 @@ #define NAME vector_writable #include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/putil/vector_writable.h b/panda/src/putil/vector_writable.h index 8d3fd4b46a..9825ed40ad 100644 --- a/panda/src/putil/vector_writable.h +++ b/panda/src/putil/vector_writable.h @@ -34,9 +34,4 @@ class Writable; #include "vector_src.h" -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - #endif From 09a9a8ff22b193b8e9fa2d6efb5f3ded6449ca28 Mon Sep 17 00:00:00 2001 From: deflected Date: Thu, 22 Mar 2018 12:35:09 +0200 Subject: [PATCH 09/55] multifile: Return vector_uchar from readSubfile - Return vector_uchar from readSubfile instead of string. This will correct problems with Python 3 unicode strings and will return bytes instead. Signed-off-by: deflected Closes #290 --- panda/src/express/multifile.I | 6 +++--- panda/src/express/multifile.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/panda/src/express/multifile.I b/panda/src/express/multifile.I index 5e20779f0d..a498534726 100644 --- a/panda/src/express/multifile.I +++ b/panda/src/express/multifile.I @@ -278,12 +278,12 @@ remove_subfile(const string &subfile_name) { } /** - * Returns a string that contains the entire contents of the indicated + * Returns a vector_uchar that contains the entire contents of the indicated * subfile. */ -INLINE string Multifile:: +INLINE vector_uchar Multifile:: read_subfile(int index) { - string result; + vector_uchar result; read_subfile(index, result); return result; } diff --git a/panda/src/express/multifile.h b/panda/src/express/multifile.h index f290c98602..d9f7217dfd 100644 --- a/panda/src/express/multifile.h +++ b/panda/src/express/multifile.h @@ -24,6 +24,7 @@ #include "indirectLess.h" #include "referenceCount.h" #include "pvector.h" +#include "vector_uchar.h" #ifdef HAVE_OPENSSL typedef struct x509_st X509; @@ -125,7 +126,7 @@ PUBLISHED: streampos get_subfile_internal_start(int index) const; size_t get_subfile_internal_length(int index) const; - BLOCKING INLINE string read_subfile(int index); + BLOCKING INLINE vector_uchar read_subfile(int index); BLOCKING istream *open_read_subfile(int index); BLOCKING static void close_read_subfile(istream *stream); BLOCKING bool extract_subfile(int index, const Filename &filename); From 5fec62b6fab0c9bebe3bb00edf2a0da7d7743f1e Mon Sep 17 00:00:00 2001 From: deflected Date: Thu, 22 Mar 2018 12:31:41 +0200 Subject: [PATCH 10/55] bullet: Corrected possible false check - When a bullet world is created it sets the filter algorithm callback that will use. Later changes to PRC config data should not lead to false assumptions that the bullet world is working with the new config. Signed-off-by: deflected Closes #289 --- panda/src/bullet/bulletWorld.cxx | 7 ++++--- panda/src/bullet/bulletWorld.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/panda/src/bullet/bulletWorld.cxx b/panda/src/bullet/bulletWorld.cxx index 18c23c8896..9bfa707e9d 100644 --- a/panda/src/bullet/bulletWorld.cxx +++ b/panda/src/bullet/bulletWorld.cxx @@ -82,7 +82,8 @@ BulletWorld() { _world->getPairCache()->setInternalGhostPairCallback(&_ghost_cb); // Filter callback - switch (bullet_filter_algorithm) { + _filter_algorithm = bullet_filter_algorithm; + switch (_filter_algorithm) { case FA_mask: _filter_cb = &_filter_cb1; break; @@ -1086,7 +1087,7 @@ void BulletWorld:: set_group_collision_flag(unsigned int group1, unsigned int group2, bool enable) { LightMutexHolder holder(get_global_lock()); - if (bullet_filter_algorithm != FA_groups_mask) { + if (_filter_algorithm != FA_groups_mask) { bullet_cat.warning() << "filter algorithm is not 'groups-mask'" << endl; } @@ -1198,7 +1199,7 @@ set_filter_callback(CallbackObject *obj) { nassertv(obj != NULL); - if (bullet_filter_algorithm != FA_callback) { + if (_filter_algorithm != FA_callback) { bullet_cat.warning() << "filter algorithm is not 'callback'" << endl; } diff --git a/panda/src/bullet/bulletWorld.h b/panda/src/bullet/bulletWorld.h index 36f3723535..35a2c8c634 100644 --- a/panda/src/bullet/bulletWorld.h +++ b/panda/src/bullet/bulletWorld.h @@ -265,6 +265,7 @@ private: btGhostPairCallback _ghost_cb; + FilterAlgorithm _filter_algorithm; btFilterCallback1 _filter_cb1; btFilterCallback2 _filter_cb2; btFilterCallback3 _filter_cb3; From 733085e38e3a93c06dcce937446962d6d8911e59 Mon Sep 17 00:00:00 2001 From: deflected Date: Sat, 17 Mar 2018 23:54:59 +0200 Subject: [PATCH 11/55] bullet: Write saved _up value for cylinder shapes - Missed in previous commit. Signed-off-by: deflected --- panda/src/bullet/bulletCylinderShape.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/bullet/bulletCylinderShape.cxx b/panda/src/bullet/bulletCylinderShape.cxx index 8f95bc5591..28ca5d65b4 100644 --- a/panda/src/bullet/bulletCylinderShape.cxx +++ b/panda/src/bullet/bulletCylinderShape.cxx @@ -151,7 +151,7 @@ write_datagram(BamWriter *manager, Datagram &dg) { // parameters to serialize: radius, height, up _half_extents.write_datagram(dg); - dg.add_int8((int8_t)_shape->getUpAxis()); + dg.add_int8((int8_t)_up); } /** From 3a88308f4598d32782117f9b0408d6235de67641 Mon Sep 17 00:00:00 2001 From: deflected Date: Sat, 17 Mar 2018 18:32:52 +0200 Subject: [PATCH 12/55] bullet: Cleanup copying of shapes - Fixed copy constructors - Dropped operator= from shapes Signed-off-by: deflected Closes #283 --- panda/src/bullet/bulletBoxShape.cxx | 14 ++----- panda/src/bullet/bulletBoxShape.h | 1 - panda/src/bullet/bulletCapsuleShape.I | 3 +- panda/src/bullet/bulletCapsuleShape.cxx | 42 +++++++++++-------- panda/src/bullet/bulletCapsuleShape.h | 2 +- panda/src/bullet/bulletConeShape.I | 3 +- panda/src/bullet/bulletConeShape.cxx | 39 ++++++++++------- panda/src/bullet/bulletConeShape.h | 2 +- panda/src/bullet/bulletConvexHullShape.cxx | 17 ++++---- panda/src/bullet/bulletConvexHullShape.h | 1 - .../bullet/bulletConvexPointCloudShape.cxx | 15 +++---- .../src/bullet/bulletConvexPointCloudShape.h | 1 - panda/src/bullet/bulletCylinderShape.I | 3 +- panda/src/bullet/bulletCylinderShape.cxx | 41 +++++++++++------- panda/src/bullet/bulletCylinderShape.h | 2 +- panda/src/bullet/bulletHeightfieldShape.cxx | 25 ++++------- panda/src/bullet/bulletHeightfieldShape.h | 1 - panda/src/bullet/bulletMinkowskiSumShape.cxx | 17 +++----- panda/src/bullet/bulletMinkowskiSumShape.h | 1 - panda/src/bullet/bulletPlaneShape.cxx | 14 ++----- panda/src/bullet/bulletPlaneShape.h | 1 - panda/src/bullet/bulletSphereShape.cxx | 13 +----- panda/src/bullet/bulletSphereShape.h | 1 - panda/src/bullet/bulletTriangleMeshShape.cxx | 28 ++++++------- panda/src/bullet/bulletTriangleMeshShape.h | 1 - 25 files changed, 130 insertions(+), 158 deletions(-) diff --git a/panda/src/bullet/bulletBoxShape.cxx b/panda/src/bullet/bulletBoxShape.cxx index 9ae2e16a11..1e18d77899 100644 --- a/panda/src/bullet/bulletBoxShape.cxx +++ b/panda/src/bullet/bulletBoxShape.cxx @@ -35,19 +35,11 @@ BulletBoxShape:: BulletBoxShape(const BulletBoxShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; _half_extents = copy._half_extents; -} + btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents); -/** - * - */ -void BulletBoxShape:: -operator = (const BulletBoxShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); - - _shape = copy._shape; - _half_extents = copy._half_extents; + _shape = new btBoxShape(btHalfExtents); + _shape->setUserPointer(this); } /** diff --git a/panda/src/bullet/bulletBoxShape.h b/panda/src/bullet/bulletBoxShape.h index bfb9207e61..5ac117ac76 100644 --- a/panda/src/bullet/bulletBoxShape.h +++ b/panda/src/bullet/bulletBoxShape.h @@ -34,7 +34,6 @@ private: PUBLISHED: explicit BulletBoxShape(const LVecBase3 &halfExtents); BulletBoxShape(const BulletBoxShape ©); - void operator = (const BulletBoxShape ©); INLINE ~BulletBoxShape(); LVecBase3 get_half_extents_without_margin() const; diff --git a/panda/src/bullet/bulletCapsuleShape.I b/panda/src/bullet/bulletCapsuleShape.I index 2491d55d0d..25caf7b9de 100644 --- a/panda/src/bullet/bulletCapsuleShape.I +++ b/panda/src/bullet/bulletCapsuleShape.I @@ -18,7 +18,8 @@ INLINE BulletCapsuleShape:: BulletCapsuleShape() : _shape(nullptr), _radius(0), - _height(0) { + _height(0), + _up(X_up) { } /** diff --git a/panda/src/bullet/bulletCapsuleShape.cxx b/panda/src/bullet/bulletCapsuleShape.cxx index 1c396bbdfb..44fbc3e501 100644 --- a/panda/src/bullet/bulletCapsuleShape.cxx +++ b/panda/src/bullet/bulletCapsuleShape.cxx @@ -21,7 +21,8 @@ TypeHandle BulletCapsuleShape::_type_handle; BulletCapsuleShape:: BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) : _radius(radius), - _height(height) { + _height(height), + _up(up) { switch (up) { case X_up: @@ -49,24 +50,29 @@ BulletCapsuleShape:: BulletCapsuleShape(const BulletCapsuleShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; _radius = copy._radius; _height = copy._height; + _up = copy._up; + + switch (_up) { + case X_up: + _shape = new btCapsuleShapeX(_radius, _height); + break; + case Y_up: + _shape = new btCapsuleShape(_radius, _height); + break; + case Z_up: + _shape = new btCapsuleShapeZ(_radius, _height); + break; + default: + bullet_cat.error() << "invalid up-axis:" << _up << endl; + break; + } + + nassertv(_shape); + _shape->setUserPointer(this); } -/** - * - */ -void BulletCapsuleShape:: -operator = (const BulletCapsuleShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); - - _shape = copy._shape; - _radius = copy._radius; - _height = copy._height; -} - - /** * */ @@ -131,9 +137,9 @@ fillin(DatagramIterator &scan, BamReader *manager) { // parameters to serialize: radius, height, up _radius = scan.get_stdfloat(); _height = scan.get_stdfloat(); - int up = (int) scan.get_int8(); + _up = (BulletUpAxis) scan.get_int8(); - switch (up) { + switch (_up) { case X_up: _shape = new btCapsuleShapeX(_radius, _height); break; @@ -144,7 +150,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { _shape = new btCapsuleShapeZ(_radius, _height); break; default: - bullet_cat.error() << "invalid up-axis:" << up << endl; + bullet_cat.error() << "invalid up-axis:" << _up << endl; break; } diff --git a/panda/src/bullet/bulletCapsuleShape.h b/panda/src/bullet/bulletCapsuleShape.h index e376674976..9994d9f1dc 100644 --- a/panda/src/bullet/bulletCapsuleShape.h +++ b/panda/src/bullet/bulletCapsuleShape.h @@ -31,7 +31,6 @@ private: PUBLISHED: explicit BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up); BulletCapsuleShape(const BulletCapsuleShape ©); - void operator = (const BulletCapsuleShape ©); INLINE ~BulletCapsuleShape(); INLINE PN_stdfloat get_radius() const; @@ -50,6 +49,7 @@ private: btCapsuleShape *_shape; PN_stdfloat _radius; PN_stdfloat _height; + BulletUpAxis _up; public: static void register_with_read_factory(); diff --git a/panda/src/bullet/bulletConeShape.I b/panda/src/bullet/bulletConeShape.I index b9c05664b7..debd0900c9 100644 --- a/panda/src/bullet/bulletConeShape.I +++ b/panda/src/bullet/bulletConeShape.I @@ -18,7 +18,8 @@ INLINE BulletConeShape:: BulletConeShape() : _shape(nullptr), _radius(0), - _height(0) { + _height(0), + _up(X_up) { } /** diff --git a/panda/src/bullet/bulletConeShape.cxx b/panda/src/bullet/bulletConeShape.cxx index 30b24a5a18..84c1fc4157 100644 --- a/panda/src/bullet/bulletConeShape.cxx +++ b/panda/src/bullet/bulletConeShape.cxx @@ -21,7 +21,8 @@ TypeHandle BulletConeShape::_type_handle; BulletConeShape:: BulletConeShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) : _radius(radius), - _height(height) { + _height(height), + _up(up) { switch (up) { case X_up: @@ -49,21 +50,27 @@ BulletConeShape:: BulletConeShape(const BulletConeShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; + _up = copy._up; _radius = copy._radius; _height = copy._height; -} -/** - * - */ -void BulletConeShape:: -operator = (const BulletConeShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); + switch (_up) { + case X_up: + _shape = new btConeShapeX((btScalar)_radius, (btScalar)_height); + break; + case Y_up: + _shape = new btConeShape((btScalar)_radius, (btScalar)_height); + break; + case Z_up: + _shape = new btConeShapeZ((btScalar)_radius, (btScalar)_height); + break; + default: + bullet_cat.error() << "invalid up-axis:" << _up << endl; + break; + } - _shape = copy._shape; - _radius = copy._radius; - _height = copy._height; + nassertv(_shape); + _shape->setUserPointer(this); } /** @@ -95,7 +102,7 @@ write_datagram(BamWriter *manager, Datagram &dg) { // parameters to serialize: radius, height, upIndex dg.add_stdfloat(_radius); dg.add_stdfloat(_height); - dg.add_int8((int8_t)_shape->getConeUpIndex()); + dg.add_int8((int8_t)_up); } /** @@ -130,9 +137,9 @@ fillin(DatagramIterator &scan, BamReader *manager) { // parameters to serialize: radius, height, up _radius = scan.get_stdfloat(); _height = scan.get_stdfloat(); + _up = (BulletUpAxis) scan.get_int8(); - int up_index = (int) scan.get_int8(); - switch (up_index) { + switch (_up) { case 0: _shape = new btConeShapeX((btScalar)_radius, (btScalar)_height); break; @@ -143,7 +150,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { _shape = new btConeShapeZ((btScalar)_radius, (btScalar)_height); break; default: - bullet_cat.error() << "invalid up-axis:" << up_index << endl; + bullet_cat.error() << "invalid up-axis:" << _up << endl; break; } diff --git a/panda/src/bullet/bulletConeShape.h b/panda/src/bullet/bulletConeShape.h index 4d40c61da9..89d085f834 100644 --- a/panda/src/bullet/bulletConeShape.h +++ b/panda/src/bullet/bulletConeShape.h @@ -31,7 +31,6 @@ private: PUBLISHED: explicit BulletConeShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up); BulletConeShape(const BulletConeShape ©); - void operator = (const BulletConeShape ©); INLINE ~BulletConeShape(); INLINE PN_stdfloat get_radius() const; @@ -47,6 +46,7 @@ private: btConeShape *_shape; PN_stdfloat _radius; PN_stdfloat _height; + BulletUpAxis _up; public: static void register_with_read_factory(); diff --git a/panda/src/bullet/bulletConvexHullShape.cxx b/panda/src/bullet/bulletConvexHullShape.cxx index c796072b4a..75a3182a34 100644 --- a/panda/src/bullet/bulletConvexHullShape.cxx +++ b/panda/src/bullet/bulletConvexHullShape.cxx @@ -36,17 +36,13 @@ BulletConvexHullShape:: BulletConvexHullShape(const BulletConvexHullShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; -} + _shape = new btConvexHullShape(NULL, 0); + _shape->setUserPointer(this); -/** - * - */ -void BulletConvexHullShape:: -operator = (const BulletConvexHullShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); + for(int i = 0; i < copy._shape->getNumPoints(); i++) + _shape->addPoint(copy._shape->getUnscaledPoints()[i], false); - _shape = copy._shape; + _shape->recalcLocalAabb(); } /** @@ -117,6 +113,9 @@ add_geom(const Geom *geom, const TransformState *ts) { points.push_back(m.xform_point(reader.get_data3())); } + if (_shape) + delete _shape; + // Create shape _shape = new btConvexHullShape(NULL, 0); _shape->setUserPointer(this); diff --git a/panda/src/bullet/bulletConvexHullShape.h b/panda/src/bullet/bulletConvexHullShape.h index 653c044952..78485ed12c 100644 --- a/panda/src/bullet/bulletConvexHullShape.h +++ b/panda/src/bullet/bulletConvexHullShape.h @@ -30,7 +30,6 @@ class EXPCL_PANDABULLET BulletConvexHullShape : public BulletShape { PUBLISHED: BulletConvexHullShape(); BulletConvexHullShape(const BulletConvexHullShape ©); - void operator = (const BulletConvexHullShape ©); INLINE ~BulletConvexHullShape(); void add_point(const LPoint3 &p); diff --git a/panda/src/bullet/bulletConvexPointCloudShape.cxx b/panda/src/bullet/bulletConvexPointCloudShape.cxx index fb7f62287b..1a4cb6e16c 100644 --- a/panda/src/bullet/bulletConvexPointCloudShape.cxx +++ b/panda/src/bullet/bulletConvexPointCloudShape.cxx @@ -92,18 +92,13 @@ BulletConvexPointCloudShape(const BulletConvexPointCloudShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); _scale = copy._scale; - _shape = copy._shape; -} -/** - * - */ -void BulletConvexPointCloudShape:: -operator = (const BulletConvexPointCloudShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); + btVector3 *btPoints = copy._shape->getUnscaledPoints(); + int numPoints = copy._shape->getNumPoints(); + btVector3 btScale = LVecBase3_to_btVector3(_scale); - _scale = copy._scale; - _shape = copy._shape; + _shape = new btConvexPointCloudShape(btPoints, numPoints, btScale); + _shape->setUserPointer(this); } /** diff --git a/panda/src/bullet/bulletConvexPointCloudShape.h b/panda/src/bullet/bulletConvexPointCloudShape.h index da403d8794..0bf1d7e427 100644 --- a/panda/src/bullet/bulletConvexPointCloudShape.h +++ b/panda/src/bullet/bulletConvexPointCloudShape.h @@ -34,7 +34,6 @@ PUBLISHED: explicit BulletConvexPointCloudShape(const PTA_LVecBase3 &points, LVecBase3 scale=LVecBase3(1.)); explicit BulletConvexPointCloudShape(const Geom *geom, LVecBase3 scale=LVecBase3(1.)); BulletConvexPointCloudShape(const BulletConvexPointCloudShape ©); - void operator = (const BulletConvexPointCloudShape ©); INLINE ~BulletConvexPointCloudShape(); int get_num_points() const; diff --git a/panda/src/bullet/bulletCylinderShape.I b/panda/src/bullet/bulletCylinderShape.I index 54616905f9..bf0ccb40a9 100644 --- a/panda/src/bullet/bulletCylinderShape.I +++ b/panda/src/bullet/bulletCylinderShape.I @@ -17,7 +17,8 @@ INLINE BulletCylinderShape:: BulletCylinderShape() : _half_extents(LVector3::zero()), - _shape(nullptr) { + _shape(nullptr), + _up(X_up) { } /** diff --git a/panda/src/bullet/bulletCylinderShape.cxx b/panda/src/bullet/bulletCylinderShape.cxx index 28ca5d65b4..6d107bff7a 100644 --- a/panda/src/bullet/bulletCylinderShape.cxx +++ b/panda/src/bullet/bulletCylinderShape.cxx @@ -20,7 +20,8 @@ TypeHandle BulletCylinderShape::_type_handle; */ BulletCylinderShape:: BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up) : - _half_extents(half_extents){ + _half_extents(half_extents), + _up(up) { btVector3 btHalfExtents = LVecBase3_to_btVector3(half_extents); @@ -47,7 +48,8 @@ BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up) : * */ BulletCylinderShape:: -BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) { +BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) : + _up(up) { switch (up) { case X_up: @@ -78,19 +80,28 @@ BulletCylinderShape:: BulletCylinderShape(const BulletCylinderShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; + _up = copy._up; _half_extents = copy._half_extents; -} -/** - * - */ -void BulletCylinderShape:: -operator = (const BulletCylinderShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); + btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents); - _shape = copy._shape; - _half_extents = copy._half_extents; + switch (_up) { + case X_up: + _shape = new btCylinderShapeX(btHalfExtents); + break; + case Y_up: + _shape = new btCylinderShape(btHalfExtents); + break; + case Z_up: + _shape = new btCylinderShapeZ(btHalfExtents); + break; + default: + bullet_cat.error() << "invalid up-axis:" << _up << endl; + break; + } + + nassertv(_shape); + _shape->setUserPointer(this); } /** @@ -185,11 +196,11 @@ fillin(DatagramIterator &scan, BamReader *manager) { // parameters to serialize: radius, height, up _half_extents.read_datagram(scan); - int up = (int) scan.get_int8(); + _up = (BulletUpAxis) scan.get_int8(); btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents); - switch (up) { + switch (_up) { case X_up: _shape = new btCylinderShapeX(btHalfExtents); break; @@ -200,7 +211,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { _shape = new btCylinderShapeZ(btHalfExtents); break; default: - bullet_cat.error() << "invalid up-axis:" << up << endl; + bullet_cat.error() << "invalid up-axis:" << _up << endl; break; } diff --git a/panda/src/bullet/bulletCylinderShape.h b/panda/src/bullet/bulletCylinderShape.h index f53962ec6f..901e48b4ff 100644 --- a/panda/src/bullet/bulletCylinderShape.h +++ b/panda/src/bullet/bulletCylinderShape.h @@ -32,7 +32,6 @@ PUBLISHED: explicit BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up); explicit BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up=Z_up); BulletCylinderShape(const BulletCylinderShape ©); - void operator = (const BulletCylinderShape ©); INLINE ~BulletCylinderShape(); PN_stdfloat get_radius() const; @@ -49,6 +48,7 @@ public: private: LVector3 _half_extents; btCylinderShape *_shape; + BulletUpAxis _up; public: static void register_with_read_factory(); diff --git a/panda/src/bullet/bulletHeightfieldShape.cxx b/panda/src/bullet/bulletHeightfieldShape.cxx index 1a01876401..6f5f0529e3 100644 --- a/panda/src/bullet/bulletHeightfieldShape.cxx +++ b/panda/src/bullet/bulletHeightfieldShape.cxx @@ -112,7 +112,6 @@ BulletHeightfieldShape:: BulletHeightfieldShape(const BulletHeightfieldShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; _num_rows = copy._num_rows; _num_cols = copy._num_cols; _max_height = copy._max_height; @@ -121,24 +120,14 @@ BulletHeightfieldShape(const BulletHeightfieldShape ©) { size_t size = (size_t)_num_rows * (size_t)_num_cols; _data = new btScalar[size]; memcpy(_data, copy._data, size * sizeof(btScalar)); -} -/** - * - */ -void BulletHeightfieldShape:: -operator = (const BulletHeightfieldShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); - - _shape = copy._shape; - _num_rows = copy._num_rows; - _num_cols = copy._num_cols; - _max_height = copy._max_height; - _up = copy._up; - - size_t size = (size_t)_num_rows * (size_t)_num_cols; - _data = new btScalar[size]; - memcpy(_data, copy._data, size * sizeof(btScalar)); + _shape = new btHeightfieldTerrainShape(_num_rows, + _num_cols, + _data, + _max_height, + _up, + true, false); + _shape->setUserPointer(this); } /** diff --git a/panda/src/bullet/bulletHeightfieldShape.h b/panda/src/bullet/bulletHeightfieldShape.h index 1bfc6c41c3..3631ca1a9d 100644 --- a/panda/src/bullet/bulletHeightfieldShape.h +++ b/panda/src/bullet/bulletHeightfieldShape.h @@ -35,7 +35,6 @@ PUBLISHED: explicit BulletHeightfieldShape(const PNMImage &image, PN_stdfloat max_height, BulletUpAxis up=Z_up); explicit BulletHeightfieldShape(Texture *tex, PN_stdfloat max_height, BulletUpAxis up=Z_up); BulletHeightfieldShape(const BulletHeightfieldShape ©); - void operator = (const BulletHeightfieldShape ©); INLINE ~BulletHeightfieldShape(); void set_use_diamond_subdivision(bool flag=true); diff --git a/panda/src/bullet/bulletMinkowskiSumShape.cxx b/panda/src/bullet/bulletMinkowskiSumShape.cxx index cc56d39884..d750e22244 100644 --- a/panda/src/bullet/bulletMinkowskiSumShape.cxx +++ b/panda/src/bullet/bulletMinkowskiSumShape.cxx @@ -40,21 +40,14 @@ BulletMinkowskiSumShape:: BulletMinkowskiSumShape(const BulletMinkowskiSumShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; _shape_a = copy._shape_a; _shape_b = copy._shape_b; -} + + const btConvexShape *ptr_a = (const btConvexShape *)_shape_a->ptr(); + const btConvexShape *ptr_b = (const btConvexShape *)_shape_b->ptr(); -/** - * - */ -void BulletMinkowskiSumShape:: -operator = (const BulletMinkowskiSumShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); - - _shape = copy._shape; - _shape_a = copy._shape_a; - _shape_b = copy._shape_b; + _shape = new btMinkowskiSumShape(ptr_a, ptr_b); + _shape->setUserPointer(this); } /** diff --git a/panda/src/bullet/bulletMinkowskiSumShape.h b/panda/src/bullet/bulletMinkowskiSumShape.h index c8629f2e33..f8f531ed99 100644 --- a/panda/src/bullet/bulletMinkowskiSumShape.h +++ b/panda/src/bullet/bulletMinkowskiSumShape.h @@ -33,7 +33,6 @@ private: PUBLISHED: explicit BulletMinkowskiSumShape(const BulletShape *shape_a, const BulletShape *shape_b); BulletMinkowskiSumShape(const BulletMinkowskiSumShape ©); - void operator = (const BulletMinkowskiSumShape ©); INLINE ~BulletMinkowskiSumShape(); void set_transform_a(const TransformState *ts); diff --git a/panda/src/bullet/bulletPlaneShape.cxx b/panda/src/bullet/bulletPlaneShape.cxx index a7804290cd..0d1a97fd4e 100644 --- a/panda/src/bullet/bulletPlaneShape.cxx +++ b/panda/src/bullet/bulletPlaneShape.cxx @@ -34,17 +34,11 @@ BulletPlaneShape:: BulletPlaneShape(const BulletPlaneShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; -} + btVector3 btNormal = copy._shape->getPlaneNormal(); + PN_stdfloat constant = (PN_stdfloat)_shape->getPlaneConstant(); -/** - * - */ -void BulletPlaneShape:: -operator = (const BulletPlaneShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); - - _shape = copy._shape; + _shape = new btStaticPlaneShape(btNormal, constant); + _shape->setUserPointer(this); } /** diff --git a/panda/src/bullet/bulletPlaneShape.h b/panda/src/bullet/bulletPlaneShape.h index 610c5d2412..dfee91f12c 100644 --- a/panda/src/bullet/bulletPlaneShape.h +++ b/panda/src/bullet/bulletPlaneShape.h @@ -34,7 +34,6 @@ private: PUBLISHED: explicit BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant); BulletPlaneShape(const BulletPlaneShape ©); - void operator = (const BulletPlaneShape ©); INLINE ~BulletPlaneShape(); LVector3 get_plane_normal() const; diff --git a/panda/src/bullet/bulletSphereShape.cxx b/panda/src/bullet/bulletSphereShape.cxx index 7b3fee62a4..b05e09e418 100644 --- a/panda/src/bullet/bulletSphereShape.cxx +++ b/panda/src/bullet/bulletSphereShape.cxx @@ -32,19 +32,10 @@ BulletSphereShape:: BulletSphereShape(const BulletSphereShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _shape = copy._shape; _radius = copy._radius; -} -/** - * - */ -void BulletSphereShape:: -operator = (const BulletSphereShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); - - _shape = copy._shape; - _radius = copy._radius; + _shape = new btSphereShape(_radius); + _shape->setUserPointer(this); } diff --git a/panda/src/bullet/bulletSphereShape.h b/panda/src/bullet/bulletSphereShape.h index b11d1c4a32..aad49a145c 100644 --- a/panda/src/bullet/bulletSphereShape.h +++ b/panda/src/bullet/bulletSphereShape.h @@ -33,7 +33,6 @@ private: PUBLISHED: explicit BulletSphereShape(PN_stdfloat radius); BulletSphereShape(const BulletSphereShape ©); - void operator = (const BulletSphereShape ©); INLINE ~BulletSphereShape(); INLINE PN_stdfloat get_radius() const; diff --git a/panda/src/bullet/bulletTriangleMeshShape.cxx b/panda/src/bullet/bulletTriangleMeshShape.cxx index 61905a406a..ced374a3fc 100644 --- a/panda/src/bullet/bulletTriangleMeshShape.cxx +++ b/panda/src/bullet/bulletTriangleMeshShape.cxx @@ -86,21 +86,21 @@ BulletTriangleMeshShape:: BulletTriangleMeshShape(const BulletTriangleMeshShape ©) { LightMutexHolder holder(BulletWorld::get_global_lock()); - _bvh_shape = copy._bvh_shape; - _gimpact_shape = copy._gimpact_shape; - _mesh = copy._mesh; -} - -/** - * - */ -void BulletTriangleMeshShape:: -operator = (const BulletTriangleMeshShape ©) { - LightMutexHolder holder(BulletWorld::get_global_lock()); - - _bvh_shape = copy._bvh_shape; - _gimpact_shape = copy._gimpact_shape; + _dynamic = copy._dynamic; + _compress = copy._compress; + _bvh = copy._bvh; _mesh = copy._mesh; + + if (_dynamic) { + _gimpact_shape = new btGImpactMeshShape(_mesh->ptr()); + _gimpact_shape->updateBound(); + _gimpact_shape->setUserPointer(this); + _bvh_shape = NULL; + } else { + _bvh_shape = new btBvhTriangleMeshShape(_mesh->ptr(), _compress, _bvh); + _bvh_shape->setUserPointer(this); + _gimpact_shape = NULL; + } } /** diff --git a/panda/src/bullet/bulletTriangleMeshShape.h b/panda/src/bullet/bulletTriangleMeshShape.h index 079fb2aeb1..199efb75d1 100644 --- a/panda/src/bullet/bulletTriangleMeshShape.h +++ b/panda/src/bullet/bulletTriangleMeshShape.h @@ -33,7 +33,6 @@ private: PUBLISHED: explicit BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress=true, bool bvh=true); BulletTriangleMeshShape(const BulletTriangleMeshShape ©); - void operator = (const BulletTriangleMeshShape ©); INLINE ~BulletTriangleMeshShape(); void refit_tree(const LPoint3 &aabb_min, const LPoint3 &aabb_max); From 69d24993b65d8efa914c075828446f0feda3b612 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 22 Mar 2018 15:30:31 +0100 Subject: [PATCH 13/55] bullet: fix compilation error with Bullet 2.81 --- panda/src/bullet/bulletConvexHullShape.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/panda/src/bullet/bulletConvexHullShape.cxx b/panda/src/bullet/bulletConvexHullShape.cxx index 75a3182a34..07d559c2fd 100644 --- a/panda/src/bullet/bulletConvexHullShape.cxx +++ b/panda/src/bullet/bulletConvexHullShape.cxx @@ -39,10 +39,16 @@ BulletConvexHullShape(const BulletConvexHullShape ©) { _shape = new btConvexHullShape(NULL, 0); _shape->setUserPointer(this); - for(int i = 0; i < copy._shape->getNumPoints(); i++) - _shape->addPoint(copy._shape->getUnscaledPoints()[i], false); - +#if BT_BULLET_VERSION >= 282 + for (int i = 0; i < copy._shape->getNumPoints(); ++i) { + _shape->addPoint(copy._shape->getUnscaledPoints()[i], false); + } _shape->recalcLocalAabb(); +#else + for (int i = 0; i < copy._shape->getNumPoints(); ++i) { + _shape->addPoint(copy._shape->getUnscaledPoints()[i]); + } +#endif } /** From 29318992d93811637758adefb3e95afdfea8820d Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Thu, 15 Mar 2018 22:41:58 -0600 Subject: [PATCH 14/55] metalibs/panda: EXPCL_PANDA -> EXPCL_LIBPANDA --- panda/metalibs/panda/panda.h | 2 +- panda/src/pandabase/pandasymbols.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/panda/metalibs/panda/panda.h b/panda/metalibs/panda/panda.h index 93811cf60b..9d1ef575c8 100644 --- a/panda/metalibs/panda/panda.h +++ b/panda/metalibs/panda/panda.h @@ -9,6 +9,6 @@ #include "pandabase.h" -EXPCL_PANDA void init_libpanda(); +EXPCL_LIBPANDA void init_libpanda(); #endif diff --git a/panda/src/pandabase/pandasymbols.h b/panda/src/pandabase/pandasymbols.h index b1dad6e422..51d9040392 100644 --- a/panda/src/pandabase/pandasymbols.h +++ b/panda/src/pandabase/pandasymbols.h @@ -247,6 +247,9 @@ #endif +#define EXPCL_LIBPANDA EXPCL_PANDA +#define EXPTP_LIBPANDA EXPTP_PANDA + #define EXPCL_PANDA_AUDIO EXPCL_PANDA #define EXPTP_PANDA_AUDIO EXPTP_PANDA From 9852ada792fa4d6d9c7ed0369d502b06c2db8f44 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 25 Feb 2018 18:19:02 -0700 Subject: [PATCH 15/55] dtoolbase: Change export macros to EXP*_DTOOL_DTOOLBASE This is for consistency with `panda`, which follows this format. --- dtool/src/dtoolbase/addHash.h | 2 +- dtool/src/dtoolbase/atomicAdjustDummyImpl.h | 2 +- dtool/src/dtoolbase/atomicAdjustGccImpl.h | 2 +- dtool/src/dtoolbase/atomicAdjustI386Impl.h | 2 +- dtool/src/dtoolbase/atomicAdjustPosixImpl.h | 2 +- dtool/src/dtoolbase/atomicAdjustWin32Impl.h | 2 +- dtool/src/dtoolbase/deletedBufferChain.h | 2 +- dtool/src/dtoolbase/dtoolbase_cc.h | 12 +++---- dtool/src/dtoolbase/dtoolsymbols.h | 5 +++ dtool/src/dtoolbase/indent.h | 2 +- dtool/src/dtoolbase/lookup3.h | 2 +- dtool/src/dtoolbase/memoryBase.h | 2 +- dtool/src/dtoolbase/memoryHook.h | 2 +- dtool/src/dtoolbase/mutexDummyImpl.h | 2 +- dtool/src/dtoolbase/mutexPosixImpl.h | 4 +-- dtool/src/dtoolbase/mutexSpinlockImpl.h | 2 +- dtool/src/dtoolbase/mutexWin32Impl.h | 2 +- dtool/src/dtoolbase/neverFreeMemory.h | 2 +- dtool/src/dtoolbase/pdtoa.h | 2 +- dtool/src/dtoolbase/pstrtod.h | 4 +-- dtool/src/dtoolbase/register_type.h | 38 ++++++++++----------- dtool/src/dtoolbase/typeHandle.h | 4 +-- dtool/src/dtoolbase/typeRegistry.h | 4 +-- dtool/src/dtoolbase/typeRegistryNode.h | 2 +- dtool/src/dtoolbase/typedObject.h | 2 +- 25 files changed, 56 insertions(+), 51 deletions(-) diff --git a/dtool/src/dtoolbase/addHash.h b/dtool/src/dtoolbase/addHash.h index 11fabf77ce..675f9c3f49 100644 --- a/dtool/src/dtoolbase/addHash.h +++ b/dtool/src/dtoolbase/addHash.h @@ -23,7 +23,7 @@ * of static functions, which are used to wrap calls to Bob Jenkins' public- * domain hash generation function (defined in lookup3.c). */ -class EXPCL_DTOOL AddHash { +class EXPCL_DTOOL_DTOOLBASE AddHash { public: INLINE static size_t add_hash(size_t start, const uint32_t *words, size_t num_words); static size_t add_hash(size_t start, const uint8_t *bytes, size_t num_bytes); diff --git a/dtool/src/dtoolbase/atomicAdjustDummyImpl.h b/dtool/src/dtoolbase/atomicAdjustDummyImpl.h index b6e530f395..120fbe195a 100644 --- a/dtool/src/dtoolbase/atomicAdjustDummyImpl.h +++ b/dtool/src/dtoolbase/atomicAdjustDummyImpl.h @@ -24,7 +24,7 @@ * require multiprogramming, and therefore don't require special atomic * operations. */ -class EXPCL_DTOOL AtomicAdjustDummyImpl { +class EXPCL_DTOOL_DTOOLBASE AtomicAdjustDummyImpl { public: typedef long Integer; typedef void *Pointer; diff --git a/dtool/src/dtoolbase/atomicAdjustGccImpl.h b/dtool/src/dtoolbase/atomicAdjustGccImpl.h index 1012a52721..7ae44037ff 100644 --- a/dtool/src/dtoolbase/atomicAdjustGccImpl.h +++ b/dtool/src/dtoolbase/atomicAdjustGccImpl.h @@ -22,7 +22,7 @@ /** * Uses GCC built-ins to implement atomic adjustments. */ -class EXPCL_DTOOL AtomicAdjustGccImpl { +class EXPCL_DTOOL_DTOOLBASE AtomicAdjustGccImpl { public: #if __GCC_ATOMIC_LONG_LOCK_FREE >= __GCC_ATOMIC_INT_LOCK_FREE // If the long can be more lock-free than int, use it instead. diff --git a/dtool/src/dtoolbase/atomicAdjustI386Impl.h b/dtool/src/dtoolbase/atomicAdjustI386Impl.h index 3084a7172b..eac5ce6a97 100644 --- a/dtool/src/dtoolbase/atomicAdjustI386Impl.h +++ b/dtool/src/dtoolbase/atomicAdjustI386Impl.h @@ -26,7 +26,7 @@ * Although this class is named i386, it actually uses instructions that are * specific to 486 and higher. */ -class EXPCL_DTOOL AtomicAdjustI386Impl { +class EXPCL_DTOOL_DTOOLBASE AtomicAdjustI386Impl { public: typedef ALIGN_4BYTE int32_t Integer; typedef void *UnalignedPointer; diff --git a/dtool/src/dtoolbase/atomicAdjustPosixImpl.h b/dtool/src/dtoolbase/atomicAdjustPosixImpl.h index ff5a55fb60..3b98499129 100644 --- a/dtool/src/dtoolbase/atomicAdjustPosixImpl.h +++ b/dtool/src/dtoolbase/atomicAdjustPosixImpl.h @@ -26,7 +26,7 @@ /** * Uses POSIX to implement atomic adjustments. */ -class EXPCL_DTOOL AtomicAdjustPosixImpl { +class EXPCL_DTOOL_DTOOLBASE AtomicAdjustPosixImpl { public: // In Posix, "long" is generally the native word size (32- or 64-bit), which // is what we'd prefer. diff --git a/dtool/src/dtoolbase/atomicAdjustWin32Impl.h b/dtool/src/dtoolbase/atomicAdjustWin32Impl.h index e249ce6448..6f64d2a781 100644 --- a/dtool/src/dtoolbase/atomicAdjustWin32Impl.h +++ b/dtool/src/dtoolbase/atomicAdjustWin32Impl.h @@ -29,7 +29,7 @@ /** * Uses Windows native calls to implement atomic adjustments. */ -class EXPCL_DTOOL AtomicAdjustWin32Impl { +class EXPCL_DTOOL_DTOOLBASE AtomicAdjustWin32Impl { public: #ifdef _WIN64 // For 64-bit builds, we'd prefer to use a 64-bit integer. diff --git a/dtool/src/dtoolbase/deletedBufferChain.h b/dtool/src/dtoolbase/deletedBufferChain.h index 8f82c1abbc..10ac5847fd 100644 --- a/dtool/src/dtoolbase/deletedBufferChain.h +++ b/dtool/src/dtoolbase/deletedBufferChain.h @@ -55,7 +55,7 @@ enum DeletedChainFlag { * * Use MemoryHook to get a new DeletedBufferChain of a particular size. */ -class EXPCL_DTOOL DeletedBufferChain { +class EXPCL_DTOOL_DTOOLBASE DeletedBufferChain { protected: DeletedBufferChain(size_t buffer_size); diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index dee66e04da..6777ce5611 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -282,8 +282,8 @@ class ReferenceCount; // We need a pointer to a global MemoryHook object, to manage all malloc and // free requests from Panda. See the comments in MemoryHook itself. class MemoryHook; -EXPCL_DTOOL extern MemoryHook *memory_hook; -EXPCL_DTOOL void init_memory_hook(); +EXPCL_DTOOL_DTOOLBASE extern MemoryHook *memory_hook; +EXPCL_DTOOL_DTOOLBASE void init_memory_hook(); // Now redefine some handy macros to hook into the above MemoryHook object. #ifndef USE_MEMORY_NOWRAPPERS @@ -303,8 +303,8 @@ EXPCL_DTOOL void init_memory_hook(); #if defined(HAVE_THREADS) && defined(SIMPLE_THREADS) // We need another forward-reference function to allow low-level code to // cooperatively yield the timeslice, in SIMPLE_THREADS mode. -extern EXPCL_DTOOL void (*global_thread_yield)(); -extern EXPCL_DTOOL void (*global_thread_consider_yield)(); +extern EXPCL_DTOOL_DTOOLBASE void (*global_thread_yield)(); +extern EXPCL_DTOOL_DTOOLBASE void (*global_thread_consider_yield)(); INLINE void thread_yield() { (*global_thread_yield)(); @@ -324,8 +324,8 @@ INLINE void thread_consider_yield() { #if defined(USE_TAU) && defined(WIN32) // Hack around tau's lack of DLL export declarations for Profiler class. -extern EXPCL_DTOOL bool __tau_shutdown; -class EXPCL_DTOOL TauProfile { +extern EXPCL_DTOOL_DTOOLBASE bool __tau_shutdown; +class EXPCL_DTOOL_DTOOLBASE TauProfile { public: TauProfile(void *&tautimer, char *name, char *type, int group, char *group_name) { Tau_profile_c_timer(&tautimer, name, type, group, group_name); diff --git a/dtool/src/dtoolbase/dtoolsymbols.h b/dtool/src/dtoolbase/dtoolsymbols.h index 892e1a9fff..61d49463f2 100644 --- a/dtool/src/dtoolbase/dtoolsymbols.h +++ b/dtool/src/dtoolbase/dtoolsymbols.h @@ -99,6 +99,11 @@ #define EXPTP_MISC IMPORT_TEMPL #endif /* BUILDING_MISC */ + +#define EXPCL_DTOOL_DTOOLBASE EXPCL_DTOOL +#define EXPTP_DTOOL_DTOOLBASE EXPTP_DTOOL + + /* These two are always defined empty, because pystub is statically built. But we leave the symbol around in case we change our minds to make pystub once again be a dynamic library. */ diff --git a/dtool/src/dtoolbase/indent.h b/dtool/src/dtoolbase/indent.h index e7b6cf3c48..93badf5e7d 100644 --- a/dtool/src/dtoolbase/indent.h +++ b/dtool/src/dtoolbase/indent.h @@ -22,7 +22,7 @@ * stream itself. Useful for indenting a series of lines of text by a given * amount. */ -EXPCL_DTOOL ostream & +EXPCL_DTOOL_DTOOLBASE ostream & indent(ostream &out, int indent_level); /** diff --git a/dtool/src/dtoolbase/lookup3.h b/dtool/src/dtoolbase/lookup3.h index d33fbe8305..4c59124ac5 100644 --- a/dtool/src/dtoolbase/lookup3.h +++ b/dtool/src/dtoolbase/lookup3.h @@ -21,7 +21,7 @@ extern "C" { #endif -EXPCL_DTOOL uint32_t hashword(const uint32_t *k, /* the key, an array of uint32_t values */ +EXPCL_DTOOL_DTOOLBASE uint32_t hashword(const uint32_t *k, /* the key, an array of uint32_t values */ size_t length, /* the length of the key, in uint32_ts */ uint32_t initval); diff --git a/dtool/src/dtoolbase/memoryBase.h b/dtool/src/dtoolbase/memoryBase.h index 6d755e695b..b6545ff66e 100644 --- a/dtool/src/dtoolbase/memoryBase.h +++ b/dtool/src/dtoolbase/memoryBase.h @@ -66,7 +66,7 @@ * that seems to cause problems when including header files for C++-based * system libraries (such as are found on OSX). */ -class EXPCL_DTOOL MemoryBase { +class EXPCL_DTOOL_DTOOLBASE MemoryBase { public: ALLOC_MEMORY_BASE; }; diff --git a/dtool/src/dtoolbase/memoryHook.h b/dtool/src/dtoolbase/memoryHook.h index 18ce70c0bb..9472983d75 100644 --- a/dtool/src/dtoolbase/memoryHook.h +++ b/dtool/src/dtoolbase/memoryHook.h @@ -34,7 +34,7 @@ class DeletedBufferChain; * employed for classes which inherit from MemoryBase; otherwise, use the * PANDA_MALLOC macros.) */ -class EXPCL_DTOOL MemoryHook { +class EXPCL_DTOOL_DTOOLBASE MemoryHook { public: MemoryHook(); MemoryHook(const MemoryHook ©); diff --git a/dtool/src/dtoolbase/mutexDummyImpl.h b/dtool/src/dtoolbase/mutexDummyImpl.h index d88eaed1aa..772f3f8201 100644 --- a/dtool/src/dtoolbase/mutexDummyImpl.h +++ b/dtool/src/dtoolbase/mutexDummyImpl.h @@ -21,7 +21,7 @@ * A fake mutex implementation for single-threaded applications that don't * need any synchronization control. This does nothing at all. */ -class EXPCL_DTOOL MutexDummyImpl { +class EXPCL_DTOOL_DTOOLBASE MutexDummyImpl { public: CONSTEXPR MutexDummyImpl() DEFAULT_CTOR; diff --git a/dtool/src/dtoolbase/mutexPosixImpl.h b/dtool/src/dtoolbase/mutexPosixImpl.h index 4d4fb3c11b..44b5ab193f 100644 --- a/dtool/src/dtoolbase/mutexPosixImpl.h +++ b/dtool/src/dtoolbase/mutexPosixImpl.h @@ -26,7 +26,7 @@ /** * Uses Posix threads to implement a mutex. */ -class EXPCL_DTOOL MutexPosixImpl { +class EXPCL_DTOOL_DTOOLBASE MutexPosixImpl { public: CONSTEXPR MutexPosixImpl() NOEXCEPT; INLINE ~MutexPosixImpl(); @@ -50,7 +50,7 @@ private: /** * Uses Posix threads to implement a reentrant mutex. */ -class EXPCL_DTOOL ReMutexPosixImpl { +class EXPCL_DTOOL_DTOOLBASE ReMutexPosixImpl { public: #ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP CONSTEXPR ReMutexPosixImpl() NOEXCEPT; diff --git a/dtool/src/dtoolbase/mutexSpinlockImpl.h b/dtool/src/dtoolbase/mutexSpinlockImpl.h index 06853a1af9..33514127f4 100644 --- a/dtool/src/dtoolbase/mutexSpinlockImpl.h +++ b/dtool/src/dtoolbase/mutexSpinlockImpl.h @@ -27,7 +27,7 @@ * specific application on a specific SMP machine, and you are confident that * you have at least as many CPU's as you have threads. */ -class EXPCL_DTOOL MutexSpinlockImpl { +class EXPCL_DTOOL_DTOOLBASE MutexSpinlockImpl { public: CONSTEXPR MutexSpinlockImpl(); diff --git a/dtool/src/dtoolbase/mutexWin32Impl.h b/dtool/src/dtoolbase/mutexWin32Impl.h index 31a4539e01..08fc6eab24 100644 --- a/dtool/src/dtoolbase/mutexWin32Impl.h +++ b/dtool/src/dtoolbase/mutexWin32Impl.h @@ -26,7 +26,7 @@ /** * Uses Windows native calls to implement a mutex. */ -class EXPCL_DTOOL MutexWin32Impl { +class EXPCL_DTOOL_DTOOLBASE MutexWin32Impl { public: MutexWin32Impl(); INLINE ~MutexWin32Impl(); diff --git a/dtool/src/dtoolbase/neverFreeMemory.h b/dtool/src/dtoolbase/neverFreeMemory.h index 49df06a153..d3f0cf51a1 100644 --- a/dtool/src/dtoolbase/neverFreeMemory.h +++ b/dtool/src/dtoolbase/neverFreeMemory.h @@ -29,7 +29,7 @@ * since this will help reduce fragmentation problems in the dynamic heap. * Also, memory allocated from here will exhibit less wasted space. */ -class EXPCL_DTOOL NeverFreeMemory { +class EXPCL_DTOOL_DTOOLBASE NeverFreeMemory { private: NeverFreeMemory(); diff --git a/dtool/src/dtoolbase/pdtoa.h b/dtool/src/dtoolbase/pdtoa.h index a3d3e46147..908ca24deb 100644 --- a/dtool/src/dtoolbase/pdtoa.h +++ b/dtool/src/dtoolbase/pdtoa.h @@ -15,7 +15,7 @@ extern "C" { #endif -EXPCL_DTOOL void pdtoa(double value, char *buffer); +EXPCL_DTOOL_DTOOLBASE void pdtoa(double value, char *buffer); #ifdef __cplusplus }; /* end of extern "C" */ diff --git a/dtool/src/dtoolbase/pstrtod.h b/dtool/src/dtoolbase/pstrtod.h index 7cd78f2f65..2e2d30599c 100644 --- a/dtool/src/dtoolbase/pstrtod.h +++ b/dtool/src/dtoolbase/pstrtod.h @@ -20,10 +20,10 @@ extern "C" { #endif -EXPCL_DTOOL double +EXPCL_DTOOL_DTOOLBASE double pstrtod(const char *nptr, char **endptr); -EXPCL_DTOOL double +EXPCL_DTOOL_DTOOLBASE double patof(const char *str); #ifdef __cplusplus diff --git a/dtool/src/dtoolbase/register_type.h b/dtool/src/dtoolbase/register_type.h index 7ea6031391..c6b27f2a94 100644 --- a/dtool/src/dtoolbase/register_type.h +++ b/dtool/src/dtoolbase/register_type.h @@ -76,18 +76,18 @@ register_dynamic_type(const string &name, // A few system-wide TypeHandles are defined for some basic types. -extern TypeHandle EXPCL_DTOOL long_type_handle; -extern TypeHandle EXPCL_DTOOL int_type_handle; -extern TypeHandle EXPCL_DTOOL uint_type_handle; -extern TypeHandle EXPCL_DTOOL short_type_handle; -extern TypeHandle EXPCL_DTOOL ushort_type_handle; -extern TypeHandle EXPCL_DTOOL char_type_handle; -extern TypeHandle EXPCL_DTOOL uchar_type_handle; -extern TypeHandle EXPCL_DTOOL bool_type_handle; -extern TypeHandle EXPCL_DTOOL double_type_handle; -extern TypeHandle EXPCL_DTOOL float_type_handle; -extern TypeHandle EXPCL_DTOOL string_type_handle; -extern TypeHandle EXPCL_DTOOL wstring_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE long_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE int_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE uint_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE short_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE ushort_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE char_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE uchar_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE bool_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE double_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE float_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE string_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE wstring_type_handle; extern TypeHandle long_p_type_handle; extern TypeHandle int_p_type_handle; @@ -98,14 +98,14 @@ extern TypeHandle double_p_type_handle; extern TypeHandle float_p_type_handle; extern TypeHandle void_p_type_handle; -extern TypeHandle EXPCL_DTOOL pvector_type_handle; -extern TypeHandle EXPCL_DTOOL ov_set_type_handle; -extern TypeHandle EXPCL_DTOOL pdeque_type_handle; -extern TypeHandle EXPCL_DTOOL plist_type_handle; -extern TypeHandle EXPCL_DTOOL pmap_type_handle; -extern TypeHandle EXPCL_DTOOL pset_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE pvector_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE ov_set_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE pdeque_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE plist_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE pmap_type_handle; +extern TypeHandle EXPCL_DTOOL_DTOOLBASE pset_type_handle; -void EXPCL_DTOOL init_system_type_handles(); +void EXPCL_DTOOL_DTOOLBASE init_system_type_handles(); // The following template function and its specializations will return a // TypeHandle for any type in the world, from a pointer to that type. diff --git a/dtool/src/dtoolbase/typeHandle.h b/dtool/src/dtoolbase/typeHandle.h index 58e69646f4..3138d51e4b 100644 --- a/dtool/src/dtoolbase/typeHandle.h +++ b/dtool/src/dtoolbase/typeHandle.h @@ -78,7 +78,7 @@ class TypedObject; * that ancestry of a particular type may be queried, and the type name may be * retrieved for run-time display. */ -class EXPCL_DTOOL TypeHandle FINAL { +class EXPCL_DTOOL_DTOOLBASE TypeHandle FINAL { PUBLISHED: TypeHandle() NOEXCEPT DEFAULT_CTOR; @@ -162,7 +162,7 @@ INLINE ostream &operator << (ostream &out, TypeHandle type) { return out; } -EXPCL_DTOOL ostream &operator << (ostream &out, TypeHandle::MemoryClass mem_class); +EXPCL_DTOOL_DTOOLBASE ostream &operator << (ostream &out, TypeHandle::MemoryClass mem_class); // We must include typeRegistry at this point so we can call it from our // inline functions. This is a circular include that is strategically placed diff --git a/dtool/src/dtoolbase/typeRegistry.h b/dtool/src/dtoolbase/typeRegistry.h index 651eb1904b..5c5c09ad4c 100644 --- a/dtool/src/dtoolbase/typeRegistry.h +++ b/dtool/src/dtoolbase/typeRegistry.h @@ -33,7 +33,7 @@ class TypedObject; * should be migrated to shared memory as soon as shared memory becomes * available. */ -class EXPCL_DTOOL TypeRegistry : public MemoryBase { +class EXPCL_DTOOL_DTOOLBASE TypeRegistry : public MemoryBase { public: // User code shouldn't generally need to call TypeRegistry::register_type() // or record_derivation() directly; instead, use the register_type @@ -118,7 +118,7 @@ private: }; // Helper function to allow for "C" interaction into the type system -extern "C" EXPCL_DTOOL int get_best_parent_from_Set(int id, const std::set &this_set); +extern "C" EXPCL_DTOOL_DTOOLBASE int get_best_parent_from_Set(int id, const std::set &this_set); #include "typeHandle.h" diff --git a/dtool/src/dtoolbase/typeRegistryNode.h b/dtool/src/dtoolbase/typeRegistryNode.h index 46e4b9f5a1..a8df5c339e 100644 --- a/dtool/src/dtoolbase/typeRegistryNode.h +++ b/dtool/src/dtoolbase/typeRegistryNode.h @@ -27,7 +27,7 @@ * directly access this class; this class is hidden within the TypeRegistry * accessors. */ -class EXPCL_DTOOL TypeRegistryNode { +class EXPCL_DTOOL_DTOOLBASE TypeRegistryNode { public: TypeRegistryNode(TypeHandle handle, const string &name, TypeHandle &ref); diff --git a/dtool/src/dtoolbase/typedObject.h b/dtool/src/dtoolbase/typedObject.h index cc963b0fac..f3d6c193e3 100644 --- a/dtool/src/dtoolbase/typedObject.h +++ b/dtool/src/dtoolbase/typedObject.h @@ -85,7 +85,7 @@ * } * @endcode */ -class EXPCL_DTOOL TypedObject : public MemoryBase { +class EXPCL_DTOOL_DTOOLBASE TypedObject : public MemoryBase { public: INLINE TypedObject() DEFAULT_CTOR; INLINE TypedObject(const TypedObject ©) DEFAULT_CTOR; From ad5b45811da22f4d90e0b232364db8e3b7083c12 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 26 Feb 2018 01:16:06 -0700 Subject: [PATCH 16/55] dtoolutil: Change export macros to EXP*_DTOOL_DTOOLUTIL This is for consistency with `panda`, which follows this format. --- dtool/src/dtoolbase/dtoolsymbols.h | 3 ++ dtool/src/dtoolutil/dSearchPath.h | 4 +-- dtool/src/dtoolutil/executionEnvironment.h | 2 +- dtool/src/dtoolutil/filename.h | 2 +- dtool/src/dtoolutil/globPattern.h | 2 +- dtool/src/dtoolutil/lineStream.h | 2 +- dtool/src/dtoolutil/lineStreamBuf.h | 2 +- dtool/src/dtoolutil/load_dso.h | 8 ++--- dtool/src/dtoolutil/pandaFileStream.h | 6 ++-- dtool/src/dtoolutil/pandaFileStreamBuf.h | 6 ++-- dtool/src/dtoolutil/pandaSystem.h | 2 +- dtool/src/dtoolutil/panda_getopt_impl.h | 10 +++--- dtool/src/dtoolutil/pfstream.h | 4 +-- dtool/src/dtoolutil/pfstreamBuf.h | 2 +- dtool/src/dtoolutil/preprocess_argv.h | 2 +- dtool/src/dtoolutil/stringDecoder.h | 2 +- dtool/src/dtoolutil/string_utils.h | 40 +++++++++++----------- dtool/src/dtoolutil/textEncoder.h | 8 ++--- dtool/src/dtoolutil/unicodeLatinMap.h | 2 +- dtool/src/dtoolutil/vector_double.cxx | 4 +-- dtool/src/dtoolutil/vector_double.h | 4 +-- dtool/src/dtoolutil/vector_float.cxx | 4 +-- dtool/src/dtoolutil/vector_float.h | 4 +-- dtool/src/dtoolutil/vector_int.cxx | 4 +-- dtool/src/dtoolutil/vector_int.h | 4 +-- dtool/src/dtoolutil/vector_string.cxx | 4 +-- dtool/src/dtoolutil/vector_string.h | 4 +-- dtool/src/dtoolutil/vector_uchar.cxx | 4 +-- dtool/src/dtoolutil/vector_uchar.h | 4 +-- dtool/src/dtoolutil/win32ArgParser.h | 2 +- makepanda/makepanda.py | 4 +-- 31 files changed, 79 insertions(+), 76 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolsymbols.h b/dtool/src/dtoolbase/dtoolsymbols.h index 61d49463f2..ff96a4aaf9 100644 --- a/dtool/src/dtoolbase/dtoolsymbols.h +++ b/dtool/src/dtoolbase/dtoolsymbols.h @@ -103,6 +103,9 @@ #define EXPCL_DTOOL_DTOOLBASE EXPCL_DTOOL #define EXPTP_DTOOL_DTOOLBASE EXPTP_DTOOL +#define EXPCL_DTOOL_DTOOLUTIL EXPCL_DTOOL +#define EXPTP_DTOOL_DTOOLUTIL EXPTP_DTOOL + /* These two are always defined empty, because pystub is statically built. But we leave the symbol around in case we change our minds diff --git a/dtool/src/dtoolutil/dSearchPath.h b/dtool/src/dtoolutil/dSearchPath.h index 67cbd61135..85184df77c 100644 --- a/dtool/src/dtoolutil/dSearchPath.h +++ b/dtool/src/dtoolutil/dSearchPath.h @@ -25,9 +25,9 @@ * traditional searchpath-style string, e.g. a list of directory names * delimited by spaces or colons, but it can also be built up explicitly. */ -class EXPCL_DTOOL DSearchPath { +class EXPCL_DTOOL_DTOOLUTIL DSearchPath { PUBLISHED: - class EXPCL_DTOOL Results { + class EXPCL_DTOOL_DTOOLUTIL Results { PUBLISHED: Results(); Results(const Results ©); diff --git a/dtool/src/dtoolutil/executionEnvironment.h b/dtool/src/dtoolutil/executionEnvironment.h index f954a1e44d..7415f19642 100644 --- a/dtool/src/dtoolutil/executionEnvironment.h +++ b/dtool/src/dtoolutil/executionEnvironment.h @@ -26,7 +26,7 @@ * at the time of execution. This is encapsulated to support accessing these * things during static init time, which seems to be risky at best. */ -class EXPCL_DTOOL ExecutionEnvironment { +class EXPCL_DTOOL_DTOOLUTIL ExecutionEnvironment { private: ExecutionEnvironment(); diff --git a/dtool/src/dtoolutil/filename.h b/dtool/src/dtoolutil/filename.h index e0c4b8c414..76ee5e0b39 100644 --- a/dtool/src/dtoolutil/filename.h +++ b/dtool/src/dtoolutil/filename.h @@ -36,7 +36,7 @@ class DSearchPath; * for file existence and searching a searchpath, as well as the best way to * open an fstream for reading or writing. */ -class EXPCL_DTOOL Filename { +class EXPCL_DTOOL_DTOOLUTIL Filename { PUBLISHED: enum Type { // These type values must fit within the bits allocated for F_type, below. diff --git a/dtool/src/dtoolutil/globPattern.h b/dtool/src/dtoolutil/globPattern.h index 379c3e7dfc..015bde38f9 100644 --- a/dtool/src/dtoolutil/globPattern.h +++ b/dtool/src/dtoolutil/globPattern.h @@ -29,7 +29,7 @@ * the pattern or not. It can be used, for example, to scan a directory for * all files matching a particular pattern. */ -class EXPCL_DTOOL GlobPattern { +class EXPCL_DTOOL_DTOOLUTIL GlobPattern { PUBLISHED: INLINE GlobPattern(const string &pattern = string()); INLINE GlobPattern(const GlobPattern ©); diff --git a/dtool/src/dtoolutil/lineStream.h b/dtool/src/dtoolutil/lineStream.h index 43142f81d1..7f9f5eff4a 100644 --- a/dtool/src/dtoolutil/lineStream.h +++ b/dtool/src/dtoolutil/lineStream.h @@ -28,7 +28,7 @@ * otherwise affected when a line of text is extracted. More text can still * be written to it and continuously extracted. */ -class EXPCL_DTOOL LineStream : public ostream { +class EXPCL_DTOOL_DTOOLUTIL LineStream : public ostream { PUBLISHED: INLINE LineStream(); diff --git a/dtool/src/dtoolutil/lineStreamBuf.h b/dtool/src/dtoolutil/lineStreamBuf.h index 5da4325384..7718371a03 100644 --- a/dtool/src/dtoolutil/lineStreamBuf.h +++ b/dtool/src/dtoolutil/lineStreamBuf.h @@ -23,7 +23,7 @@ * whose contents can be continuously extracted as a sequence of lines of * text. */ -class EXPCL_DTOOL LineStreamBuf : public streambuf { +class EXPCL_DTOOL_DTOOLUTIL LineStreamBuf : public streambuf { public: LineStreamBuf(); virtual ~LineStreamBuf(); diff --git a/dtool/src/dtoolutil/load_dso.h b/dtool/src/dtoolutil/load_dso.h index b4232f4ad2..2c0a5d9d24 100644 --- a/dtool/src/dtoolutil/load_dso.h +++ b/dtool/src/dtoolutil/load_dso.h @@ -22,20 +22,20 @@ // otherwise on success. If the filename is not absolute, searches the path. // If the path is empty, searches the dtool directory. -EXPCL_DTOOL void * +EXPCL_DTOOL_DTOOLUTIL void * load_dso(const DSearchPath &path, const Filename &filename); // true indicates success -EXPCL_DTOOL bool +EXPCL_DTOOL_DTOOLUTIL bool unload_dso(void *dso_handle); // Returns the error message from the last failed load_dso() call. -EXPCL_DTOOL string +EXPCL_DTOOL_DTOOLUTIL string load_dso_error(); // Returns a function pointer or other symbol from a loaded library. -EXPCL_DTOOL void * +EXPCL_DTOOL_DTOOLUTIL void * get_dso_symbol(void *handle, const string &name); #endif diff --git a/dtool/src/dtoolutil/pandaFileStream.h b/dtool/src/dtoolutil/pandaFileStream.h index f5c7e6f766..462e3ce160 100644 --- a/dtool/src/dtoolutil/pandaFileStream.h +++ b/dtool/src/dtoolutil/pandaFileStream.h @@ -26,7 +26,7 @@ * simple-threading implementation (using this interface will block only the * current thread, rather than the entire process, on I/O waits). */ -class EXPCL_DTOOL IFileStream : public istream { +class EXPCL_DTOOL_DTOOLUTIL IFileStream : public istream { PUBLISHED: INLINE IFileStream(); INLINE explicit IFileStream(const char *filename, ios::openmode mode = ios::in); @@ -54,7 +54,7 @@ private: * simple-threading implementation (using this interface will block only the * current thread, rather than the entire process, on I/O waits). */ -class EXPCL_DTOOL OFileStream : public ostream { +class EXPCL_DTOOL_DTOOLUTIL OFileStream : public ostream { PUBLISHED: INLINE OFileStream(); INLINE explicit OFileStream(const char *filename, ios::openmode mode = ios::out); @@ -83,7 +83,7 @@ private: * will block only the current thread, rather than the entire process, on I/O * waits). */ -class EXPCL_DTOOL FileStream : public iostream { +class EXPCL_DTOOL_DTOOLUTIL FileStream : public iostream { PUBLISHED: INLINE FileStream(); INLINE explicit FileStream(const char *filename, ios::openmode mode = ios::in); diff --git a/dtool/src/dtoolutil/pandaFileStreamBuf.h b/dtool/src/dtoolutil/pandaFileStreamBuf.h index cab9556919..9ab6f84082 100644 --- a/dtool/src/dtoolutil/pandaFileStreamBuf.h +++ b/dtool/src/dtoolutil/pandaFileStreamBuf.h @@ -28,7 +28,7 @@ /** * The streambuf object that implements pifstream and pofstream. */ -class EXPCL_DTOOL PandaFileStreamBuf : public streambuf { +class EXPCL_DTOOL_DTOOLUTIL PandaFileStreamBuf : public streambuf { public: PandaFileStreamBuf(); virtual ~PandaFileStreamBuf(); @@ -95,10 +95,10 @@ private: streampos _gpos; }; -EXPCL_DTOOL ostream & +EXPCL_DTOOL_DTOOLUTIL ostream & operator << (ostream &out, PandaFileStreamBuf::NewlineMode newline_mode); -EXPCL_DTOOL istream & +EXPCL_DTOOL_DTOOLUTIL istream & operator >> (istream &in, PandaFileStreamBuf::NewlineMode &newline_mode); #endif // USE_PANDAFILESTREAM diff --git a/dtool/src/dtoolutil/pandaSystem.h b/dtool/src/dtoolutil/pandaSystem.h index 85c1a0ea38..c5adae4898 100644 --- a/dtool/src/dtoolutil/pandaSystem.h +++ b/dtool/src/dtoolutil/pandaSystem.h @@ -23,7 +23,7 @@ * Panda. Application developers can use this class to query the runtime * version or capabilities of the current Panda environment. */ -class EXPCL_DTOOL PandaSystem { +class EXPCL_DTOOL_DTOOLUTIL PandaSystem { protected: PandaSystem(); ~PandaSystem(); diff --git a/dtool/src/dtoolutil/panda_getopt_impl.h b/dtool/src/dtoolutil/panda_getopt_impl.h index 9544f68187..c1691ae069 100644 --- a/dtool/src/dtoolutil/panda_getopt_impl.h +++ b/dtool/src/dtoolutil/panda_getopt_impl.h @@ -40,8 +40,8 @@ extern "C" { #endif -extern EXPCL_DTOOL char *optarg; -extern EXPCL_DTOOL int optind, opterr, optopt; +extern EXPCL_DTOOL_DTOOLUTIL char *optarg; +extern EXPCL_DTOOL_DTOOLUTIL int optind, opterr, optopt; struct option { const char *name; @@ -54,12 +54,12 @@ struct option { #define required_argument 1 #define optional_argument 2 -extern EXPCL_DTOOL int +extern EXPCL_DTOOL_DTOOLUTIL int getopt(int argc, char *const argv[], const char *optstring); -extern EXPCL_DTOOL int +extern EXPCL_DTOOL_DTOOLUTIL int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex); -extern EXPCL_DTOOL int +extern EXPCL_DTOOL_DTOOLUTIL int getopt_long_only(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex); diff --git a/dtool/src/dtoolutil/pfstream.h b/dtool/src/dtoolutil/pfstream.h index c26456bbe6..6beccc16ca 100644 --- a/dtool/src/dtoolutil/pfstream.h +++ b/dtool/src/dtoolutil/pfstream.h @@ -16,7 +16,7 @@ #include "pfstreamBuf.h" -class EXPCL_DTOOL IPipeStream : public istream { +class EXPCL_DTOOL_DTOOLUTIL IPipeStream : public istream { public: INLINE IPipeStream(const std::string); @@ -32,7 +32,7 @@ private: INLINE IPipeStream(); }; -class EXPCL_DTOOL OPipeStream : public ostream { +class EXPCL_DTOOL_DTOOLUTIL OPipeStream : public ostream { public: INLINE OPipeStream(const std::string); diff --git a/dtool/src/dtoolutil/pfstreamBuf.h b/dtool/src/dtoolutil/pfstreamBuf.h index 3fbf055eae..ad0c132f0f 100644 --- a/dtool/src/dtoolutil/pfstreamBuf.h +++ b/dtool/src/dtoolutil/pfstreamBuf.h @@ -41,7 +41,7 @@ #endif // WIN_PIPE_CALLS -class EXPCL_DTOOL PipeStreamBuf : public streambuf { +class EXPCL_DTOOL_DTOOLUTIL PipeStreamBuf : public streambuf { public: enum Direction { Input, Output }; diff --git a/dtool/src/dtoolutil/preprocess_argv.h b/dtool/src/dtoolutil/preprocess_argv.h index 6323c50c05..1c11a2c25f 100644 --- a/dtool/src/dtoolutil/preprocess_argv.h +++ b/dtool/src/dtoolutil/preprocess_argv.h @@ -16,7 +16,7 @@ #include "dtoolbase.h" -extern EXPCL_DTOOL void +extern EXPCL_DTOOL_DTOOLUTIL void preprocess_argv(int &argc, char **&argv); #endif diff --git a/dtool/src/dtoolutil/stringDecoder.h b/dtool/src/dtoolutil/stringDecoder.h index d611ed1751..62c97cbe9e 100644 --- a/dtool/src/dtoolutil/stringDecoder.h +++ b/dtool/src/dtoolutil/stringDecoder.h @@ -21,7 +21,7 @@ * byte streams. Give it a string, then ask it to pull the characters out one * at a time. This also serves as the plain old byte-at-a-time decoder. */ -class EXPCL_DTOOL StringDecoder { +class EXPCL_DTOOL_DTOOLUTIL StringDecoder { public: INLINE StringDecoder(const string &input); virtual ~StringDecoder(); diff --git a/dtool/src/dtoolutil/string_utils.h b/dtool/src/dtoolutil/string_utils.h index a3d931af6e..37f7679efe 100644 --- a/dtool/src/dtoolutil/string_utils.h +++ b/dtool/src/dtoolutil/string_utils.h @@ -22,44 +22,44 @@ // Case-insensitive string comparison, from Stroustrup's C++ third edition. // Works like strcmp(). -EXPCL_DTOOL int cmp_nocase(const string &s, const string &s2); +EXPCL_DTOOL_DTOOLUTIL int cmp_nocase(const string &s, const string &s2); // Similar, except it also accepts hyphen and underscore as equivalent. -EXPCL_DTOOL int cmp_nocase_uh(const string &s, const string &s2); +EXPCL_DTOOL_DTOOLUTIL int cmp_nocase_uh(const string &s, const string &s2); // Returns the string converted to lowercase. -EXPCL_DTOOL string downcase(const string &s); +EXPCL_DTOOL_DTOOLUTIL string downcase(const string &s); // Returns the string converted to uppercase. -EXPCL_DTOOL string upcase(const string &s); +EXPCL_DTOOL_DTOOLUTIL string upcase(const string &s); // Separates the string into words according to whitespace. -EXPCL_DTOOL int extract_words(const string &str, vector_string &words); -EXPCL_DTOOL int extract_words(const wstring &str, pvector &words); +EXPCL_DTOOL_DTOOLUTIL int extract_words(const string &str, vector_string &words); +EXPCL_DTOOL_DTOOLUTIL int extract_words(const wstring &str, pvector &words); // Separates the string into words according to the indicated delimiters. -EXPCL_DTOOL void tokenize(const string &str, vector_string &words, +EXPCL_DTOOL_DTOOLUTIL void tokenize(const string &str, vector_string &words, const string &delimiters, bool discard_repeated_delimiters = false); -EXPCL_DTOOL void tokenize(const wstring &str, pvector &words, +EXPCL_DTOOL_DTOOLUTIL void tokenize(const wstring &str, pvector &words, const wstring &delimiters, bool discard_repeated_delimiters = false); // Trims leading andor trailing whitespace from the string. -EXPCL_DTOOL string trim_left(const string &str); -EXPCL_DTOOL wstring trim_left(const wstring &str); -EXPCL_DTOOL string trim_right(const string &str); -EXPCL_DTOOL wstring trim_right(const wstring &str); -EXPCL_DTOOL string trim(const string &str); -EXPCL_DTOOL wstring trim(const wstring &str); +EXPCL_DTOOL_DTOOLUTIL string trim_left(const string &str); +EXPCL_DTOOL_DTOOLUTIL wstring trim_left(const wstring &str); +EXPCL_DTOOL_DTOOLUTIL string trim_right(const string &str); +EXPCL_DTOOL_DTOOLUTIL wstring trim_right(const wstring &str); +EXPCL_DTOOL_DTOOLUTIL string trim(const string &str); +EXPCL_DTOOL_DTOOLUTIL wstring trim(const wstring &str); // Functions to parse numeric values out of a string. -EXPCL_DTOOL int string_to_int(const string &str, string &tail); -EXPCL_DTOOL bool string_to_int(const string &str, int &result); -EXPCL_DTOOL double string_to_double(const string &str, string &tail); -EXPCL_DTOOL bool string_to_double(const string &str, double &result); -EXPCL_DTOOL bool string_to_float(const string &str, float &result); -EXPCL_DTOOL bool string_to_stdfloat(const string &str, PN_stdfloat &result); +EXPCL_DTOOL_DTOOLUTIL int string_to_int(const string &str, string &tail); +EXPCL_DTOOL_DTOOLUTIL bool string_to_int(const string &str, int &result); +EXPCL_DTOOL_DTOOLUTIL double string_to_double(const string &str, string &tail); +EXPCL_DTOOL_DTOOLUTIL bool string_to_double(const string &str, double &result); +EXPCL_DTOOL_DTOOLUTIL bool string_to_float(const string &str, float &result); +EXPCL_DTOOL_DTOOLUTIL bool string_to_stdfloat(const string &str, PN_stdfloat &result); // Convenience function to make a string from anything that has an ostream // operator. diff --git a/dtool/src/dtoolutil/textEncoder.h b/dtool/src/dtoolutil/textEncoder.h index ca885b15c3..3f57ed4c7f 100644 --- a/dtool/src/dtoolutil/textEncoder.h +++ b/dtool/src/dtoolutil/textEncoder.h @@ -30,7 +30,7 @@ class StringDecoder; * This class is also a base class of TextNode, which inherits this * functionality. */ -class EXPCL_DTOOL TextEncoder { +class EXPCL_DTOOL_DTOOLUTIL TextEncoder { PUBLISHED: enum Encoding { E_iso8859, @@ -112,9 +112,9 @@ private: static Encoding _default_encoding; }; -EXPCL_DTOOL ostream & +EXPCL_DTOOL_DTOOLUTIL ostream & operator << (ostream &out, TextEncoder::Encoding encoding); -EXPCL_DTOOL istream & +EXPCL_DTOOL_DTOOLUTIL istream & operator >> (istream &in, TextEncoder::Encoding &encoding); // We'll define the output operator for wstring here, too. Presumably this @@ -122,7 +122,7 @@ operator >> (istream &in, TextEncoder::Encoding &encoding); // This function is declared inline to minimize the risk of link conflicts // should another third-party module also define the same output operator. -INLINE EXPCL_DTOOL ostream & +INLINE EXPCL_DTOOL_DTOOLUTIL ostream & operator << (ostream &out, const wstring &str); #include "textEncoder.I" diff --git a/dtool/src/dtoolutil/unicodeLatinMap.h b/dtool/src/dtoolutil/unicodeLatinMap.h index dc74fcf8d9..fb94154f7f 100644 --- a/dtool/src/dtoolutil/unicodeLatinMap.h +++ b/dtool/src/dtoolutil/unicodeLatinMap.h @@ -25,7 +25,7 @@ * equivalent without the accent mark; as well as how to switch case from * upper to lower while retaining the Unicode accent marks. */ -class EXPCL_DTOOL UnicodeLatinMap { +class EXPCL_DTOOL_DTOOLUTIL UnicodeLatinMap { public: enum AccentType { AT_none, diff --git a/dtool/src/dtoolutil/vector_double.cxx b/dtool/src/dtoolutil/vector_double.cxx index e275c5ac8c..912de65cd0 100644 --- a/dtool/src/dtoolutil/vector_double.cxx +++ b/dtool/src/dtoolutil/vector_double.cxx @@ -13,8 +13,8 @@ #include "vector_double.h" -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE double #define NAME vector_double diff --git a/dtool/src/dtoolutil/vector_double.h b/dtool/src/dtoolutil/vector_double.h index 5e00afd598..bf06156557 100644 --- a/dtool/src/dtoolutil/vector_double.h +++ b/dtool/src/dtoolutil/vector_double.h @@ -23,8 +23,8 @@ * defining the vector again. */ -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE double #define NAME vector_double diff --git a/dtool/src/dtoolutil/vector_float.cxx b/dtool/src/dtoolutil/vector_float.cxx index 3d2d1233c5..7937306ae8 100644 --- a/dtool/src/dtoolutil/vector_float.cxx +++ b/dtool/src/dtoolutil/vector_float.cxx @@ -13,8 +13,8 @@ #include "vector_float.h" -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE float #define NAME vector_float diff --git a/dtool/src/dtoolutil/vector_float.h b/dtool/src/dtoolutil/vector_float.h index b9033a5ce7..afe596f9a9 100644 --- a/dtool/src/dtoolutil/vector_float.h +++ b/dtool/src/dtoolutil/vector_float.h @@ -23,8 +23,8 @@ * defining the vector again. */ -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE float #define NAME vector_float diff --git a/dtool/src/dtoolutil/vector_int.cxx b/dtool/src/dtoolutil/vector_int.cxx index 3032da29f4..44262c708c 100644 --- a/dtool/src/dtoolutil/vector_int.cxx +++ b/dtool/src/dtoolutil/vector_int.cxx @@ -13,8 +13,8 @@ #include "vector_int.h" -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE int #define NAME vector_int diff --git a/dtool/src/dtoolutil/vector_int.h b/dtool/src/dtoolutil/vector_int.h index b149c3ddd3..c2a899a079 100644 --- a/dtool/src/dtoolutil/vector_int.h +++ b/dtool/src/dtoolutil/vector_int.h @@ -23,8 +23,8 @@ * rather than defining the vector again. */ -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE int #define NAME vector_int diff --git a/dtool/src/dtoolutil/vector_string.cxx b/dtool/src/dtoolutil/vector_string.cxx index 72239b28ac..1dd5b82397 100644 --- a/dtool/src/dtoolutil/vector_string.cxx +++ b/dtool/src/dtoolutil/vector_string.cxx @@ -13,8 +13,8 @@ #include "vector_string.h" -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE std::string #define NAME vector_string diff --git a/dtool/src/dtoolutil/vector_string.h b/dtool/src/dtoolutil/vector_string.h index 117baf8543..8707b20890 100644 --- a/dtool/src/dtoolutil/vector_string.h +++ b/dtool/src/dtoolutil/vector_string.h @@ -23,8 +23,8 @@ * defining the vector again. */ -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE std::string #define NAME vector_string diff --git a/dtool/src/dtoolutil/vector_uchar.cxx b/dtool/src/dtoolutil/vector_uchar.cxx index e3473584d4..78750619bf 100644 --- a/dtool/src/dtoolutil/vector_uchar.cxx +++ b/dtool/src/dtoolutil/vector_uchar.cxx @@ -13,8 +13,8 @@ #include "vector_uchar.h" -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE unsigned char #define NAME vector_uchar diff --git a/dtool/src/dtoolutil/vector_uchar.h b/dtool/src/dtoolutil/vector_uchar.h index bf8d989990..3700b4ba8d 100644 --- a/dtool/src/dtoolutil/vector_uchar.h +++ b/dtool/src/dtoolutil/vector_uchar.h @@ -23,8 +23,8 @@ * rather than defining the vector again. */ -#define EXPCL EXPCL_DTOOL -#define EXPTP EXPTP_DTOOL +#define EXPCL EXPCL_DTOOL_DTOOLUTIL +#define EXPTP EXPTP_DTOOL_DTOOLUTIL #define TYPE unsigned char #define NAME vector_uchar diff --git a/dtool/src/dtoolutil/win32ArgParser.h b/dtool/src/dtoolutil/win32ArgParser.h index 505c6934cb..b7d427a81f 100644 --- a/dtool/src/dtoolutil/win32ArgParser.h +++ b/dtool/src/dtoolutil/win32ArgParser.h @@ -30,7 +30,7 @@ * but it is also supports automatic expansion of glob filenames, e.g. *.egg * is turned into an explicit list of egg files in the directory. */ -class EXPCL_DTOOL Win32ArgParser { +class EXPCL_DTOOL_DTOOLUTIL Win32ArgParser { public: Win32ArgParser(); ~Win32ArgParser(); diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 59633ea892..e7565907b2 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2596,12 +2596,12 @@ PANDAVERSION_H_RUNTIME=""" CHECKPANDAVERSION_CXX=""" # include "dtoolbase.h" -EXPCL_DTOOL int panda_version_$VERSION1_$VERSION2 = 0; +EXPCL_DTOOL_DTOOLUTIL int panda_version_$VERSION1_$VERSION2 = 0; """ CHECKPANDAVERSION_H=""" # include "dtoolbase.h" -extern EXPCL_DTOOL int panda_version_$VERSION1_$VERSION2; +extern EXPCL_DTOOL_DTOOLUTIL int panda_version_$VERSION1_$VERSION2; # ifndef WIN32 /* For Windows, exporting the symbol from the DLL is sufficient; the DLL will not load unless all expected public symbols are defined. From 775fcb5b0b55f0286eb2d8fe38a8a9de15698eea Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 4 Mar 2018 19:52:07 -0700 Subject: [PATCH 17/55] prc: Change export macros to EXP*_DTOOL_PRC This is for consistency with `panda`, which follows this format. --- dtool/src/dtoolbase/dtoolsymbols.h | 3 +++ dtool/src/prc/configDeclaration.h | 2 +- dtool/src/prc/configFlags.h | 2 +- dtool/src/prc/configPage.h | 2 +- dtool/src/prc/configPageManager.h | 2 +- dtool/src/prc/configVariable.h | 2 +- dtool/src/prc/configVariableBase.h | 2 +- dtool/src/prc/configVariableBool.h | 2 +- dtool/src/prc/configVariableCore.h | 2 +- dtool/src/prc/configVariableDouble.h | 2 +- dtool/src/prc/configVariableFilename.h | 2 +- dtool/src/prc/configVariableInt.h | 2 +- dtool/src/prc/configVariableInt64.h | 2 +- dtool/src/prc/configVariableList.h | 2 +- dtool/src/prc/configVariableManager.h | 2 +- dtool/src/prc/configVariableSearchPath.h | 2 +- dtool/src/prc/configVariableString.h | 2 +- dtool/src/prc/config_prc.h | 2 +- dtool/src/prc/encryptStream.h | 4 ++-- dtool/src/prc/encryptStreamBuf.h | 2 +- dtool/src/prc/nativeNumericData.h | 2 +- dtool/src/prc/notifyCategory.h | 2 +- dtool/src/prc/notifySeverity.h | 4 ++-- dtool/src/prc/pnotify.h | 2 +- dtool/src/prc/prcKeyRegistry.h | 2 +- dtool/src/prc/reversedNumericData.h | 2 +- dtool/src/prc/streamReader.h | 2 +- dtool/src/prc/streamWrapper.h | 8 ++++---- dtool/src/prc/streamWriter.h | 2 +- 29 files changed, 36 insertions(+), 33 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolsymbols.h b/dtool/src/dtoolbase/dtoolsymbols.h index ff96a4aaf9..98aab5a489 100644 --- a/dtool/src/dtoolbase/dtoolsymbols.h +++ b/dtool/src/dtoolbase/dtoolsymbols.h @@ -106,6 +106,9 @@ #define EXPCL_DTOOL_DTOOLUTIL EXPCL_DTOOL #define EXPTP_DTOOL_DTOOLUTIL EXPTP_DTOOL +#define EXPCL_DTOOL_PRC EXPCL_DTOOLCONFIG +#define EXPTP_DTOOL_PRC EXPTP_DTOOLCONFIG + /* These two are always defined empty, because pystub is statically built. But we leave the symbol around in case we change our minds diff --git a/dtool/src/prc/configDeclaration.h b/dtool/src/prc/configDeclaration.h index 696f4771d4..9a74acd8d2 100644 --- a/dtool/src/prc/configDeclaration.h +++ b/dtool/src/prc/configDeclaration.h @@ -30,7 +30,7 @@ class ConfigVariableCore; * pairing of a string name (actually, a ConfigVariableCore pointer) to a * string value. */ -class EXPCL_DTOOLCONFIG ConfigDeclaration : public ConfigFlags { +class EXPCL_DTOOL_PRC ConfigDeclaration : public ConfigFlags { private: ConfigDeclaration(ConfigPage *page, ConfigVariableCore *variable, const string &string_value, int decl_seq); diff --git a/dtool/src/prc/configFlags.h b/dtool/src/prc/configFlags.h index 7333c80393..23dfd3fb30 100644 --- a/dtool/src/prc/configFlags.h +++ b/dtool/src/prc/configFlags.h @@ -23,7 +23,7 @@ * It exists only to provide a convenient name scoping for some enumerated * values common to both classes. */ -class EXPCL_DTOOLCONFIG ConfigFlags { +class EXPCL_DTOOL_PRC ConfigFlags { PUBLISHED: enum ValueType { VT_undefined, diff --git a/dtool/src/prc/configPage.h b/dtool/src/prc/configPage.h index 8c143de836..72659fe096 100644 --- a/dtool/src/prc/configPage.h +++ b/dtool/src/prc/configPage.h @@ -27,7 +27,7 @@ class ConfigVariableCore; * it may also represent a list of declarations built up by application code * and explicitly loaded. */ -class EXPCL_DTOOLCONFIG ConfigPage { +class EXPCL_DTOOL_PRC ConfigPage { private: ConfigPage(const string &name, bool implicit_load, int page_seq); ~ConfigPage(); diff --git a/dtool/src/prc/configPageManager.h b/dtool/src/prc/configPageManager.h index ff81b3dc57..1ad8f6c3bd 100644 --- a/dtool/src/prc/configPageManager.h +++ b/dtool/src/prc/configPageManager.h @@ -28,7 +28,7 @@ class ConfigPage; * A global object that maintains the set of ConfigPages everywhere in the * world, and keeps them in sorted order. */ -class EXPCL_DTOOLCONFIG ConfigPageManager : public ConfigFlags { +class EXPCL_DTOOL_PRC ConfigPageManager : public ConfigFlags { protected: ConfigPageManager(); ~ConfigPageManager(); diff --git a/dtool/src/prc/configVariable.h b/dtool/src/prc/configVariable.h index 3e42efe4d0..c4f6d20527 100644 --- a/dtool/src/prc/configVariable.h +++ b/dtool/src/prc/configVariable.h @@ -28,7 +28,7 @@ * and/or ConfigDeclaration, more or less duplicating the interface presented * there. */ -class EXPCL_DTOOLCONFIG ConfigVariable : public ConfigVariableBase { +class EXPCL_DTOOL_PRC ConfigVariable : public ConfigVariableBase { protected: INLINE ConfigVariable(const string &name, ValueType type); INLINE ConfigVariable(const string &name, ValueType type, diff --git a/dtool/src/prc/configVariableBase.h b/dtool/src/prc/configVariableBase.h index cbb7aab183..8bc51a7431 100644 --- a/dtool/src/prc/configVariableBase.h +++ b/dtool/src/prc/configVariableBase.h @@ -42,7 +42,7 @@ * and/or ConfigDeclaration, more or less duplicating the interface presented * there. */ -class EXPCL_DTOOLCONFIG ConfigVariableBase : public ConfigFlags { +class EXPCL_DTOOL_PRC ConfigVariableBase : public ConfigFlags { protected: INLINE ConfigVariableBase(const string &name, ValueType type); ConfigVariableBase(const string &name, ValueType type, diff --git a/dtool/src/prc/configVariableBool.h b/dtool/src/prc/configVariableBool.h index 9f486c4266..c955b6b16f 100644 --- a/dtool/src/prc/configVariableBool.h +++ b/dtool/src/prc/configVariableBool.h @@ -20,7 +20,7 @@ /** * This is a convenience class to specialize ConfigVariable as a boolean type. */ -class EXPCL_DTOOLCONFIG ConfigVariableBool : public ConfigVariable { +class EXPCL_DTOOL_PRC ConfigVariableBool : public ConfigVariable { PUBLISHED: INLINE ConfigVariableBool(const string &name); INLINE ConfigVariableBool(const string &name, bool default_value, diff --git a/dtool/src/prc/configVariableCore.h b/dtool/src/prc/configVariableCore.h index e857dd3cc2..19e03436d2 100644 --- a/dtool/src/prc/configVariableCore.h +++ b/dtool/src/prc/configVariableCore.h @@ -31,7 +31,7 @@ class ConfigDeclaration; * make() method, which may return a shared instance. Once created, these * objects are never destructed. */ -class EXPCL_DTOOLCONFIG ConfigVariableCore : public ConfigFlags { +class EXPCL_DTOOL_PRC ConfigVariableCore : public ConfigFlags { private: ConfigVariableCore(const string &name); ConfigVariableCore(const ConfigVariableCore &templ, const string &name); diff --git a/dtool/src/prc/configVariableDouble.h b/dtool/src/prc/configVariableDouble.h index 817449ae2f..49e9585475 100644 --- a/dtool/src/prc/configVariableDouble.h +++ b/dtool/src/prc/configVariableDouble.h @@ -21,7 +21,7 @@ * This is a convenience class to specialize ConfigVariable as a floating- * point type. */ -class EXPCL_DTOOLCONFIG ConfigVariableDouble : public ConfigVariable { +class EXPCL_DTOOL_PRC ConfigVariableDouble : public ConfigVariable { PUBLISHED: INLINE ConfigVariableDouble(const string &name); INLINE ConfigVariableDouble(const string &name, double default_value, diff --git a/dtool/src/prc/configVariableFilename.h b/dtool/src/prc/configVariableFilename.h index e68c730128..6feb82a24a 100644 --- a/dtool/src/prc/configVariableFilename.h +++ b/dtool/src/prc/configVariableFilename.h @@ -24,7 +24,7 @@ * put OS-specific filenames, or filenames based on environment variables, in * the prc file. */ -class EXPCL_DTOOLCONFIG ConfigVariableFilename : public ConfigVariable { +class EXPCL_DTOOL_PRC ConfigVariableFilename : public ConfigVariable { PUBLISHED: INLINE ConfigVariableFilename(const string &name); INLINE ConfigVariableFilename(const string &name, const Filename &default_value, diff --git a/dtool/src/prc/configVariableInt.h b/dtool/src/prc/configVariableInt.h index 7605b27480..0156bed21a 100644 --- a/dtool/src/prc/configVariableInt.h +++ b/dtool/src/prc/configVariableInt.h @@ -21,7 +21,7 @@ * This is a convenience class to specialize ConfigVariable as an integer * type. */ -class EXPCL_DTOOLCONFIG ConfigVariableInt : public ConfigVariable { +class EXPCL_DTOOL_PRC ConfigVariableInt : public ConfigVariable { PUBLISHED: INLINE ConfigVariableInt(const string &name); INLINE ConfigVariableInt(const string &name, int default_value, diff --git a/dtool/src/prc/configVariableInt64.h b/dtool/src/prc/configVariableInt64.h index 40477f87cc..14d02e2ee9 100644 --- a/dtool/src/prc/configVariableInt64.h +++ b/dtool/src/prc/configVariableInt64.h @@ -22,7 +22,7 @@ * This is a convenience class to specialize ConfigVariable as a 64-bit * integer type. */ -class EXPCL_DTOOLCONFIG ConfigVariableInt64 : public ConfigVariable { +class EXPCL_DTOOL_PRC ConfigVariableInt64 : public ConfigVariable { PUBLISHED: INLINE ConfigVariableInt64(const string &name); INLINE ConfigVariableInt64(const string &name, int64_t default_value, diff --git a/dtool/src/prc/configVariableList.h b/dtool/src/prc/configVariableList.h index 448f8b5886..ca639a94ae 100644 --- a/dtool/src/prc/configVariableList.h +++ b/dtool/src/prc/configVariableList.h @@ -28,7 +28,7 @@ * * A ConfigVariableList cannot be modified locally. */ -class EXPCL_DTOOLCONFIG ConfigVariableList : public ConfigVariableBase { +class EXPCL_DTOOL_PRC ConfigVariableList : public ConfigVariableBase { PUBLISHED: INLINE ConfigVariableList(const string &name, const string &description = string(), diff --git a/dtool/src/prc/configVariableManager.h b/dtool/src/prc/configVariableManager.h index 78b943fef7..713e1bc5d2 100644 --- a/dtool/src/prc/configVariableManager.h +++ b/dtool/src/prc/configVariableManager.h @@ -28,7 +28,7 @@ class ConfigVariableCore; * ConfigVariableCores) everywhere in the world, and keeps them in sorted * order. */ -class EXPCL_DTOOLCONFIG ConfigVariableManager { +class EXPCL_DTOOL_PRC ConfigVariableManager { protected: ConfigVariableManager(); ~ConfigVariableManager(); diff --git a/dtool/src/prc/configVariableSearchPath.h b/dtool/src/prc/configVariableSearchPath.h index 6a6cfeb0ab..4dfe1b0fcf 100644 --- a/dtool/src/prc/configVariableSearchPath.h +++ b/dtool/src/prc/configVariableSearchPath.h @@ -33,7 +33,7 @@ * variable, created by using the same name to the constructor, will not * reflect the local changes. */ -class EXPCL_DTOOLCONFIG ConfigVariableSearchPath : public ConfigVariableBase { +class EXPCL_DTOOL_PRC ConfigVariableSearchPath : public ConfigVariableBase { PUBLISHED: INLINE ConfigVariableSearchPath(const string &name, const string &description = string(), diff --git a/dtool/src/prc/configVariableString.h b/dtool/src/prc/configVariableString.h index 1592e0b836..0b6d615667 100644 --- a/dtool/src/prc/configVariableString.h +++ b/dtool/src/prc/configVariableString.h @@ -20,7 +20,7 @@ /** * This is a convenience class to specialize ConfigVariable as a string type. */ -class EXPCL_DTOOLCONFIG ConfigVariableString : public ConfigVariable { +class EXPCL_DTOOL_PRC ConfigVariableString : public ConfigVariable { PUBLISHED: INLINE ConfigVariableString(const string &name); INLINE ConfigVariableString(const string &name, const string &default_value, diff --git a/dtool/src/prc/config_prc.h b/dtool/src/prc/config_prc.h index 5fbe9ec7d3..43e9b37648 100644 --- a/dtool/src/prc/config_prc.h +++ b/dtool/src/prc/config_prc.h @@ -19,7 +19,7 @@ class ConfigVariableBool; -NotifyCategoryDecl(prc, EXPCL_DTOOLCONFIG, EXPTP_DTOOLCONFIG); +NotifyCategoryDecl(prc, EXPCL_DTOOL_PRC, EXPTP_DTOOL_PRC); // This is aligned to match the shadowed definition in notify.cxx. extern ALIGN_16BYTE ConfigVariableBool assert_abort; diff --git a/dtool/src/prc/encryptStream.h b/dtool/src/prc/encryptStream.h index a5d4972ccd..540d4b3209 100644 --- a/dtool/src/prc/encryptStream.h +++ b/dtool/src/prc/encryptStream.h @@ -31,7 +31,7 @@ * * Seeking is not supported. */ -class EXPCL_DTOOLCONFIG IDecryptStream : public istream { +class EXPCL_DTOOL_PRC IDecryptStream : public istream { PUBLISHED: INLINE IDecryptStream(); INLINE explicit IDecryptStream(istream *source, bool owns_source, @@ -66,7 +66,7 @@ private: * * Seeking is not supported. */ -class EXPCL_DTOOLCONFIG OEncryptStream : public ostream { +class EXPCL_DTOOL_PRC OEncryptStream : public ostream { PUBLISHED: INLINE OEncryptStream(); INLINE explicit OEncryptStream(ostream *dest, bool owns_dest, diff --git a/dtool/src/prc/encryptStreamBuf.h b/dtool/src/prc/encryptStreamBuf.h index b7d95424c2..8a812f1701 100644 --- a/dtool/src/prc/encryptStreamBuf.h +++ b/dtool/src/prc/encryptStreamBuf.h @@ -24,7 +24,7 @@ typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; /** * The streambuf object that implements IDecompressStream and OCompressStream. */ -class EXPCL_DTOOLCONFIG EncryptStreamBuf : public streambuf { +class EXPCL_DTOOL_PRC EncryptStreamBuf : public streambuf { public: EncryptStreamBuf(); virtual ~EncryptStreamBuf(); diff --git a/dtool/src/prc/nativeNumericData.h b/dtool/src/prc/nativeNumericData.h index db1e9e5b06..04af522643 100644 --- a/dtool/src/prc/nativeNumericData.h +++ b/dtool/src/prc/nativeNumericData.h @@ -36,7 +36,7 @@ * typedeffed to be one of these or the other, according to the machine's * architecture. */ -class EXPCL_DTOOLCONFIG NativeNumericData { +class EXPCL_DTOOL_PRC NativeNumericData { public: INLINE NativeNumericData(const void *data, size_t length); INLINE NativeNumericData(const void *data, size_t start, size_t length); diff --git a/dtool/src/prc/notifyCategory.h b/dtool/src/prc/notifyCategory.h index 343591d122..61f4e71906 100644 --- a/dtool/src/prc/notifyCategory.h +++ b/dtool/src/prc/notifyCategory.h @@ -29,7 +29,7 @@ * a package level; further nested categories can be created within a package * if a finer grain of control is required. */ -class EXPCL_DTOOLCONFIG NotifyCategory : public MemoryBase, public ConfigFlags { +class EXPCL_DTOOL_PRC NotifyCategory : public MemoryBase, public ConfigFlags { private: NotifyCategory(const string &fullname, const string &basename, NotifyCategory *parent); diff --git a/dtool/src/prc/notifySeverity.h b/dtool/src/prc/notifySeverity.h index 8750602d73..d16cdb89d8 100644 --- a/dtool/src/prc/notifySeverity.h +++ b/dtool/src/prc/notifySeverity.h @@ -28,8 +28,8 @@ enum NotifySeverity { }; END_PUBLISH -EXPCL_DTOOLCONFIG ostream &operator << (ostream &out, NotifySeverity severity); -EXPCL_DTOOLCONFIG istream &operator >> (istream &in, NotifySeverity &severity); +EXPCL_DTOOL_PRC ostream &operator << (ostream &out, NotifySeverity severity); +EXPCL_DTOOL_PRC istream &operator >> (istream &in, NotifySeverity &severity); #endif diff --git a/dtool/src/prc/pnotify.h b/dtool/src/prc/pnotify.h index e51022c28a..27a346d0d9 100644 --- a/dtool/src/prc/pnotify.h +++ b/dtool/src/prc/pnotify.h @@ -30,7 +30,7 @@ class NotifyCategory; * independently enabled or disabled, so that error messages may be squelched * or respected according to the wishes of the user. */ -class EXPCL_DTOOLCONFIG Notify { +class EXPCL_DTOOL_PRC Notify { PUBLISHED: Notify(); ~Notify(); diff --git a/dtool/src/prc/prcKeyRegistry.h b/dtool/src/prc/prcKeyRegistry.h index 69e25d949e..0a21d182ad 100644 --- a/dtool/src/prc/prcKeyRegistry.h +++ b/dtool/src/prc/prcKeyRegistry.h @@ -33,7 +33,7 @@ typedef struct evp_pkey_st EVP_PKEY; * * This class requires the OpenSSL library. */ -class EXPCL_DTOOLCONFIG PrcKeyRegistry { +class EXPCL_DTOOL_PRC PrcKeyRegistry { protected: PrcKeyRegistry(); ~PrcKeyRegistry(); diff --git a/dtool/src/prc/reversedNumericData.h b/dtool/src/prc/reversedNumericData.h index d92ab82964..9979fbb3a2 100644 --- a/dtool/src/prc/reversedNumericData.h +++ b/dtool/src/prc/reversedNumericData.h @@ -39,7 +39,7 @@ static const int max_numeric_size = 8; * typedeffed to be one of these or the other, according to the machine's * architecture. */ -class EXPCL_DTOOLCONFIG ReversedNumericData { +class EXPCL_DTOOL_PRC ReversedNumericData { public: INLINE ReversedNumericData(const void *data, size_t length); INLINE ReversedNumericData(const void *data, size_t start, size_t length); diff --git a/dtool/src/prc/streamReader.h b/dtool/src/prc/streamReader.h index 3d8865e21d..bedaa0eeb5 100644 --- a/dtool/src/prc/streamReader.h +++ b/dtool/src/prc/streamReader.h @@ -24,7 +24,7 @@ * A class to read sequential binary data directly from an istream. Its * interface is similar to DatagramIterator by design; see also StreamWriter. */ -class EXPCL_DTOOLCONFIG StreamReader { +class EXPCL_DTOOL_PRC StreamReader { public: INLINE StreamReader(istream &in); PUBLISHED: diff --git a/dtool/src/prc/streamWrapper.h b/dtool/src/prc/streamWrapper.h index 856cf6f855..f3e4028c1b 100644 --- a/dtool/src/prc/streamWrapper.h +++ b/dtool/src/prc/streamWrapper.h @@ -21,7 +21,7 @@ * The base class for both IStreamWrapper and OStreamWrapper, this provides * the common locking interface. */ -class EXPCL_DTOOLCONFIG StreamWrapperBase { +class EXPCL_DTOOL_PRC StreamWrapperBase { protected: INLINE StreamWrapperBase(); @@ -48,7 +48,7 @@ private: * A thread may use this class to perform an atomic seek/read/gcount * operation. */ -class EXPCL_DTOOLCONFIG IStreamWrapper : virtual public StreamWrapperBase { +class EXPCL_DTOOL_PRC IStreamWrapper : virtual public StreamWrapperBase { public: INLINE IStreamWrapper(istream *stream, bool owns_pointer); PUBLISHED: @@ -75,7 +75,7 @@ private: * This class provides a locking wrapper around an arbitrary ostream pointer. * A thread may use this class to perform an atomic seek/write operation. */ -class EXPCL_DTOOLCONFIG OStreamWrapper : virtual public StreamWrapperBase { +class EXPCL_DTOOL_PRC OStreamWrapper : virtual public StreamWrapperBase { public: INLINE OStreamWrapper(ostream *stream, bool owns_pointer, bool stringstream_hack = false); PUBLISHED: @@ -111,7 +111,7 @@ private: * This class provides a locking wrapper around a combination ostream/istream * pointer. */ -class EXPCL_DTOOLCONFIG StreamWrapper : public IStreamWrapper, public OStreamWrapper { +class EXPCL_DTOOL_PRC StreamWrapper : public IStreamWrapper, public OStreamWrapper { public: INLINE StreamWrapper(iostream *stream, bool owns_pointer, bool stringstream_hack = false); PUBLISHED: diff --git a/dtool/src/prc/streamWriter.h b/dtool/src/prc/streamWriter.h index 8e2cf4dc1b..b39db968c0 100644 --- a/dtool/src/prc/streamWriter.h +++ b/dtool/src/prc/streamWriter.h @@ -26,7 +26,7 @@ * primarily intended as a convenience to eliminate the overhead of writing * bytes to a Datagram and then writing the Datagram to a stream. */ -class EXPCL_DTOOLCONFIG StreamWriter { +class EXPCL_DTOOL_PRC StreamWriter { public: INLINE StreamWriter(ostream &out); PUBLISHED: From 97399235931573a59c2f4e2eb067a6351a79f9ca Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 4 Mar 2018 19:52:37 -0700 Subject: [PATCH 18/55] dconfig: Change export macros to EXP*_DTOOL_DCONFIG This is for consistency with `panda`, which follows this format. --- dtool/src/dconfig/config_dconfig.h | 4 ++-- dtool/src/dconfig/dconfig.h | 2 +- dtool/src/dtoolbase/dtoolsymbols.h | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dtool/src/dconfig/config_dconfig.h b/dtool/src/dconfig/config_dconfig.h index 9988086d45..e01fdcf441 100644 --- a/dtool/src/dconfig/config_dconfig.h +++ b/dtool/src/dconfig/config_dconfig.h @@ -23,7 +23,7 @@ #include "dtoolbase.h" #include "notifyCategoryProxy.h" -NotifyCategoryDecl(dconfig, EXPCL_DTOOLCONFIG, EXPTP_DTOOLCONFIG); -NotifyCategoryDecl(microconfig, EXPCL_DTOOLCONFIG, EXPTP_DTOOLCONFIG); +NotifyCategoryDecl(dconfig, EXPCL_DTOOL_DCONFIG, EXPTP_DTOOL_DCONFIG); +NotifyCategoryDecl(microconfig, EXPCL_DTOOL_DCONFIG, EXPTP_DTOOL_DCONFIG); #endif diff --git a/dtool/src/dconfig/dconfig.h b/dtool/src/dconfig/dconfig.h index cf6e7396fd..ede79f596f 100644 --- a/dtool/src/dconfig/dconfig.h +++ b/dtool/src/dconfig/dconfig.h @@ -30,7 +30,7 @@ * used primarily by Python code. For modern code, use the new * ConfigVariable* interface instead of this deprecated interface. */ -class EXPCL_DTOOLCONFIG DConfig { +class EXPCL_DTOOL_DCONFIG DConfig { PUBLISHED: static INLINE bool GetBool(const string &sym, bool def = false); static INLINE int GetInt(const string &sym, int def = 0); diff --git a/dtool/src/dtoolbase/dtoolsymbols.h b/dtool/src/dtoolbase/dtoolsymbols.h index 98aab5a489..a09ec2fb23 100644 --- a/dtool/src/dtoolbase/dtoolsymbols.h +++ b/dtool/src/dtoolbase/dtoolsymbols.h @@ -109,6 +109,9 @@ #define EXPCL_DTOOL_PRC EXPCL_DTOOLCONFIG #define EXPTP_DTOOL_PRC EXPTP_DTOOLCONFIG +#define EXPCL_DTOOL_DCONFIG EXPCL_DTOOLCONFIG +#define EXPTP_DTOOL_DCONFIG EXPTP_DTOOLCONFIG + /* These two are always defined empty, because pystub is statically built. But we leave the symbol around in case we change our minds From 98797d009095de37de90b08238e096a497379bfd Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Thu, 15 Mar 2018 12:48:19 -0600 Subject: [PATCH 19/55] pandabase: Introduce BUILDING_ defines for each component This reverses the relationship between EXPCL_PANDA_COMPONENT and BUILDING_PANDA, where BUILDING_PANDA is just shorthand for BUILDING_PANDA_COMPONENT and BUILDING_PANDA_COMPONENT itself sets the EXPCL_PANDA_COMPONENT defines. Also removes EXPCL_PANDA. --- panda/src/pandabase/pandasymbols.h | 389 +++++++++++++++++++++-------- 1 file changed, 288 insertions(+), 101 deletions(-) diff --git a/panda/src/pandabase/pandasymbols.h b/panda/src/pandabase/pandasymbols.h index 51d9040392..beca549740 100644 --- a/panda/src/pandabase/pandasymbols.h +++ b/panda/src/pandabase/pandasymbols.h @@ -69,12 +69,296 @@ #define EXPTP_OPENAL_AUDIO IMPORT_TEMPL #endif +/* BUILDING_PANDA is just a buildsystem shortcut for all of these: */ #ifdef BUILDING_PANDA - #define EXPCL_PANDA EXPORT_CLASS - #define EXPTP_PANDA EXPORT_TEMPL + #define BUILDING_LIBPANDA + #define BUILDING_PANDA_AUDIO + #define BUILDING_PANDA_CHAN + #define BUILDING_PANDA_CHAR + #define BUILDING_PANDA_COLLIDE + #define BUILDING_PANDA_CULL + #define BUILDING_PANDA_DEVICE + #define BUILDING_PANDA_DGRAPH + #define BUILDING_PANDA_DISPLAY + #define BUILDING_PANDA_DXML + #define BUILDING_PANDA_EVENT + #define BUILDING_PANDA_GOBJ + #define BUILDING_PANDA_GRUTIL + #define BUILDING_PANDA_GSGBASE + #define BUILDING_PANDA_LINMATH + #define BUILDING_PANDA_MATHUTIL + #define BUILDING_PANDA_MOVIES + #define BUILDING_PANDA_NATIVENET + #define BUILDING_PANDA_NET + #define BUILDING_PANDA_PARAMETRICS + #define BUILDING_PANDA_PGRAPH + #define BUILDING_PANDA_PGRAPHNODES + #define BUILDING_PANDA_PGUI + #define BUILDING_PANDA_PIPELINE + #define BUILDING_PANDA_PNMIMAGE + #define BUILDING_PANDA_PNMIMAGETYPES + #define BUILDING_PANDA_PNMTEXT + #define BUILDING_PANDA_PSTATCLIENT + #define BUILDING_PANDA_PUTIL + #define BUILDING_PANDA_RECORDER + #define BUILDING_PANDA_TEXT + #define BUILDING_PANDA_TFORM +#endif + +#ifdef BUILDING_LIBPANDA + #define EXPCL_LIBPANDA EXPORT_CLASS + #define EXPTP_LIBPANDA EXPORT_TEMPL #else - #define EXPCL_PANDA IMPORT_CLASS - #define EXPTP_PANDA IMPORT_TEMPL + #define EXPCL_LIBPANDA IMPORT_CLASS + #define EXPTP_LIBPANDA IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_AUDIO + #define EXPCL_PANDA_AUDIO EXPORT_CLASS + #define EXPTP_PANDA_AUDIO EXPORT_TEMPL +#else + #define EXPCL_PANDA_AUDIO IMPORT_CLASS + #define EXPTP_PANDA_AUDIO IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_CHAN + #define EXPCL_PANDA_CHAN EXPORT_CLASS + #define EXPTP_PANDA_CHAN EXPORT_TEMPL +#else + #define EXPCL_PANDA_CHAN IMPORT_CLASS + #define EXPTP_PANDA_CHAN IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_CHAR + #define EXPCL_PANDA_CHAR EXPORT_CLASS + #define EXPTP_PANDA_CHAR EXPORT_TEMPL +#else + #define EXPCL_PANDA_CHAR IMPORT_CLASS + #define EXPTP_PANDA_CHAR IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_COLLIDE + #define EXPCL_PANDA_COLLIDE EXPORT_CLASS + #define EXPTP_PANDA_COLLIDE EXPORT_TEMPL +#else + #define EXPCL_PANDA_COLLIDE IMPORT_CLASS + #define EXPTP_PANDA_COLLIDE IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_CULL + #define EXPCL_PANDA_CULL EXPORT_CLASS + #define EXPTP_PANDA_CULL EXPORT_TEMPL +#else + #define EXPCL_PANDA_CULL IMPORT_CLASS + #define EXPTP_PANDA_CULL IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_DEVICE + #define EXPCL_PANDA_DEVICE EXPORT_CLASS + #define EXPTP_PANDA_DEVICE EXPORT_TEMPL +#else + #define EXPCL_PANDA_DEVICE IMPORT_CLASS + #define EXPTP_PANDA_DEVICE IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_DGRAPH + #define EXPCL_PANDA_DGRAPH EXPORT_CLASS + #define EXPTP_PANDA_DGRAPH EXPORT_TEMPL +#else + #define EXPCL_PANDA_DGRAPH IMPORT_CLASS + #define EXPTP_PANDA_DGRAPH IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_DISPLAY + #define EXPCL_PANDA_DISPLAY EXPORT_CLASS + #define EXPTP_PANDA_DISPLAY EXPORT_TEMPL +#else + #define EXPCL_PANDA_DISPLAY IMPORT_CLASS + #define EXPTP_PANDA_DISPLAY IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_DXML + #define EXPCL_PANDA_DXML EXPORT_CLASS + #define EXPTP_PANDA_DXML EXPORT_TEMPL +#else + #define EXPCL_PANDA_DXML IMPORT_CLASS + #define EXPTP_PANDA_DXML IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_EVENT + #define EXPCL_PANDA_EVENT EXPORT_CLASS + #define EXPTP_PANDA_EVENT EXPORT_TEMPL +#else + #define EXPCL_PANDA_EVENT IMPORT_CLASS + #define EXPTP_PANDA_EVENT IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_GOBJ + #define EXPCL_PANDA_GOBJ EXPORT_CLASS + #define EXPTP_PANDA_GOBJ EXPORT_TEMPL +#else + #define EXPCL_PANDA_GOBJ IMPORT_CLASS + #define EXPTP_PANDA_GOBJ IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_GRUTIL + #define EXPCL_PANDA_GRUTIL EXPORT_CLASS + #define EXPTP_PANDA_GRUTIL EXPORT_TEMPL +#else + #define EXPCL_PANDA_GRUTIL IMPORT_CLASS + #define EXPTP_PANDA_GRUTIL IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_GSGBASE + #define EXPCL_PANDA_GSGBASE EXPORT_CLASS + #define EXPTP_PANDA_GSGBASE EXPORT_TEMPL +#else + #define EXPCL_PANDA_GSGBASE IMPORT_CLASS + #define EXPTP_PANDA_GSGBASE IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_LINMATH + #define EXPCL_PANDA_LINMATH EXPORT_CLASS + #define EXPTP_PANDA_LINMATH EXPORT_TEMPL +#else + #define EXPCL_PANDA_LINMATH IMPORT_CLASS + #define EXPTP_PANDA_LINMATH IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_MATHUTIL + #define EXPCL_PANDA_MATHUTIL EXPORT_CLASS + #define EXPTP_PANDA_MATHUTIL EXPORT_TEMPL +#else + #define EXPCL_PANDA_MATHUTIL IMPORT_CLASS + #define EXPTP_PANDA_MATHUTIL IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_MOVIES + #define EXPCL_PANDA_MOVIES EXPORT_CLASS + #define EXPTP_PANDA_MOVIES EXPORT_TEMPL +#else + #define EXPCL_PANDA_MOVIES IMPORT_CLASS + #define EXPTP_PANDA_MOVIES IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_NATIVENET + #define EXPCL_PANDA_NATIVENET EXPORT_CLASS + #define EXPTP_PANDA_NATIVENET EXPORT_TEMPL +#else + #define EXPCL_PANDA_NATIVENET IMPORT_CLASS + #define EXPTP_PANDA_NATIVENET IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_NET + #define EXPCL_PANDA_NET EXPORT_CLASS + #define EXPTP_PANDA_NET EXPORT_TEMPL +#else + #define EXPCL_PANDA_NET IMPORT_CLASS + #define EXPTP_PANDA_NET IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PARAMETRICS + #define EXPCL_PANDA_PARAMETRICS EXPORT_CLASS + #define EXPTP_PANDA_PARAMETRICS EXPORT_TEMPL +#else + #define EXPCL_PANDA_PARAMETRICS IMPORT_CLASS + #define EXPTP_PANDA_PARAMETRICS IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PGRAPH + #define EXPCL_PANDA_PGRAPH EXPORT_CLASS + #define EXPTP_PANDA_PGRAPH EXPORT_TEMPL +#else + #define EXPCL_PANDA_PGRAPH IMPORT_CLASS + #define EXPTP_PANDA_PGRAPH IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PGRAPHNODES + #define EXPCL_PANDA_PGRAPHNODES EXPORT_CLASS + #define EXPTP_PANDA_PGRAPHNODES EXPORT_TEMPL +#else + #define EXPCL_PANDA_PGRAPHNODES IMPORT_CLASS + #define EXPTP_PANDA_PGRAPHNODES IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PGUI + #define EXPCL_PANDA_PGUI EXPORT_CLASS + #define EXPTP_PANDA_PGUI EXPORT_TEMPL +#else + #define EXPCL_PANDA_PGUI IMPORT_CLASS + #define EXPTP_PANDA_PGUI IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PIPELINE + #define EXPCL_PANDA_PIPELINE EXPORT_CLASS + #define EXPTP_PANDA_PIPELINE EXPORT_TEMPL +#else + #define EXPCL_PANDA_PIPELINE IMPORT_CLASS + #define EXPTP_PANDA_PIPELINE IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PNMIMAGE + #define EXPCL_PANDA_PNMIMAGE EXPORT_CLASS + #define EXPTP_PANDA_PNMIMAGE EXPORT_TEMPL +#else + #define EXPCL_PANDA_PNMIMAGE IMPORT_CLASS + #define EXPTP_PANDA_PNMIMAGE IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PNMIMAGETYPES + #define EXPCL_PANDA_PNMIMAGETYPES EXPORT_CLASS + #define EXPTP_PANDA_PNMIMAGETYPES EXPORT_TEMPL +#else + #define EXPCL_PANDA_PNMIMAGETYPES IMPORT_CLASS + #define EXPTP_PANDA_PNMIMAGETYPES IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PNMTEXT + #define EXPCL_PANDA_PNMTEXT EXPORT_CLASS + #define EXPTP_PANDA_PNMTEXT EXPORT_TEMPL +#else + #define EXPCL_PANDA_PNMTEXT IMPORT_CLASS + #define EXPTP_PANDA_PNMTEXT IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PSTATCLIENT + #define EXPCL_PANDA_PSTATCLIENT EXPORT_CLASS + #define EXPTP_PANDA_PSTATCLIENT EXPORT_TEMPL +#else + #define EXPCL_PANDA_PSTATCLIENT IMPORT_CLASS + #define EXPTP_PANDA_PSTATCLIENT IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_PUTIL + #define EXPCL_PANDA_PUTIL EXPORT_CLASS + #define EXPTP_PANDA_PUTIL EXPORT_TEMPL +#else + #define EXPCL_PANDA_PUTIL IMPORT_CLASS + #define EXPTP_PANDA_PUTIL IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_RECORDER + #define EXPCL_PANDA_RECORDER EXPORT_CLASS + #define EXPTP_PANDA_RECORDER EXPORT_TEMPL +#else + #define EXPCL_PANDA_RECORDER IMPORT_CLASS + #define EXPTP_PANDA_RECORDER IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_TEXT + #define EXPCL_PANDA_TEXT EXPORT_CLASS + #define EXPTP_PANDA_TEXT EXPORT_TEMPL +#else + #define EXPCL_PANDA_TEXT IMPORT_CLASS + #define EXPTP_PANDA_TEXT IMPORT_TEMPL +#endif + +#ifdef BUILDING_PANDA_TFORM + #define EXPCL_PANDA_TFORM EXPORT_CLASS + #define EXPTP_PANDA_TFORM EXPORT_TEMPL +#else + #define EXPCL_PANDA_TFORM IMPORT_CLASS + #define EXPTP_PANDA_TFORM IMPORT_TEMPL #endif #ifdef BUILDING_PANDAAWESOMIUM @@ -246,101 +530,4 @@ #define INLINE_MATHUTIL INLINE #endif - -#define EXPCL_LIBPANDA EXPCL_PANDA -#define EXPTP_LIBPANDA EXPTP_PANDA - -#define EXPCL_PANDA_AUDIO EXPCL_PANDA -#define EXPTP_PANDA_AUDIO EXPTP_PANDA - -#define EXPCL_PANDA_CHAN EXPCL_PANDA -#define EXPTP_PANDA_CHAN EXPTP_PANDA - -#define EXPCL_PANDA_CHAR EXPCL_PANDA -#define EXPTP_PANDA_CHAR EXPTP_PANDA - -#define EXPCL_PANDA_COLLIDE EXPCL_PANDA -#define EXPTP_PANDA_COLLIDE EXPTP_PANDA - -#define EXPCL_PANDA_CULL EXPCL_PANDA -#define EXPTP_PANDA_CULL EXPTP_PANDA - -#define EXPCL_PANDA_DEVICE EXPCL_PANDA -#define EXPTP_PANDA_DEVICE EXPTP_PANDA - -#define EXPCL_PANDA_DGRAPH EXPCL_PANDA -#define EXPTP_PANDA_DGRAPH EXPTP_PANDA - -#define EXPCL_PANDA_DISPLAY EXPCL_PANDA -#define EXPTP_PANDA_DISPLAY EXPTP_PANDA - -#define EXPCL_PANDA_DXML EXPCL_PANDA -#define EXPTP_PANDA_DXML EXPTP_PANDA - -#define EXPCL_PANDA_EVENT EXPCL_PANDA -#define EXPTP_PANDA_EVENT EXPTP_PANDA - -#define EXPCL_PANDA_GOBJ EXPCL_PANDA -#define EXPTP_PANDA_GOBJ EXPTP_PANDA - -#define EXPCL_PANDA_GRUTIL EXPCL_PANDA -#define EXPTP_PANDA_GRUTIL EXPTP_PANDA - -#define EXPCL_PANDA_GSGBASE EXPCL_PANDA -#define EXPTP_PANDA_GSGBASE EXPTP_PANDA - -#define EXPCL_PANDA_LINMATH EXPCL_PANDA -#define EXPTP_PANDA_LINMATH EXPTP_PANDA - -#define EXPCL_PANDA_MATHUTIL EXPCL_PANDA -#define EXPTP_PANDA_MATHUTIL EXPTP_PANDA - -#define EXPCL_PANDA_MOVIES EXPCL_PANDA -#define EXPTP_PANDA_MOVIES EXPTP_PANDA - -#define EXPCL_PANDA_NATIVENET EXPCL_PANDA -#define EXPTP_PANDA_NATIVENET EXPTP_PANDA - -#define EXPCL_PANDA_NET EXPCL_PANDA -#define EXPTP_PANDA_NET EXPTP_PANDA - -#define EXPCL_PANDA_PARAMETRICS EXPCL_PANDA -#define EXPTP_PANDA_PARAMETRICS EXPTP_PANDA - -#define EXPCL_PANDA_PGRAPH EXPCL_PANDA -#define EXPTP_PANDA_PGRAPH EXPTP_PANDA - -#define EXPCL_PANDA_PGRAPHNODES EXPCL_PANDA -#define EXPTP_PANDA_PGRAPHNODES EXPTP_PANDA - -#define EXPCL_PANDA_PGUI EXPCL_PANDA -#define EXPTP_PANDA_PGUI EXPTP_PANDA - -#define EXPCL_PANDA_PIPELINE EXPCL_PANDA -#define EXPTP_PANDA_PIPELINE EXPTP_PANDA - -#define EXPCL_PANDA_PNMIMAGE EXPCL_PANDA -#define EXPTP_PANDA_PNMIMAGE EXPTP_PANDA - -#define EXPCL_PANDA_PNMIMAGETYPES EXPCL_PANDA -#define EXPTP_PANDA_PNMIMAGETYPES EXPTP_PANDA - -#define EXPCL_PANDA_PNMTEXT EXPCL_PANDA -#define EXPTP_PANDA_PNMTEXT EXPTP_PANDA - -#define EXPCL_PANDA_PSTATCLIENT EXPCL_PANDA -#define EXPTP_PANDA_PSTATCLIENT EXPTP_PANDA - -#define EXPCL_PANDA_PUTIL EXPCL_PANDA -#define EXPTP_PANDA_PUTIL EXPTP_PANDA - -#define EXPCL_PANDA_RECORDER EXPCL_PANDA -#define EXPTP_PANDA_RECORDER EXPTP_PANDA - -#define EXPCL_PANDA_TEXT EXPCL_PANDA -#define EXPTP_PANDA_TEXT EXPTP_PANDA - -#define EXPCL_PANDA_TFORM EXPCL_PANDA -#define EXPTP_PANDA_TFORM EXPTP_PANDA - #endif From bd2a9d709ad6070898ccf4a25f847e9d5b91a720 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Fri, 16 Mar 2018 15:06:54 -0600 Subject: [PATCH 20/55] dtoolbase: Introduce BUILDING_ defines for each component This mirrors the prior commit. --- dtool/src/dtoolbase/dtoolsymbols.h | 57 ++++++++++++++++++------------ 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolsymbols.h b/dtool/src/dtoolbase/dtoolsymbols.h index a09ec2fb23..5f972e776f 100644 --- a/dtool/src/dtoolbase/dtoolsymbols.h +++ b/dtool/src/dtoolbase/dtoolsymbols.h @@ -68,19 +68,45 @@ */ #ifdef BUILDING_DTOOL - #define EXPCL_DTOOL EXPORT_CLASS - #define EXPTP_DTOOL EXPORT_TEMPL -#else - #define EXPCL_DTOOL IMPORT_CLASS - #define EXPTP_DTOOL IMPORT_TEMPL + #define BUILDING_DTOOL_DTOOLBASE + #define BUILDING_DTOOL_DTOOLUTIL #endif #ifdef BUILDING_DTOOLCONFIG - #define EXPCL_DTOOLCONFIG EXPORT_CLASS - #define EXPTP_DTOOLCONFIG EXPORT_TEMPL + #define BUILDING_DTOOL_PRC + #define BUILDING_DTOOL_DCONFIG +#endif + +#ifdef BUILDING_DTOOL_DTOOLBASE + #define EXPCL_DTOOL_DTOOLBASE EXPORT_CLASS + #define EXPTP_DTOOL_DTOOLBASE EXPORT_TEMPL #else - #define EXPCL_DTOOLCONFIG IMPORT_CLASS - #define EXPTP_DTOOLCONFIG IMPORT_TEMPL + #define EXPCL_DTOOL_DTOOLBASE IMPORT_CLASS + #define EXPTP_DTOOL_DTOOLBASE IMPORT_TEMPL +#endif + +#ifdef BUILDING_DTOOL_DTOOLUTIL + #define EXPCL_DTOOL_DTOOLUTIL EXPORT_CLASS + #define EXPTP_DTOOL_DTOOLUTIL EXPORT_TEMPL +#else + #define EXPCL_DTOOL_DTOOLUTIL IMPORT_CLASS + #define EXPTP_DTOOL_DTOOLUTIL IMPORT_TEMPL +#endif + +#ifdef BUILDING_DTOOL_PRC + #define EXPCL_DTOOL_PRC EXPORT_CLASS + #define EXPTP_DTOOL_PRC EXPORT_TEMPL +#else + #define EXPCL_DTOOL_PRC IMPORT_CLASS + #define EXPTP_DTOOL_PRC IMPORT_TEMPL +#endif + +#ifdef BUILDING_DTOOL_DCONFIG + #define EXPCL_DTOOL_DCONFIG EXPORT_CLASS + #define EXPTP_DTOOL_DCONFIG EXPORT_TEMPL +#else + #define EXPCL_DTOOL_DCONFIG IMPORT_CLASS + #define EXPTP_DTOOL_DCONFIG IMPORT_TEMPL #endif #ifdef BUILDING_INTERROGATEDB @@ -100,19 +126,6 @@ #endif /* BUILDING_MISC */ -#define EXPCL_DTOOL_DTOOLBASE EXPCL_DTOOL -#define EXPTP_DTOOL_DTOOLBASE EXPTP_DTOOL - -#define EXPCL_DTOOL_DTOOLUTIL EXPCL_DTOOL -#define EXPTP_DTOOL_DTOOLUTIL EXPTP_DTOOL - -#define EXPCL_DTOOL_PRC EXPCL_DTOOLCONFIG -#define EXPTP_DTOOL_PRC EXPTP_DTOOLCONFIG - -#define EXPCL_DTOOL_DCONFIG EXPCL_DTOOLCONFIG -#define EXPTP_DTOOL_DCONFIG EXPTP_DTOOLCONFIG - - /* These two are always defined empty, because pystub is statically built. But we leave the symbol around in case we change our minds to make pystub once again be a dynamic library. */ From f231ba4cd7ecc689e7827b9c21f79621b8d3f651 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 20 Mar 2018 00:09:09 -0600 Subject: [PATCH 21/55] directbase: Introduce BUILDING_ defines for each component Ditto everything before, but for direct. --- direct/src/dcparser/dcbase.h | 6 -- direct/src/deadrec/config_deadrec.h | 4 +- direct/src/deadrec/smoothMover.h | 2 +- direct/src/directbase/directsymbols.h | 58 +++++++++++++++++-- direct/src/directd/directd.h | 2 +- .../src/distributed/cConnectionRepository.h | 2 +- .../distributed/cDistributedSmoothNodeBase.h | 2 +- direct/src/distributed/config_distributed.h | 4 +- direct/src/interval/cConstrainHprInterval.h | 2 +- .../src/interval/cConstrainPosHprInterval.h | 2 +- direct/src/interval/cConstrainPosInterval.h | 2 +- .../interval/cConstrainTransformInterval.h | 2 +- direct/src/interval/cConstraintInterval.h | 2 +- direct/src/interval/cInterval.h | 4 +- direct/src/interval/cIntervalManager.h | 2 +- direct/src/interval/cLerpAnimEffectInterval.h | 2 +- direct/src/interval/cLerpInterval.h | 2 +- direct/src/interval/cLerpNodePathInterval.h | 2 +- direct/src/interval/cMetaInterval.h | 2 +- direct/src/interval/config_interval.h | 6 +- direct/src/interval/hideInterval.h | 2 +- direct/src/interval/lerpblend.h | 10 ++-- direct/src/interval/showInterval.h | 2 +- direct/src/interval/waitInterval.h | 2 +- direct/src/motiontrail/cMotionTrail.h | 2 +- direct/src/motiontrail/config_motiontrail.cxx | 2 +- direct/src/motiontrail/config_motiontrail.h | 4 +- direct/src/showbase/showBase.h | 22 +++---- 28 files changed, 100 insertions(+), 56 deletions(-) diff --git a/direct/src/dcparser/dcbase.h b/direct/src/dcparser/dcbase.h index fae53a46f8..6d65f16524 100644 --- a/direct/src/dcparser/dcbase.h +++ b/direct/src/dcparser/dcbase.h @@ -80,12 +80,6 @@ using namespace std; #define nassertv(condition) assert(condition) #define nassertv_always(condition) assert(condition) -// Panda defines these export symbols for building DLL's. Outside of Panda, -// we assume we're not putting this code in a DLL, so we define them to -// nothing. -#define EXPCL_DIRECT -#define EXPTP_DIRECT - // Panda defines a special Filename class. We'll use an ordinary string // instead. typedef string Filename; diff --git a/direct/src/deadrec/config_deadrec.h b/direct/src/deadrec/config_deadrec.h index df1b656e32..7dfc36c898 100644 --- a/direct/src/deadrec/config_deadrec.h +++ b/direct/src/deadrec/config_deadrec.h @@ -18,10 +18,10 @@ #include "notifyCategoryProxy.h" #include "configVariableBool.h" -NotifyCategoryDecl(deadrec, EXPCL_DIRECT, EXPTP_DIRECT); +NotifyCategoryDecl(deadrec, EXPCL_DIRECT_DEADREC, EXPTP_DIRECT_DEADREC); extern ConfigVariableBool accept_clock_skew; -extern EXPCL_DIRECT void init_libdeadrec(); +extern EXPCL_DIRECT_DEADREC void init_libdeadrec(); #endif diff --git a/direct/src/deadrec/smoothMover.h b/direct/src/deadrec/smoothMover.h index e9ca5dc76e..aee12bca8e 100644 --- a/direct/src/deadrec/smoothMover.h +++ b/direct/src/deadrec/smoothMover.h @@ -38,7 +38,7 @@ static const int max_timestamp_delays = 10; * update. The assumption is that all SmoothMovers in the world will be * operating in the same mode together. */ -class EXPCL_DIRECT SmoothMover { +class EXPCL_DIRECT_DEADREC SmoothMover { PUBLISHED: SmoothMover(); ~SmoothMover(); diff --git a/direct/src/directbase/directsymbols.h b/direct/src/directbase/directsymbols.h index 4eb2202c1f..cdd07e1a0c 100644 --- a/direct/src/directbase/directsymbols.h +++ b/direct/src/directbase/directsymbols.h @@ -16,12 +16,62 @@ /* See dtoolsymbols.h for a rant on the purpose of this file. */ +/* BUILDING_DIRECT is just a buildsystem shortcut for all of these: */ #ifdef BUILDING_DIRECT - #define EXPCL_DIRECT EXPORT_CLASS - #define EXPTP_DIRECT EXPORT_TEMPL + #define BUILDING_DIRECT_DEADREC + #define BUILDING_DIRECT_DIRECTD + #define BUILDING_DIRECT_INTERVAL + #define BUILDING_DIRECT_MOTIONTRAIL + #define BUILDING_DIRECT_SHOWBASE + #define BUILDING_DIRECT_DISTRIBUTED +#endif + +#ifdef BUILDING_DIRECT_DEADREC + #define EXPCL_DIRECT_DEADREC EXPORT_CLASS + #define EXPTP_DIRECT_DEADREC EXPORT_TEMPL #else - #define EXPCL_DIRECT IMPORT_CLASS - #define EXPTP_DIRECT IMPORT_TEMPL + #define EXPCL_DIRECT_DEADREC IMPORT_CLASS + #define EXPTP_DIRECT_DEADREC IMPORT_TEMPL +#endif + +#ifdef BUILDING_DIRECT_DIRECTD + #define EXPCL_DIRECT_DIRECTD EXPORT_CLASS + #define EXPTP_DIRECT_DIRECTD EXPORT_TEMPL +#else + #define EXPCL_DIRECT_DIRECTD IMPORT_CLASS + #define EXPTP_DIRECT_DIRECTD IMPORT_TEMPL +#endif + +#ifdef BUILDING_DIRECT_INTERVAL + #define EXPCL_DIRECT_INTERVAL EXPORT_CLASS + #define EXPTP_DIRECT_INTERVAL EXPORT_TEMPL +#else + #define EXPCL_DIRECT_INTERVAL IMPORT_CLASS + #define EXPTP_DIRECT_INTERVAL IMPORT_TEMPL +#endif + +#ifdef BUILDING_DIRECT_MOTIONTRAIL + #define EXPCL_DIRECT_MOTIONTRAIL EXPORT_CLASS + #define EXPTP_DIRECT_MOTIONTRAIL EXPORT_TEMPL +#else + #define EXPCL_DIRECT_MOTIONTRAIL IMPORT_CLASS + #define EXPTP_DIRECT_MOTIONTRAIL IMPORT_TEMPL +#endif + +#ifdef BUILDING_DIRECT_SHOWBASE + #define EXPCL_DIRECT_SHOWBASE EXPORT_CLASS + #define EXPTP_DIRECT_SHOWBASE EXPORT_TEMPL +#else + #define EXPCL_DIRECT_SHOWBASE IMPORT_CLASS + #define EXPTP_DIRECT_SHOWBASE IMPORT_TEMPL +#endif + +#ifdef BUILDING_DIRECT_DISTRIBUTED + #define EXPCL_DIRECT_DISTRIBUTED EXPORT_CLASS + #define EXPTP_DIRECT_DISTRIBUTED EXPORT_TEMPL +#else + #define EXPCL_DIRECT_DISTRIBUTED IMPORT_CLASS + #define EXPTP_DIRECT_DISTRIBUTED IMPORT_TEMPL #endif #endif diff --git a/direct/src/directd/directd.h b/direct/src/directd/directd.h index 3aff05e9df..0623c09b4d 100644 --- a/direct/src/directd/directd.h +++ b/direct/src/directd/directd.h @@ -52,7 +52,7 @@ typedef int HANDLE; * presented in order chronologically by their intended usage. The first * group will probably provide everthing needed for DirectD. */ -class EXPCL_DIRECT DirectD { +class EXPCL_DIRECT_DIRECTD DirectD { PUBLISHED: DirectD(); ~DirectD(); diff --git a/direct/src/distributed/cConnectionRepository.h b/direct/src/distributed/cConnectionRepository.h index fbc494423e..420c995e37 100644 --- a/direct/src/distributed/cConnectionRepository.h +++ b/direct/src/distributed/cConnectionRepository.h @@ -53,7 +53,7 @@ class SocketStream; * the C++ layer, while server messages that are not understood by the C++ * layer are returned up to the Python layer for processing. */ -class EXPCL_DIRECT CConnectionRepository { +class EXPCL_DIRECT_DISTRIBUTED CConnectionRepository { PUBLISHED: explicit CConnectionRepository(bool has_owner_view = false, bool threaded_net = false); diff --git a/direct/src/distributed/cDistributedSmoothNodeBase.h b/direct/src/distributed/cDistributedSmoothNodeBase.h index 53763a6a47..d2c43e285c 100644 --- a/direct/src/distributed/cDistributedSmoothNodeBase.h +++ b/direct/src/distributed/cDistributedSmoothNodeBase.h @@ -28,7 +28,7 @@ class CConnectionRepository; * This class defines some basic methods of DistributedSmoothNodeBase which * have been moved into C++ as a performance optimization. */ -class EXPCL_DIRECT CDistributedSmoothNodeBase { +class EXPCL_DIRECT_DISTRIBUTED CDistributedSmoothNodeBase { PUBLISHED: CDistributedSmoothNodeBase(); ~CDistributedSmoothNodeBase(); diff --git a/direct/src/distributed/config_distributed.h b/direct/src/distributed/config_distributed.h index 1ffbc39df9..22814bfa13 100644 --- a/direct/src/distributed/config_distributed.h +++ b/direct/src/distributed/config_distributed.h @@ -21,13 +21,13 @@ #include "configVariableDouble.h" #include "configVariableBool.h" -NotifyCategoryDecl(distributed, EXPCL_DIRECT, EXPTP_DIRECT); +NotifyCategoryDecl(distributed, EXPCL_DIRECT_DISTRIBUTED, EXPTP_DIRECT_DISTRIBUTED); extern ConfigVariableInt game_server_timeout_ms; extern ConfigVariableDouble min_lag; extern ConfigVariableDouble max_lag; extern ConfigVariableBool handle_datagrams_internally; -extern EXPCL_DIRECT void init_libdistributed(); +extern EXPCL_DIRECT_DISTRIBUTED void init_libdistributed(); #endif diff --git a/direct/src/interval/cConstrainHprInterval.h b/direct/src/interval/cConstrainHprInterval.h index a618b98641..73c790100d 100644 --- a/direct/src/interval/cConstrainHprInterval.h +++ b/direct/src/interval/cConstrainHprInterval.h @@ -24,7 +24,7 @@ * A constraint interval that will constrain the orientation of one node to * the orientation of another. */ -class EXPCL_DIRECT CConstrainHprInterval : public CConstraintInterval { +class EXPCL_DIRECT_INTERVAL CConstrainHprInterval : public CConstraintInterval { PUBLISHED: explicit CConstrainHprInterval(const string &name, double duration, const NodePath &node, const NodePath &target, diff --git a/direct/src/interval/cConstrainPosHprInterval.h b/direct/src/interval/cConstrainPosHprInterval.h index d3ce5efa4f..44fedae0f6 100644 --- a/direct/src/interval/cConstrainPosHprInterval.h +++ b/direct/src/interval/cConstrainPosHprInterval.h @@ -24,7 +24,7 @@ * A constraint interval that will constrain the position and orientation of * one node to the position and orientation of another. */ -class EXPCL_DIRECT CConstrainPosHprInterval : public CConstraintInterval { +class EXPCL_DIRECT_INTERVAL CConstrainPosHprInterval : public CConstraintInterval { PUBLISHED: explicit CConstrainPosHprInterval(const string &name, double duration, const NodePath &node, const NodePath &target, diff --git a/direct/src/interval/cConstrainPosInterval.h b/direct/src/interval/cConstrainPosInterval.h index 92055cd0a4..1e66d3aca0 100644 --- a/direct/src/interval/cConstrainPosInterval.h +++ b/direct/src/interval/cConstrainPosInterval.h @@ -23,7 +23,7 @@ * A constraint interval that will constrain the position of one node to the * position of another. */ -class EXPCL_DIRECT CConstrainPosInterval : public CConstraintInterval { +class EXPCL_DIRECT_INTERVAL CConstrainPosInterval : public CConstraintInterval { PUBLISHED: explicit CConstrainPosInterval(const string &name, double duration, const NodePath &node, const NodePath &target, diff --git a/direct/src/interval/cConstrainTransformInterval.h b/direct/src/interval/cConstrainTransformInterval.h index 897f12aea3..a4bb537ec1 100644 --- a/direct/src/interval/cConstrainTransformInterval.h +++ b/direct/src/interval/cConstrainTransformInterval.h @@ -22,7 +22,7 @@ * A constraint interval that will constrain the transform of one node to the * transform of another. */ -class EXPCL_DIRECT CConstrainTransformInterval : public CConstraintInterval { +class EXPCL_DIRECT_INTERVAL CConstrainTransformInterval : public CConstraintInterval { PUBLISHED: explicit CConstrainTransformInterval(const string &name, double duration, const NodePath &node, diff --git a/direct/src/interval/cConstraintInterval.h b/direct/src/interval/cConstraintInterval.h index 32f90ed978..96a47946ec 100644 --- a/direct/src/interval/cConstraintInterval.h +++ b/direct/src/interval/cConstraintInterval.h @@ -21,7 +21,7 @@ * The base class for a family of intervals that constrain some property to a * value over time. */ -class EXPCL_DIRECT CConstraintInterval : public CInterval { +class EXPCL_DIRECT_INTERVAL CConstraintInterval : public CInterval { PUBLISHED: bool bogus_variable; diff --git a/direct/src/interval/cInterval.h b/direct/src/interval/cInterval.h index d62eadc0c7..07672f352f 100644 --- a/direct/src/interval/cInterval.h +++ b/direct/src/interval/cInterval.h @@ -32,7 +32,7 @@ class CIntervalManager; * C++ will inherit from this class; Intervals that must be implemented in * Python will inherit from the similar Python class. */ -class EXPCL_DIRECT CInterval : public TypedReferenceCount { +class EXPCL_DIRECT_INTERVAL CInterval : public TypedReferenceCount { public: CInterval(const string &name, double duration, bool open_ended); virtual ~CInterval(); @@ -202,7 +202,7 @@ private: }; INLINE ostream &operator << (ostream &out, const CInterval &ival); -EXPCL_DIRECT ostream &operator << (ostream &out, CInterval::State state); +EXPCL_DIRECT_INTERVAL ostream &operator << (ostream &out, CInterval::State state); #include "cInterval.I" diff --git a/direct/src/interval/cIntervalManager.h b/direct/src/interval/cIntervalManager.h index 26616dce91..d4279c25fb 100644 --- a/direct/src/interval/cIntervalManager.h +++ b/direct/src/interval/cIntervalManager.h @@ -36,7 +36,7 @@ class EventQueue; * It is also possible to create multiple IntervalManager objects for special * needs. */ -class EXPCL_DIRECT CIntervalManager { +class EXPCL_DIRECT_INTERVAL CIntervalManager { PUBLISHED: CIntervalManager(); ~CIntervalManager(); diff --git a/direct/src/interval/cLerpAnimEffectInterval.h b/direct/src/interval/cLerpAnimEffectInterval.h index ef84b19df0..af657cb7cc 100644 --- a/direct/src/interval/cLerpAnimEffectInterval.h +++ b/direct/src/interval/cLerpAnimEffectInterval.h @@ -29,7 +29,7 @@ * CLerpAnimEffectInterval to adjust the degree to which each animation * affects the actor. */ -class EXPCL_DIRECT CLerpAnimEffectInterval : public CLerpInterval { +class EXPCL_DIRECT_INTERVAL CLerpAnimEffectInterval : public CLerpInterval { PUBLISHED: INLINE explicit CLerpAnimEffectInterval(const string &name, double duration, BlendType blend_type); diff --git a/direct/src/interval/cLerpInterval.h b/direct/src/interval/cLerpInterval.h index 6a6abbe5c9..7011fd70e9 100644 --- a/direct/src/interval/cLerpInterval.h +++ b/direct/src/interval/cLerpInterval.h @@ -21,7 +21,7 @@ * The base class for a family of intervals that linearly interpolate one or * more numeric values over time. */ -class EXPCL_DIRECT CLerpInterval : public CInterval { +class EXPCL_DIRECT_INTERVAL CLerpInterval : public CInterval { PUBLISHED: enum BlendType { BT_no_blend, diff --git a/direct/src/interval/cLerpNodePathInterval.h b/direct/src/interval/cLerpNodePathInterval.h index 9ac5ae46dc..a134faebf0 100644 --- a/direct/src/interval/cLerpNodePathInterval.h +++ b/direct/src/interval/cLerpNodePathInterval.h @@ -23,7 +23,7 @@ * An interval that lerps one or more properties (like pos, hpr, etc.) on a * NodePath over time. */ -class EXPCL_DIRECT CLerpNodePathInterval : public CLerpInterval { +class EXPCL_DIRECT_INTERVAL CLerpNodePathInterval : public CLerpInterval { PUBLISHED: explicit CLerpNodePathInterval(const string &name, double duration, BlendType blend_type, bool bake_in_start, diff --git a/direct/src/interval/cMetaInterval.h b/direct/src/interval/cMetaInterval.h index ea44225842..f1956f4167 100644 --- a/direct/src/interval/cMetaInterval.h +++ b/direct/src/interval/cMetaInterval.h @@ -29,7 +29,7 @@ * own begin and end times. Some of them may overlap and some of them may * not. */ -class EXPCL_DIRECT CMetaInterval : public CInterval { +class EXPCL_DIRECT_INTERVAL CMetaInterval : public CInterval { PUBLISHED: explicit CMetaInterval(const string &name); virtual ~CMetaInterval(); diff --git a/direct/src/interval/config_interval.h b/direct/src/interval/config_interval.h index 8695f4b140..10af86bfb7 100644 --- a/direct/src/interval/config_interval.h +++ b/direct/src/interval/config_interval.h @@ -20,11 +20,11 @@ #include "configVariableDouble.h" #include "configVariableBool.h" -NotifyCategoryDecl(interval, EXPCL_DIRECT, EXPTP_DIRECT); +NotifyCategoryDecl(interval, EXPCL_DIRECT_INTERVAL, EXPTP_DIRECT_INTERVAL); extern ConfigVariableDouble interval_precision; -extern EXPCL_DIRECT ConfigVariableBool verify_intervals; +extern EXPCL_DIRECT_INTERVAL ConfigVariableBool verify_intervals; -extern EXPCL_DIRECT void init_libinterval(); +extern EXPCL_DIRECT_INTERVAL void init_libinterval(); #endif diff --git a/direct/src/interval/hideInterval.h b/direct/src/interval/hideInterval.h index f2a53307b1..91cd1a9bda 100644 --- a/direct/src/interval/hideInterval.h +++ b/direct/src/interval/hideInterval.h @@ -21,7 +21,7 @@ /** * An interval that calls NodePath::hide(). */ -class EXPCL_DIRECT HideInterval : public CInterval { +class EXPCL_DIRECT_INTERVAL HideInterval : public CInterval { PUBLISHED: explicit HideInterval(const NodePath &node, const string &name = string()); diff --git a/direct/src/interval/lerpblend.h b/direct/src/interval/lerpblend.h index f5c583ace9..d0f0bd8cfc 100644 --- a/direct/src/interval/lerpblend.h +++ b/direct/src/interval/lerpblend.h @@ -17,7 +17,7 @@ #include "directbase.h" #include "typedReferenceCount.h" -class EXPCL_DIRECT LerpBlendType : public TypedReferenceCount { +class EXPCL_DIRECT_INTERVAL LerpBlendType : public TypedReferenceCount { PUBLISHED: LerpBlendType() {} virtual ~LerpBlendType(); @@ -47,7 +47,7 @@ private: static TypeHandle _type_handle; }; -class EXPCL_DIRECT EaseInBlendType : public LerpBlendType { +class EXPCL_DIRECT_INTERVAL EaseInBlendType : public LerpBlendType { PUBLISHED: EaseInBlendType() {} virtual ~EaseInBlendType(); @@ -77,7 +77,7 @@ private: static TypeHandle _type_handle; }; -class EXPCL_DIRECT EaseOutBlendType : public LerpBlendType { +class EXPCL_DIRECT_INTERVAL EaseOutBlendType : public LerpBlendType { PUBLISHED: EaseOutBlendType() {} virtual ~EaseOutBlendType(); @@ -107,7 +107,7 @@ private: static TypeHandle _type_handle; }; -class EXPCL_DIRECT EaseInOutBlendType : public LerpBlendType { +class EXPCL_DIRECT_INTERVAL EaseInOutBlendType : public LerpBlendType { PUBLISHED: EaseInOutBlendType() {} virtual ~EaseInOutBlendType(); @@ -136,7 +136,7 @@ private: static TypeHandle _type_handle; }; -class EXPCL_DIRECT NoBlendType : public LerpBlendType { +class EXPCL_DIRECT_INTERVAL NoBlendType : public LerpBlendType { PUBLISHED: NoBlendType() {} virtual ~NoBlendType(); diff --git a/direct/src/interval/showInterval.h b/direct/src/interval/showInterval.h index 5365581339..bff66d8366 100644 --- a/direct/src/interval/showInterval.h +++ b/direct/src/interval/showInterval.h @@ -21,7 +21,7 @@ /** * An interval that calls NodePath::show(). */ -class EXPCL_DIRECT ShowInterval : public CInterval { +class EXPCL_DIRECT_INTERVAL ShowInterval : public CInterval { PUBLISHED: explicit ShowInterval(const NodePath &node, const string &name = string()); diff --git a/direct/src/interval/waitInterval.h b/direct/src/interval/waitInterval.h index dbf0757843..c3607c27b8 100644 --- a/direct/src/interval/waitInterval.h +++ b/direct/src/interval/waitInterval.h @@ -21,7 +21,7 @@ * This interval does absolutely nothing, and is mainly useful for marking * time between other intervals within a sequence. */ -class EXPCL_DIRECT WaitInterval : public CInterval { +class EXPCL_DIRECT_INTERVAL WaitInterval : public CInterval { PUBLISHED: INLINE explicit WaitInterval(double duration); diff --git a/direct/src/motiontrail/cMotionTrail.h b/direct/src/motiontrail/cMotionTrail.h index ef05b4b1c0..fdb5ba1f56 100644 --- a/direct/src/motiontrail/cMotionTrail.h +++ b/direct/src/motiontrail/cMotionTrail.h @@ -69,7 +69,7 @@ public: * coordinate of the texture corresponds to time and the v coordinate * corresponds to the "shape" of the motion trail. */ -class EXPCL_DIRECT CMotionTrail : public TypedReferenceCount { +class EXPCL_DIRECT_MOTIONTRAIL CMotionTrail : public TypedReferenceCount { PUBLISHED: CMotionTrail(); ~CMotionTrail(); diff --git a/direct/src/motiontrail/config_motiontrail.cxx b/direct/src/motiontrail/config_motiontrail.cxx index c805ae1319..0907457acd 100644 --- a/direct/src/motiontrail/config_motiontrail.cxx +++ b/direct/src/motiontrail/config_motiontrail.cxx @@ -14,7 +14,7 @@ #include "config_motiontrail.h" #include "dconfig.h" -extern EXPCL_DIRECT void init_libmotiontrail(); +extern EXPCL_DIRECT_MOTIONTRAIL void init_libmotiontrail(); Configure(config_motiontrail); NotifyCategoryDef(motiontrail, ""); diff --git a/direct/src/motiontrail/config_motiontrail.h b/direct/src/motiontrail/config_motiontrail.h index 79c516d41c..918c839612 100644 --- a/direct/src/motiontrail/config_motiontrail.h +++ b/direct/src/motiontrail/config_motiontrail.h @@ -20,8 +20,8 @@ #include "cMotionTrail.h" -NotifyCategoryDecl(motiontrail, EXPCL_DIRECT, EXPTP_DIRECT); +NotifyCategoryDecl(motiontrail, EXPCL_DIRECT_MOTIONTRAIL, EXPTP_DIRECT_MOTIONTRAIL); -extern EXPCL_DIRECT void init_libmotiontrail(); +extern EXPCL_DIRECT_MOTIONTRAIL void init_libmotiontrail(); #endif diff --git a/direct/src/showbase/showBase.h b/direct/src/showbase/showBase.h index 2347800789..a38a791d3b 100644 --- a/direct/src/showbase/showBase.h +++ b/direct/src/showbase/showBase.h @@ -26,7 +26,7 @@ #include "configVariableSearchPath.h" #include "nodePath.h" -ConfigureDecl(config_showbase, EXPCL_DIRECT, EXPTP_DIRECT); +ConfigureDecl(config_showbase, EXPCL_DIRECT_SHOWBASE, EXPTP_DIRECT_SHOWBASE); class CollisionTraverser; class Camera; @@ -34,24 +34,24 @@ class GraphicsEngine; BEGIN_PUBLISH -EXPCL_DIRECT ConfigVariableSearchPath &get_particle_path(); +EXPCL_DIRECT_SHOWBASE ConfigVariableSearchPath &get_particle_path(); -EXPCL_DIRECT void throw_new_frame(); +EXPCL_DIRECT_SHOWBASE void throw_new_frame(); -EXPCL_DIRECT DConfig &get_config_showbase(); -EXPCL_DIRECT void init_app_for_gui(); +EXPCL_DIRECT_SHOWBASE DConfig &get_config_showbase(); +EXPCL_DIRECT_SHOWBASE void init_app_for_gui(); // klunky interface since we cant pass array from python->C++ -EXPCL_DIRECT void add_fullscreen_testsize(int xsize, int ysize); -EXPCL_DIRECT void runtest_fullscreen_sizes(GraphicsWindow *win); -EXPCL_DIRECT bool query_fullscreen_testresult(int xsize, int ysize); +EXPCL_DIRECT_SHOWBASE void add_fullscreen_testsize(int xsize, int ysize); +EXPCL_DIRECT_SHOWBASE void runtest_fullscreen_sizes(GraphicsWindow *win); +EXPCL_DIRECT_SHOWBASE bool query_fullscreen_testresult(int xsize, int ysize); // to handle windows stickykeys -EXPCL_DIRECT void store_accessibility_shortcut_keys(); -EXPCL_DIRECT void allow_accessibility_shortcut_keys(bool allowKeys); +EXPCL_DIRECT_SHOWBASE void store_accessibility_shortcut_keys(); +EXPCL_DIRECT_SHOWBASE void allow_accessibility_shortcut_keys(bool allowKeys); #ifdef IS_OSX -EXPCL_DIRECT void activate_osx_application(); +EXPCL_DIRECT_SHOWBASE void activate_osx_application(); #endif END_PUBLISH From 9dd37e9dbc361055b64003509275d97784120e84 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Fri, 16 Mar 2018 19:51:56 -0600 Subject: [PATCH 22/55] general: Add guards to ensure proper BUILDING_ macros defined This is designed to sanity-check the buildsystem, ensuring that the expected BUILDING_ macros are defined at the expected time. It also helps catch cases where the wrong BUILDING_/EXPCL_ macros are used. --- direct/src/deadrec/config_deadrec.cxx | 4 ++++ direct/src/directd/directd.cxx | 4 ++++ direct/src/distributed/config_distributed.cxx | 4 ++++ direct/src/interval/config_interval.cxx | 4 ++++ direct/src/motiontrail/config_motiontrail.cxx | 4 ++++ direct/src/showbase/showBase.cxx | 4 ++++ dtool/src/dconfig/config_dconfig.cxx | 4 ++++ dtool/src/dtoolbase/dtoolbase.cxx | 4 ++++ dtool/src/dtoolutil/config_dtoolutil.cxx | 4 ++++ dtool/src/prc/config_prc.cxx | 4 ++++ panda/metalibs/panda/panda.cxx | 4 ++++ panda/src/audio/config_audio.cxx | 4 ++++ panda/src/audiotraits/config_fmodAudio.cxx | 4 ++++ panda/src/audiotraits/config_milesAudio.cxx | 4 ++++ panda/src/audiotraits/config_openalAudio.cxx | 4 ++++ panda/src/awesomium/config_awesomium.cxx | 4 ++++ panda/src/bullet/config_bullet.cxx | 4 ++++ panda/src/chan/config_chan.cxx | 4 ++++ panda/src/char/config_char.cxx | 4 ++++ panda/src/cocoadisplay/config_cocoadisplay.mm | 4 ++++ panda/src/collada/config_collada.cxx | 4 ++++ panda/src/collide/config_collide.cxx | 4 ++++ panda/src/cull/config_cull.cxx | 4 ++++ panda/src/device/config_device.cxx | 4 ++++ panda/src/dgraph/config_dgraph.cxx | 4 ++++ panda/src/display/config_display.cxx | 4 ++++ panda/src/distort/config_distort.cxx | 4 ++++ panda/src/downloader/config_downloader.cxx | 4 ++++ panda/src/dxgsg9/config_dxgsg9.cxx | 4 ++++ panda/src/dxml/config_dxml.cxx | 4 ++++ panda/src/egg/config_egg.cxx | 4 ++++ panda/src/egg2pg/config_egg2pg.cxx | 4 ++++ panda/src/egldisplay/config_egldisplay.cxx | 4 ++++ panda/src/event/config_event.cxx | 4 ++++ panda/src/express/config_express.cxx | 4 ++++ panda/src/ffmpeg/config_ffmpeg.cxx | 4 ++++ panda/src/framework/config_framework.cxx | 4 ++++ panda/src/gles2gsg/config_gles2gsg.cxx | 4 ++++ panda/src/glesgsg/config_glesgsg.cxx | 4 ++++ panda/src/glgsg/config_glgsg.cxx | 4 ++++ panda/src/glxdisplay/config_glxdisplay.cxx | 4 ++++ panda/src/gobj/config_gobj.cxx | 4 ++++ panda/src/grutil/config_grutil.cxx | 4 ++++ panda/src/gsgbase/config_gsgbase.cxx | 4 ++++ panda/src/linmath/config_linmath.cxx | 4 ++++ panda/src/mathutil/config_mathutil.cxx | 4 ++++ panda/src/movies/config_movies.cxx | 4 ++++ panda/src/nativenet/config_nativenet.cxx | 4 ++++ panda/src/net/config_net.cxx | 4 ++++ panda/src/ode/config_ode.cxx | 4 ++++ panda/src/osxdisplay/config_osxdisplay.cxx | 4 ++++ panda/src/parametrics/config_parametrics.cxx | 4 ++++ panda/src/particlesystem/config_particlesystem.cxx | 4 ++++ panda/src/pgraph/config_pgraph.cxx | 4 ++++ panda/src/pgraphnodes/config_pgraphnodes.cxx | 4 ++++ panda/src/pgui/config_pgui.cxx | 4 ++++ panda/src/physics/config_physics.cxx | 4 ++++ panda/src/physx/config_physx.cxx | 4 ++++ panda/src/pipeline/config_pipeline.cxx | 4 ++++ panda/src/pnmimage/config_pnmimage.cxx | 4 ++++ panda/src/pnmimagetypes/config_pnmimagetypes.cxx | 4 ++++ panda/src/pnmtext/config_pnmtext.cxx | 4 ++++ panda/src/pstatclient/config_pstats.cxx | 4 ++++ panda/src/putil/config_util.cxx | 4 ++++ panda/src/recorder/config_recorder.cxx | 4 ++++ panda/src/rocket/config_rocket.cxx | 4 ++++ panda/src/skel/config_skel.cxx | 4 ++++ panda/src/speedtree/config_speedtree.cxx | 4 ++++ panda/src/text/config_text.cxx | 4 ++++ panda/src/tform/config_tform.cxx | 4 ++++ panda/src/tinydisplay/config_tinydisplay.cxx | 4 ++++ panda/src/vision/config_vision.cxx | 4 ++++ panda/src/vrpn/config_vrpn.cxx | 4 ++++ panda/src/wgldisplay/config_wgldisplay.cxx | 4 ++++ panda/src/windisplay/config_windisplay.cxx | 4 ++++ panda/src/x11display/config_x11display.cxx | 4 ++++ 76 files changed, 304 insertions(+) diff --git a/direct/src/deadrec/config_deadrec.cxx b/direct/src/deadrec/config_deadrec.cxx index 72c8c15a14..eb1c43a9c6 100644 --- a/direct/src/deadrec/config_deadrec.cxx +++ b/direct/src/deadrec/config_deadrec.cxx @@ -15,6 +15,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_DEADREC) + #error Buildsystem error: BUILDING_DIRECT_DEADREC not defined +#endif + Configure(config_deadrec); NotifyCategoryDef(deadrec, ""); diff --git a/direct/src/directd/directd.cxx b/direct/src/directd/directd.cxx index 111a4fd847..1b4601fc41 100644 --- a/direct/src/directd/directd.cxx +++ b/direct/src/directd/directd.cxx @@ -30,6 +30,10 @@ #include "pset.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_DIRECTD) + #error Buildsystem error: BUILDING_DIRECT_DIRECTD not defined +#endif + namespace { // ...This section is part of the old stuff from the original // implementation. The new stuff that uses job objects doesn't need this diff --git a/direct/src/distributed/config_distributed.cxx b/direct/src/distributed/config_distributed.cxx index 9420bd05df..312964568f 100644 --- a/direct/src/distributed/config_distributed.cxx +++ b/direct/src/distributed/config_distributed.cxx @@ -14,6 +14,10 @@ #include "config_distributed.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_DISTRIBUTED) + #error Buildsystem error: BUILDING_DIRECT_DISTRIBUTED not defined +#endif + Configure(config_distributed); NotifyCategoryDef(distributed, ""); diff --git a/direct/src/interval/config_interval.cxx b/direct/src/interval/config_interval.cxx index d88711c8b9..f56ce67e17 100644 --- a/direct/src/interval/config_interval.cxx +++ b/direct/src/interval/config_interval.cxx @@ -29,6 +29,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_INTERVAL) + #error Buildsystem error: BUILDING_DIRECT_INTERVAL not defined +#endif + Configure(config_interval); NotifyCategoryDef(interval, ""); diff --git a/direct/src/motiontrail/config_motiontrail.cxx b/direct/src/motiontrail/config_motiontrail.cxx index 0907457acd..997a1a3059 100644 --- a/direct/src/motiontrail/config_motiontrail.cxx +++ b/direct/src/motiontrail/config_motiontrail.cxx @@ -14,6 +14,10 @@ #include "config_motiontrail.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_MOTIONTRAIL) + #error Buildsystem error: BUILDING_DIRECT_MOTIONTRAIL not defined +#endif + extern EXPCL_DIRECT_MOTIONTRAIL void init_libmotiontrail(); Configure(config_motiontrail); diff --git a/direct/src/showbase/showBase.cxx b/direct/src/showbase/showBase.cxx index fabc7a9497..12aa08d4bd 100644 --- a/direct/src/showbase/showBase.cxx +++ b/direct/src/showbase/showBase.cxx @@ -34,6 +34,10 @@ TOGGLEKEYS g_StartupToggleKeys = {sizeof(TOGGLEKEYS), 0}; FILTERKEYS g_StartupFilterKeys = {sizeof(FILTERKEYS), 0}; #endif +#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_SHOWBASE) + #error Buildsystem error: BUILDING_DIRECT_SHOWBASE not defined +#endif + ConfigureDef(config_showbase); ConfigureFn(config_showbase) { } diff --git a/dtool/src/dconfig/config_dconfig.cxx b/dtool/src/dconfig/config_dconfig.cxx index 49708e719a..d0800084ca 100644 --- a/dtool/src/dconfig/config_dconfig.cxx +++ b/dtool/src/dconfig/config_dconfig.cxx @@ -13,5 +13,9 @@ #include "config_dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DTOOL_DCONFIG) + #error Buildsystem error: BUILDING_DTOOL_DCONFIG not defined +#endif + NotifyCategoryDef(dconfig, ""); NotifyCategoryDef(microconfig, "dconfig"); diff --git a/dtool/src/dtoolbase/dtoolbase.cxx b/dtool/src/dtoolbase/dtoolbase.cxx index 75f25ad253..64b7425057 100644 --- a/dtool/src/dtoolbase/dtoolbase.cxx +++ b/dtool/src/dtoolbase/dtoolbase.cxx @@ -14,6 +14,10 @@ #include "dtoolbase.h" #include "memoryHook.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DTOOL_DTOOLBASE) + #error Buildsystem error: BUILDING_DTOOL_DTOOLBASE not defined +#endif + #if defined(USE_TAU) && defined(WIN32) // Hack around tau's lack of DLL export declarations for Profiler class. bool __tau_shutdown = false; diff --git a/dtool/src/dtoolutil/config_dtoolutil.cxx b/dtool/src/dtoolutil/config_dtoolutil.cxx index eb45fa2f3e..98b3c42760 100644 --- a/dtool/src/dtoolutil/config_dtoolutil.cxx +++ b/dtool/src/dtoolutil/config_dtoolutil.cxx @@ -16,6 +16,10 @@ #include "filename.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DTOOL_DTOOLUTIL) + #error Buildsystem error: BUILDING_DTOOL_DCTOOLUTIL not defined +#endif + /** * Initializes the library. This must be called at least once before any of * the functions or classes in this library can be used. Normally it will be diff --git a/dtool/src/prc/config_prc.cxx b/dtool/src/prc/config_prc.cxx index f2a57d1993..2728e642bd 100644 --- a/dtool/src/prc/config_prc.cxx +++ b/dtool/src/prc/config_prc.cxx @@ -16,6 +16,10 @@ #include "configVariableEnum.h" #include "pandaFileStreamBuf.h" +#if !defined(CPPPARSER) && !defined(BUILDING_DTOOL_PRC) + #error Buildsystem error: BUILDING_DTOOL_PRC not defined +#endif + NotifyCategoryDef(prc, ""); ALIGN_16BYTE ConfigVariableBool assert_abort diff --git a/panda/metalibs/panda/panda.cxx b/panda/metalibs/panda/panda.cxx index 67620867e3..d3a3b0c24a 100644 --- a/panda/metalibs/panda/panda.cxx +++ b/panda/metalibs/panda/panda.cxx @@ -20,6 +20,10 @@ #include "checkPandaVersion.h" +#if !defined(CPPPARSER) && !defined(BUILDING_LIBPANDA) + #error Buildsystem error: BUILDING_LIBPANDA not defined +#endif + /** * Initializes the library. This must be called at least once before any of * the functions or classes in this library can be used. Normally it will be diff --git a/panda/src/audio/config_audio.cxx b/panda/src/audio/config_audio.cxx index e59b3c73ef..0f58e56a32 100644 --- a/panda/src/audio/config_audio.cxx +++ b/panda/src/audio/config_audio.cxx @@ -21,6 +21,10 @@ #include "nullAudioSound.h" #include "string_utils.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_AUDIO) + #error Buildsystem error: BUILDING_PANDA_AUDIO not defined +#endif + Configure(config_audio); NotifyCategoryDef(audio, ""); diff --git a/panda/src/audiotraits/config_fmodAudio.cxx b/panda/src/audiotraits/config_fmodAudio.cxx index affc593636..f0a188fbc5 100644 --- a/panda/src/audiotraits/config_fmodAudio.cxx +++ b/panda/src/audiotraits/config_fmodAudio.cxx @@ -19,6 +19,10 @@ #include "pandaSystem.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_FMOD_AUDIO) + #error Buildsystem error: BUILDING_FMOD_AUDIO not defined +#endif + ConfigureDef(config_fmodAudio); NotifyCategoryDef(fmodAudio, ":audio"); diff --git a/panda/src/audiotraits/config_milesAudio.cxx b/panda/src/audiotraits/config_milesAudio.cxx index 6f3f29dddb..6877b3700e 100644 --- a/panda/src/audiotraits/config_milesAudio.cxx +++ b/panda/src/audiotraits/config_milesAudio.cxx @@ -22,6 +22,10 @@ #include "pandaSystem.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_MILES_AUDIO) + #error Buildsystem error: BUILDING_MILES_AUDIO not defined +#endif + ConfigureDef(config_milesAudio); NotifyCategoryDef(milesAudio, ":audio"); diff --git a/panda/src/audiotraits/config_openalAudio.cxx b/panda/src/audiotraits/config_openalAudio.cxx index a3340477c2..ad51368d75 100644 --- a/panda/src/audiotraits/config_openalAudio.cxx +++ b/panda/src/audiotraits/config_openalAudio.cxx @@ -18,6 +18,10 @@ #include "pandaSystem.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_OPENAL_AUDIO) + #error Buildsystem error: BUILDING_OPENAL_AUDIO not defined +#endif + ConfigureDef(config_openalAudio); NotifyCategoryDef(openalAudio, ":audio"); diff --git a/panda/src/awesomium/config_awesomium.cxx b/panda/src/awesomium/config_awesomium.cxx index 4462dce983..95ce655fe7 100644 --- a/panda/src/awesomium/config_awesomium.cxx +++ b/panda/src/awesomium/config_awesomium.cxx @@ -18,6 +18,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAAWESOMIUM) + #error Buildsystem error: BUILDING_PANDAAWESOMIUM not defined +#endif + Configure(config_awesomium); NotifyCategoryDef(awesomium, ""); diff --git a/panda/src/bullet/config_bullet.cxx b/panda/src/bullet/config_bullet.cxx index 9878a9f038..4e228427b9 100644 --- a/panda/src/bullet/config_bullet.cxx +++ b/panda/src/bullet/config_bullet.cxx @@ -56,6 +56,10 @@ extern ContactDestroyedCallback gContactDestroyedCallback; #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDABULLET) + #error Buildsystem error: BUILDING_PANDABULLET not defined +#endif + Configure(config_bullet); NotifyCategoryDef(bullet, ""); diff --git a/panda/src/chan/config_chan.cxx b/panda/src/chan/config_chan.cxx index 9772f2d661..8992cfbbf9 100644 --- a/panda/src/chan/config_chan.cxx +++ b/panda/src/chan/config_chan.cxx @@ -34,6 +34,10 @@ #include "luse.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_CHAN) + #error Buildsystem error: BUILDING_PANDA_CHAN not defined +#endif + Configure(config_chan); NotifyCategoryDef(chan, ""); diff --git a/panda/src/char/config_char.cxx b/panda/src/char/config_char.cxx index f3a8cc6836..5d536bfc4c 100644 --- a/panda/src/char/config_char.cxx +++ b/panda/src/char/config_char.cxx @@ -21,6 +21,10 @@ #include "jointVertexTransform.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_CHAR) + #error Buildsystem error: BUILDING_PANDA_CHAR not defined +#endif + Configure(config_char); NotifyCategoryDef(char, ""); diff --git a/panda/src/cocoadisplay/config_cocoadisplay.mm b/panda/src/cocoadisplay/config_cocoadisplay.mm index 42f2f98a8f..c88177cf66 100644 --- a/panda/src/cocoadisplay/config_cocoadisplay.mm +++ b/panda/src/cocoadisplay/config_cocoadisplay.mm @@ -20,6 +20,10 @@ #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGL) + #error Buildsystem error: BUILDING_PANDAGL not defined +#endif + Configure(config_cocoadisplay); NotifyCategoryDef(cocoadisplay, "display"); diff --git a/panda/src/collada/config_collada.cxx b/panda/src/collada/config_collada.cxx index 81404110f2..fa97023656 100644 --- a/panda/src/collada/config_collada.cxx +++ b/panda/src/collada/config_collada.cxx @@ -17,6 +17,10 @@ #include "loaderFileTypeDae.h" #include "loaderFileTypeRegistry.h" +#if !defined(CPPPARSER) && !defined(BUILDING_COLLADA) + #error Buildsystem error: BUILDING_COLLADA not defined +#endif + ConfigureDef(config_collada); NotifyCategoryDef(collada, ""); diff --git a/panda/src/collide/config_collide.cxx b/panda/src/collide/config_collide.cxx index e1999cd147..01d517df04 100644 --- a/panda/src/collide/config_collide.cxx +++ b/panda/src/collide/config_collide.cxx @@ -42,6 +42,10 @@ #include "collisionVisualizer.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_COLLIDE) + #error Buildsystem error: BUILDING_PANDA_COLLIDE not defined +#endif + Configure(config_collide); NotifyCategoryDef(collide, ""); diff --git a/panda/src/cull/config_cull.cxx b/panda/src/cull/config_cull.cxx index a3b4b4881a..452c69ea0c 100644 --- a/panda/src/cull/config_cull.cxx +++ b/panda/src/cull/config_cull.cxx @@ -22,6 +22,10 @@ #include "cullBinManager.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_CULL) + #error Buildsystem error: BUILDING_PANDA_CULL not defined +#endif + ConfigureDef(config_cull); NotifyCategoryDef(cull, ""); diff --git a/panda/src/device/config_device.cxx b/panda/src/device/config_device.cxx index 51f1159f33..eb8d1a2f10 100644 --- a/panda/src/device/config_device.cxx +++ b/panda/src/device/config_device.cxx @@ -27,6 +27,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DEVICE) + #error Buildsystem error: BUILDING_PANDA_DEVICE not defined +#endif + Configure(config_device); NotifyCategoryDef(device, ""); diff --git a/panda/src/dgraph/config_dgraph.cxx b/panda/src/dgraph/config_dgraph.cxx index fbaec8b78d..3c91aeea18 100644 --- a/panda/src/dgraph/config_dgraph.cxx +++ b/panda/src/dgraph/config_dgraph.cxx @@ -17,6 +17,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DGRAPH) + #error Buildsystem error: BUILDING_PANDA_DGRAPH not defined +#endif + Configure(config_dgraph); NotifyCategoryDef(dgraph, ""); diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index 391a7e8676..0d3fea3937 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -31,6 +31,10 @@ #include "subprocessWindow.h" #include "windowHandle.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DISPLAY) + #error Buildsystem error: BUILDING_PANDA_DISPLAY not defined +#endif + ConfigureDef(config_display); NotifyCategoryDef(display, ""); NotifyCategoryDef(gsg, display_cat); diff --git a/panda/src/distort/config_distort.cxx b/panda/src/distort/config_distort.cxx index 7dc7055c3c..eaa0147dae 100644 --- a/panda/src/distort/config_distort.cxx +++ b/panda/src/distort/config_distort.cxx @@ -20,6 +20,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAFX) + #error Buildsystem error: BUILDING_PANDAFX not defined +#endif + Configure(config_distort); NotifyCategoryDef(distort, ""); diff --git a/panda/src/downloader/config_downloader.cxx b/panda/src/downloader/config_downloader.cxx index c1db208d01..9c806dba07 100644 --- a/panda/src/downloader/config_downloader.cxx +++ b/panda/src/downloader/config_downloader.cxx @@ -19,6 +19,10 @@ #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAEXPRESS) + #error Buildsystem error: BUILDING_PANDAEXPRESS not defined +#endif + ConfigureDef(config_downloader); NotifyCategoryDef(downloader, ""); diff --git a/panda/src/dxgsg9/config_dxgsg9.cxx b/panda/src/dxgsg9/config_dxgsg9.cxx index 64831d08c9..d5777602db 100644 --- a/panda/src/dxgsg9/config_dxgsg9.cxx +++ b/panda/src/dxgsg9/config_dxgsg9.cxx @@ -27,6 +27,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDADX) + #error Buildsystem error: BUILDING_PANDADX not defined +#endif + DToolConfigure(config_dxgsg9); NotifyCategoryDef(dxgsg9, ":display:gsg"); NotifyCategoryDef(wdxdisplay9, "display"); diff --git a/panda/src/dxml/config_dxml.cxx b/panda/src/dxml/config_dxml.cxx index e6691bc676..7e25a58c3a 100644 --- a/panda/src/dxml/config_dxml.cxx +++ b/panda/src/dxml/config_dxml.cxx @@ -19,6 +19,10 @@ BEGIN_PUBLISH #include "tinyxml.h" END_PUBLISH +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DXML) + #error Buildsystem error: BUILDING_PANDA_DXML not defined +#endif + Configure(config_dxml); NotifyCategoryDef(dxml, ""); diff --git a/panda/src/egg/config_egg.cxx b/panda/src/egg/config_egg.cxx index 83d11dad04..65e08efcbc 100644 --- a/panda/src/egg/config_egg.cxx +++ b/panda/src/egg/config_egg.cxx @@ -58,6 +58,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAEGG) + #error Buildsystem error: BUILDING_PANDAEGG not defined +#endif + Configure(config_egg); NotifyCategoryDef(egg, ""); diff --git a/panda/src/egg2pg/config_egg2pg.cxx b/panda/src/egg2pg/config_egg2pg.cxx index 79c3e40a2b..f864a8f4d8 100644 --- a/panda/src/egg2pg/config_egg2pg.cxx +++ b/panda/src/egg2pg/config_egg2pg.cxx @@ -20,6 +20,10 @@ #include "configVariableCore.h" #include "eggRenderState.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAEGG) + #error Buildsystem error: BUILDING_PANDAEGG not defined +#endif + ConfigureDef(config_egg2pg); NotifyCategoryDef(egg2pg, ""); diff --git a/panda/src/egldisplay/config_egldisplay.cxx b/panda/src/egldisplay/config_egldisplay.cxx index 809e73916c..9f9bf13770 100644 --- a/panda/src/egldisplay/config_egldisplay.cxx +++ b/panda/src/egldisplay/config_egldisplay.cxx @@ -19,6 +19,10 @@ #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGLES) && !defined(BUILDING_PANDAGLES2) + #error Buildsystem error: BUILDING_PANDAGLES(2) not defined +#endif + Configure(config_egldisplay); NotifyCategoryDef(egldisplay, "display"); diff --git a/panda/src/event/config_event.cxx b/panda/src/event/config_event.cxx index 85727d2d7c..c7f1c8eecc 100644 --- a/panda/src/event/config_event.cxx +++ b/panda/src/event/config_event.cxx @@ -27,6 +27,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_EVENT) + #error Buildsystem error: BUILDING_PANDA_EVENT not defined +#endif + Configure(config_event); NotifyCategoryDef(event, ""); NotifyCategoryDef(task, ""); diff --git a/panda/src/express/config_express.cxx b/panda/src/express/config_express.cxx index 042b6d8db1..d86e300436 100644 --- a/panda/src/express/config_express.cxx +++ b/panda/src/express/config_express.cxx @@ -36,6 +36,10 @@ #include "dconfig.h" #include "streamWrapper.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAEXPRESS) + #error Buildsystem error: BUILDING_PANDAEXPRESS not defined +#endif + ConfigureDef(config_express); NotifyCategoryDef(express, ""); NotifyCategoryDef(clock, ":express"); diff --git a/panda/src/ffmpeg/config_ffmpeg.cxx b/panda/src/ffmpeg/config_ffmpeg.cxx index f0d6a5518e..8cbc9f51ec 100644 --- a/panda/src/ffmpeg/config_ffmpeg.cxx +++ b/panda/src/ffmpeg/config_ffmpeg.cxx @@ -24,6 +24,10 @@ extern "C" { #include "libavcodec/avcodec.h" } +#if !defined(CPPPARSER) && !defined(BUILDING_FFMPEG) + #error Buildsystem error: BUILDING_FFMPEG not defined +#endif + ConfigureDef(config_ffmpeg); NotifyCategoryDef(ffmpeg, ""); diff --git a/panda/src/framework/config_framework.cxx b/panda/src/framework/config_framework.cxx index e5c5d42e70..8746d5bff0 100644 --- a/panda/src/framework/config_framework.cxx +++ b/panda/src/framework/config_framework.cxx @@ -22,6 +22,10 @@ #include "checkPandaVersion.h" +#if !defined(CPPPARSER) && !defined(BUILDING_FRAMEWORK) + #error Buildsystem error: BUILDING_FRAMEWORK not defined +#endif + Configure(config_framework); NotifyCategoryDef(framework, ""); diff --git a/panda/src/gles2gsg/config_gles2gsg.cxx b/panda/src/gles2gsg/config_gles2gsg.cxx index 3935783653..aee9c925fb 100644 --- a/panda/src/gles2gsg/config_gles2gsg.cxx +++ b/panda/src/gles2gsg/config_gles2gsg.cxx @@ -16,6 +16,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGLES2) + #error Buildsystem error: BUILDING_PANDAGLES2 not defined +#endif + ConfigureDef(config_gles2gsg); NotifyCategoryDef(gles2gsg, ":display:gsg"); diff --git a/panda/src/glesgsg/config_glesgsg.cxx b/panda/src/glesgsg/config_glesgsg.cxx index a1c0496cfc..b30cf23322 100644 --- a/panda/src/glesgsg/config_glesgsg.cxx +++ b/panda/src/glesgsg/config_glesgsg.cxx @@ -16,6 +16,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGLES) + #error Buildsystem error: BUILDING_PANDAGLES not defined +#endif + ConfigureDef(config_glesgsg); NotifyCategoryDef(glesgsg, ":display:gsg"); diff --git a/panda/src/glgsg/config_glgsg.cxx b/panda/src/glgsg/config_glgsg.cxx index 8f98e49717..6e60169acc 100644 --- a/panda/src/glgsg/config_glgsg.cxx +++ b/panda/src/glgsg/config_glgsg.cxx @@ -16,6 +16,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGL) + #error Buildsystem error: BUILDING_PANDAGL not defined +#endif + ConfigureDef(config_glgsg); NotifyCategoryDef(glgsg, ":display:gsg"); diff --git a/panda/src/glxdisplay/config_glxdisplay.cxx b/panda/src/glxdisplay/config_glxdisplay.cxx index b253c0abf9..fffcd2c264 100644 --- a/panda/src/glxdisplay/config_glxdisplay.cxx +++ b/panda/src/glxdisplay/config_glxdisplay.cxx @@ -23,6 +23,10 @@ #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGL) + #error Buildsystem error: BUILDING_PANDAGL not defined +#endif + Configure(config_glxdisplay); NotifyCategoryDef(glxdisplay, "display"); diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index 058d7463a4..d152f6ebcf 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -70,6 +70,10 @@ #include "dconfig.h" #include "string_utils.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_GOBJ) + #error Buildsystem error: BUILDING_PANDA_GOBJ not defined +#endif + Configure(config_gobj); NotifyCategoryDef(gobj, ""); NotifyCategoryDef(shader, ""); diff --git a/panda/src/grutil/config_grutil.cxx b/panda/src/grutil/config_grutil.cxx index 94613f4da6..337abd11bb 100644 --- a/panda/src/grutil/config_grutil.cxx +++ b/panda/src/grutil/config_grutil.cxx @@ -27,6 +27,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_GRUTIL) + #error Buildsystem error: BUILDING_PANDA_GRUTIL not defined +#endif + Configure(config_grutil); NotifyCategoryDef(grutil, ""); diff --git a/panda/src/gsgbase/config_gsgbase.cxx b/panda/src/gsgbase/config_gsgbase.cxx index 2e5ce60aa9..52da83f9c8 100644 --- a/panda/src/gsgbase/config_gsgbase.cxx +++ b/panda/src/gsgbase/config_gsgbase.cxx @@ -17,6 +17,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_GSGBASE) + #error Buildsystem error: BUILDING_PANDA_GSGBASE not defined +#endif + Configure(config_gsgbase); ConfigureFn(config_gsgbase) { diff --git a/panda/src/linmath/config_linmath.cxx b/panda/src/linmath/config_linmath.cxx index 93cf571c40..fb0942aa55 100644 --- a/panda/src/linmath/config_linmath.cxx +++ b/panda/src/linmath/config_linmath.cxx @@ -17,6 +17,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_LINMATH) + #error Buildsystem error: BUILDING_PANDA_LINMATH not defined +#endif + Configure(config_linmath); NotifyCategoryDef(linmath, ""); diff --git a/panda/src/mathutil/config_mathutil.cxx b/panda/src/mathutil/config_mathutil.cxx index 2226b67946..2084b2b670 100644 --- a/panda/src/mathutil/config_mathutil.cxx +++ b/panda/src/mathutil/config_mathutil.cxx @@ -26,6 +26,10 @@ #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_MATHUTIL) + #error Buildsystem error: BUILDING_PANDA_MATHUTIL not defined +#endif + Configure(config_mathutil); NotifyCategoryDef(mathutil, ""); diff --git a/panda/src/movies/config_movies.cxx b/panda/src/movies/config_movies.cxx index 4884c15f5b..93448cfe8d 100644 --- a/panda/src/movies/config_movies.cxx +++ b/panda/src/movies/config_movies.cxx @@ -32,6 +32,10 @@ #include "wavAudio.h" #include "wavAudioCursor.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_MOVIES) + #error Buildsystem error: BUILDING_PANDA_MOVIES not defined +#endif + ConfigureDef(config_movies); NotifyCategoryDef(movies, ""); diff --git a/panda/src/nativenet/config_nativenet.cxx b/panda/src/nativenet/config_nativenet.cxx index c74a8ca6e2..172e56afa8 100644 --- a/panda/src/nativenet/config_nativenet.cxx +++ b/panda/src/nativenet/config_nativenet.cxx @@ -26,6 +26,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_NATIVENET) + #error Buildsystem error: BUILDING_PANDA_NATIVENET not defined +#endif + Configure(config_nativenet); NotifyCategoryDef(nativenet, ""); diff --git a/panda/src/net/config_net.cxx b/panda/src/net/config_net.cxx index aafea6fc49..ae717bb580 100644 --- a/panda/src/net/config_net.cxx +++ b/panda/src/net/config_net.cxx @@ -18,6 +18,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_NET) + #error Buildsystem error: BUILDING_PANDA_NET not defined +#endif + Configure(config_net); NotifyCategoryDef(net, ""); diff --git a/panda/src/ode/config_ode.cxx b/panda/src/ode/config_ode.cxx index 1994fe1254..214281d579 100644 --- a/panda/src/ode/config_ode.cxx +++ b/panda/src/ode/config_ode.cxx @@ -47,6 +47,10 @@ #include "odeCollisionEntry.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAODE) + #error Buildsystem error: BUILDING_PANDAODE not defined +#endif + Configure(config_ode); NotifyCategoryDef(ode, ""); NotifyCategoryDef(odeworld, "ode"); diff --git a/panda/src/osxdisplay/config_osxdisplay.cxx b/panda/src/osxdisplay/config_osxdisplay.cxx index 943fe57937..4ac68f5e58 100644 --- a/panda/src/osxdisplay/config_osxdisplay.cxx +++ b/panda/src/osxdisplay/config_osxdisplay.cxx @@ -20,6 +20,10 @@ #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGL) + #error Buildsystem error: BUILDING_PANDAGL not defined +#endif + Configure(config_osxdisplay); NotifyCategoryDef(osxdisplay, "display"); diff --git a/panda/src/parametrics/config_parametrics.cxx b/panda/src/parametrics/config_parametrics.cxx index 93a6e3841f..2b07e493bd 100644 --- a/panda/src/parametrics/config_parametrics.cxx +++ b/panda/src/parametrics/config_parametrics.cxx @@ -22,6 +22,10 @@ #include "ropeNode.h" #include "sheetNode.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PARAMETRICS) + #error Buildsystem error: BUILDING_PANDA_PARAMETRICS not defined +#endif + Configure(config_parametrics); NotifyCategoryDef(parametrics, ""); diff --git a/panda/src/particlesystem/config_particlesystem.cxx b/panda/src/particlesystem/config_particlesystem.cxx index 9c2d9e6a09..0eba6c33f1 100644 --- a/panda/src/particlesystem/config_particlesystem.cxx +++ b/panda/src/particlesystem/config_particlesystem.cxx @@ -16,6 +16,10 @@ #include "geomParticleRenderer.h" #include "geomNode.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAPHYSICS) + #error Buildsystem error: BUILDING_PANDAPHYSICS not defined +#endif + ConfigureDef(config_particlesystem); NotifyCategoryDef(particlesystem, ""); diff --git a/panda/src/pgraph/config_pgraph.cxx b/panda/src/pgraph/config_pgraph.cxx index 237c1d0011..54fa621f7b 100644 --- a/panda/src/pgraph/config_pgraph.cxx +++ b/panda/src/pgraph/config_pgraph.cxx @@ -92,6 +92,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PGRAPH) + #error Buildsystem error: BUILDING_PANDA_PGRAPH not defined +#endif + ConfigureDef(config_pgraph); NotifyCategoryDef(pgraph, ""); NotifyCategoryDef(loader, ""); diff --git a/panda/src/pgraphnodes/config_pgraphnodes.cxx b/panda/src/pgraphnodes/config_pgraphnodes.cxx index f512110858..3879a980b3 100644 --- a/panda/src/pgraphnodes/config_pgraphnodes.cxx +++ b/panda/src/pgraphnodes/config_pgraphnodes.cxx @@ -37,6 +37,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PGRAPHNODES) + #error Buildsystem error: BUILDING_PANDA_PGRAPHNODES not defined +#endif + ConfigureDef(config_pgraphnodes); NotifyCategoryDef(pgraphnodes, ""); diff --git a/panda/src/pgui/config_pgui.cxx b/panda/src/pgui/config_pgui.cxx index 7a1682cc96..c2c3e72405 100644 --- a/panda/src/pgui/config_pgui.cxx +++ b/panda/src/pgui/config_pgui.cxx @@ -28,6 +28,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PGUI) + #error Buildsystem error: BUILDING_PANDA_PGUI not defined +#endif + Configure(config_pgui); NotifyCategoryDef(pgui, ""); diff --git a/panda/src/physics/config_physics.cxx b/panda/src/physics/config_physics.cxx index c0db4dcdf4..5ce5c905f0 100644 --- a/panda/src/physics/config_physics.cxx +++ b/panda/src/physics/config_physics.cxx @@ -26,6 +26,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAPHYSICS) + #error Buildsystem error: BUILDING_PANDAPHYSICS not defined +#endif + ConfigureDef(config_physics); NotifyCategoryDef(physics, ""); diff --git a/panda/src/physx/config_physx.cxx b/panda/src/physx/config_physx.cxx index e7a4a653e1..4880e37e88 100644 --- a/panda/src/physx/config_physx.cxx +++ b/panda/src/physx/config_physx.cxx @@ -67,6 +67,10 @@ #include "physxWheel.h" #include "physxWheelShape.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAPHYSX) + #error Buildsystem error: BUILDING_PANDAPHYSX not defined +#endif + ConfigureDef(config_physx); NotifyCategoryDef(physx, ""); diff --git a/panda/src/pipeline/config_pipeline.cxx b/panda/src/pipeline/config_pipeline.cxx index 6dc24178f0..8f82307c86 100644 --- a/panda/src/pipeline/config_pipeline.cxx +++ b/panda/src/pipeline/config_pipeline.cxx @@ -20,6 +20,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PIPELINE) + #error Buildsystem error: BUILDING_PANDA_PIPELINE not defined +#endif + ConfigureDef(config_pipeline); NotifyCategoryDef(pipeline, ""); NotifyCategoryDef(thread, ""); diff --git a/panda/src/pnmimage/config_pnmimage.cxx b/panda/src/pnmimage/config_pnmimage.cxx index 1cb8b24bf8..5bb734cf85 100644 --- a/panda/src/pnmimage/config_pnmimage.cxx +++ b/panda/src/pnmimage/config_pnmimage.cxx @@ -17,6 +17,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PNMIMAGE) + #error Buildsystem error: BUILDING_PANDA_PNMIMAGE not defined +#endif + Configure(config_pnmimage); NotifyCategoryDef(pnmimage, ""); diff --git a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx index 2fc23d574a..b115aa5213 100644 --- a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx +++ b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx @@ -32,6 +32,10 @@ #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PNMIMAGETYPES) + #error Buildsystem error: BUILDING_PANDA_PNMIMAGETYPES not defined +#endif + Configure(config_pnmimagetypes); NotifyCategoryDefName(pnmimage_sgi, "sgi", pnmimage_cat); NotifyCategoryDefName(pnmimage_tga, "tga", pnmimage_cat); diff --git a/panda/src/pnmtext/config_pnmtext.cxx b/panda/src/pnmtext/config_pnmtext.cxx index b806b8d048..a0a627aca7 100644 --- a/panda/src/pnmtext/config_pnmtext.cxx +++ b/panda/src/pnmtext/config_pnmtext.cxx @@ -16,6 +16,10 @@ #include "dconfig.h" #include "freetypeFace.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PNMTEXT) + #error Buildsystem error: BUILDING_PANDA_PNMTEXT not defined +#endif + Configure(config_pnmtext); NotifyCategoryDef(pnmtext, ""); diff --git a/panda/src/pstatclient/config_pstats.cxx b/panda/src/pstatclient/config_pstats.cxx index 4a25d9e85c..dcd49a4365 100644 --- a/panda/src/pstatclient/config_pstats.cxx +++ b/panda/src/pstatclient/config_pstats.cxx @@ -15,6 +15,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PSTATCLIENT) + #error Buildsystem error: BUILDING_PANDA_PSTATCLIENT not defined +#endif + ConfigureDef(config_pstats); NotifyCategoryDef(pstats, ""); diff --git a/panda/src/putil/config_util.cxx b/panda/src/putil/config_util.cxx index 516c98ce6a..c5956adc2b 100644 --- a/panda/src/putil/config_util.cxx +++ b/panda/src/putil/config_util.cxx @@ -47,6 +47,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PUTIL) + #error Buildsystem error: BUILDING_PANDA_PUTIL not defined +#endif + ConfigureDef(config_util); NotifyCategoryDef(util, ""); NotifyCategoryDef(bam, util_cat); diff --git a/panda/src/recorder/config_recorder.cxx b/panda/src/recorder/config_recorder.cxx index 6057362134..97335e17cd 100644 --- a/panda/src/recorder/config_recorder.cxx +++ b/panda/src/recorder/config_recorder.cxx @@ -22,6 +22,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_RECORDER) + #error Buildsystem error: BUILDING_PANDA_RECORDER not defined +#endif + ConfigureDef(config_recorder); NotifyCategoryDef(recorder, ""); diff --git a/panda/src/rocket/config_rocket.cxx b/panda/src/rocket/config_rocket.cxx index b4a43f8127..4de7bf3e28 100644 --- a/panda/src/rocket/config_rocket.cxx +++ b/panda/src/rocket/config_rocket.cxx @@ -26,6 +26,10 @@ #include #undef Factory +#if !defined(CPPPARSER) && !defined(BUILDING_ROCKET) + #error Buildsystem error: BUILDING_ROCKET not defined +#endif + Configure(config_rocket); NotifyCategoryDef(rocket, ""); diff --git a/panda/src/skel/config_skel.cxx b/panda/src/skel/config_skel.cxx index 2c307d3270..5fa6f6595c 100644 --- a/panda/src/skel/config_skel.cxx +++ b/panda/src/skel/config_skel.cxx @@ -16,6 +16,10 @@ #include "typedSkel.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDASKEL) + #error Buildsystem error: BUILDING_PANDASKEL not defined +#endif + Configure(config_skel); NotifyCategoryDef(skel, ""); diff --git a/panda/src/speedtree/config_speedtree.cxx b/panda/src/speedtree/config_speedtree.cxx index fd4eb3cd5a..b386bcb59a 100644 --- a/panda/src/speedtree/config_speedtree.cxx +++ b/panda/src/speedtree/config_speedtree.cxx @@ -21,6 +21,10 @@ #include "loaderFileTypeRegistry.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDASPEEDTREE) + #error Buildsystem error: BUILDING_PANDASPEEDTREE not defined +#endif + ConfigureDef(config_speedtree); NotifyCategoryDef(speedtree, ""); diff --git a/panda/src/text/config_text.cxx b/panda/src/text/config_text.cxx index 9475eabf55..2fff80cd0c 100644 --- a/panda/src/text/config_text.cxx +++ b/panda/src/text/config_text.cxx @@ -27,6 +27,10 @@ #include "dconfig.h" #include "config_express.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_TEXT) + #error Buildsystem error: BUILDING_PANDA_TEXT not defined +#endif + Configure(config_text); NotifyCategoryDef(text, ""); diff --git a/panda/src/tform/config_tform.cxx b/panda/src/tform/config_tform.cxx index 1bbb3a7e57..b8a578d07c 100644 --- a/panda/src/tform/config_tform.cxx +++ b/panda/src/tform/config_tform.cxx @@ -25,6 +25,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_TFORM) + #error Buildsystem error: BUILDING_PANDA_TFORM not defined +#endif + Configure(config_tform); NotifyCategoryDef(tform, ""); diff --git a/panda/src/tinydisplay/config_tinydisplay.cxx b/panda/src/tinydisplay/config_tinydisplay.cxx index 228be9a1ee..31ef112ee5 100644 --- a/panda/src/tinydisplay/config_tinydisplay.cxx +++ b/panda/src/tinydisplay/config_tinydisplay.cxx @@ -29,6 +29,10 @@ #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_TINYDISPLAY) + #error Buildsystem error: BUILDING_TINYDISPLAY not defined +#endif + Configure(config_tinydisplay); NotifyCategoryDef(tinydisplay, "display"); diff --git a/panda/src/vision/config_vision.cxx b/panda/src/vision/config_vision.cxx index 50d4b8aeb3..ffe3719962 100644 --- a/panda/src/vision/config_vision.cxx +++ b/panda/src/vision/config_vision.cxx @@ -23,6 +23,10 @@ #include "texturePool.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_VISION) + #error Buildsystem error: BUILDING_VISION not defined +#endif + Configure(config_vision); NotifyCategoryDef(vision, ""); diff --git a/panda/src/vrpn/config_vrpn.cxx b/panda/src/vrpn/config_vrpn.cxx index 77d2b198ee..cc577bd328 100644 --- a/panda/src/vrpn/config_vrpn.cxx +++ b/panda/src/vrpn/config_vrpn.cxx @@ -21,6 +21,10 @@ #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_VRPN) + #error Buildsystem error: BUILDING_VRPN not defined +#endif + Configure(config_vrpn); NotifyCategoryDef(vrpn, ""); diff --git a/panda/src/wgldisplay/config_wgldisplay.cxx b/panda/src/wgldisplay/config_wgldisplay.cxx index 9cd4a149f3..93dc2ad36c 100644 --- a/panda/src/wgldisplay/config_wgldisplay.cxx +++ b/panda/src/wgldisplay/config_wgldisplay.cxx @@ -20,6 +20,10 @@ #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGL) + #error Buildsystem error: BUILDING_PANDAGL not defined +#endif + Configure(config_wgldisplay); NotifyCategoryDef(wgldisplay, "display"); diff --git a/panda/src/windisplay/config_windisplay.cxx b/panda/src/windisplay/config_windisplay.cxx index 65447af18d..1af5cf95da 100644 --- a/panda/src/windisplay/config_windisplay.cxx +++ b/panda/src/windisplay/config_windisplay.cxx @@ -16,6 +16,10 @@ #include "winGraphicsWindow.h" #include "dconfig.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAWIN) + #error Buildsystem error: BUILDING_PANDAWIN not defined +#endif + Configure(config_windisplay); NotifyCategoryDef(windisplay, "display"); diff --git a/panda/src/x11display/config_x11display.cxx b/panda/src/x11display/config_x11display.cxx index c2b89c42b2..bca59d5a17 100644 --- a/panda/src/x11display/config_x11display.cxx +++ b/panda/src/x11display/config_x11display.cxx @@ -18,6 +18,10 @@ #include "dconfig.h" #include "pandaSystem.h" +#if !defined(CPPPARSER) && !defined(BUILDING_PANDAX11) + #error Buildsystem error: BUILDING_PANDAX11 not defined +#endif + Configure(config_x11display); NotifyCategoryDef(x11display, "display"); From 4eb250cb87524907357714703f5bec194fa505cb Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 25 Mar 2018 21:54:21 -0600 Subject: [PATCH 23/55] dcparser: Write ranged-blob parameters correctly --- direct/src/dcparser/dcSimpleParameter.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/direct/src/dcparser/dcSimpleParameter.cxx b/direct/src/dcparser/dcSimpleParameter.cxx index ceead33a5c..bd1d6cd086 100644 --- a/direct/src/dcparser/dcSimpleParameter.cxx +++ b/direct/src/dcparser/dcSimpleParameter.cxx @@ -2238,6 +2238,8 @@ output_instance(ostream &out, bool brief, const string &prename, } break; + case ST_blob: + case ST_blob32: case ST_string: if (!_uint_range.is_empty()) { out << "("; From 63b1e4497776509d3ead67c4d4e2f0015b894ad4 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 29 Mar 2018 14:11:21 +0200 Subject: [PATCH 24/55] framework: fix pview crash when exit is called inside render_frame This can happen when a system event (eg. on macOS) triggers a terminate from within process_events. This is a workaround for a common error; the proper fix is not to put PandaFramework in the global scope. --- panda/src/framework/pandaFramework.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/panda/src/framework/pandaFramework.cxx b/panda/src/framework/pandaFramework.cxx index d5c6b49829..30968e70b3 100644 --- a/panda/src/framework/pandaFramework.cxx +++ b/panda/src/framework/pandaFramework.cxx @@ -1391,11 +1391,17 @@ AsyncTask::DoneStatus PandaFramework:: task_igloop(GenericAsyncTask *task, void *data) { PandaFramework *self = (PandaFramework *)data; - if (self->_engine != (GraphicsEngine *)NULL) { - self->_engine->render_frame(); + // This exists to work around a crash that happens when the PandaFramework + // is destructed because the application is exited during render_frame(). + // The proper fix is not to instantiate PandaFramework in the global scope + // but many C++ applications (including pview) do this anyway. + PT(GraphicsEngine) engine = self->_engine; + if (engine != nullptr) { + engine->render_frame(); + return AsyncTask::DS_cont; + } else { + return AsyncTask::DS_done; } - - return AsyncTask::DS_cont; } /** From 95bffa8503714ba84091893adeb97c6557183afa Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 29 Mar 2018 14:17:39 +0200 Subject: [PATCH 25/55] Fix crash when typing unicode characters above 7fff into text field Can be reproduced when typing Shift+AltGr+5 into a DirectEntry on macOS. --- panda/src/event/buttonEvent.I | 2 +- panda/src/event/buttonEvent.cxx | 4 ++-- panda/src/event/buttonEvent.h | 4 ++-- panda/src/tform/mouseWatcherParameter.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/panda/src/event/buttonEvent.I b/panda/src/event/buttonEvent.I index 16c68cc0bc..41bea9f2d5 100644 --- a/panda/src/event/buttonEvent.I +++ b/panda/src/event/buttonEvent.I @@ -41,7 +41,7 @@ ButtonEvent(ButtonHandle button, ButtonEvent::Type type, double time) : * */ INLINE ButtonEvent:: -ButtonEvent(short keycode, double time) : +ButtonEvent(int keycode, double time) : _button(ButtonHandle::none()), _keycode(keycode), _highlight_start(0), diff --git a/panda/src/event/buttonEvent.cxx b/panda/src/event/buttonEvent.cxx index 7353ce7e54..38dbbffb6a 100644 --- a/panda/src/event/buttonEvent.cxx +++ b/panda/src/event/buttonEvent.cxx @@ -84,7 +84,7 @@ write_datagram(Datagram &dg) const { break; case T_keystroke: - dg.add_int16(_keycode); + dg.add_uint16(_keycode); break; case T_candidate: @@ -119,7 +119,7 @@ read_datagram(DatagramIterator &scan) { break; case T_keystroke: - _keycode = scan.get_int16(); + _keycode = scan.get_uint16(); break; case T_candidate: diff --git a/panda/src/event/buttonEvent.h b/panda/src/event/buttonEvent.h index e37c2fe2ad..d2e2b82176 100644 --- a/panda/src/event/buttonEvent.h +++ b/panda/src/event/buttonEvent.h @@ -86,7 +86,7 @@ public: INLINE ButtonEvent(); INLINE ButtonEvent(ButtonHandle button, Type type, double time = ClockObject::get_global_clock()->get_frame_time()); - INLINE ButtonEvent(short keycode, double time = ClockObject::get_global_clock()->get_frame_time()); + INLINE ButtonEvent(int keycode, double time = ClockObject::get_global_clock()->get_frame_time()); INLINE ButtonEvent(const wstring &candidate_string, size_t highlight_start, size_t highlight_end, size_t cursor_pos); INLINE ButtonEvent(const ButtonEvent ©); @@ -109,7 +109,7 @@ public: // _keycode will be filled in if type is T_keystroke. It will be the // Unicode character that was typed. - short _keycode; + int _keycode; // _candidate_string will be filled in if type is T_candidate. wstring _candidate_string; diff --git a/panda/src/tform/mouseWatcherParameter.h b/panda/src/tform/mouseWatcherParameter.h index bacb2a805b..1da5dcfc45 100644 --- a/panda/src/tform/mouseWatcherParameter.h +++ b/panda/src/tform/mouseWatcherParameter.h @@ -74,7 +74,7 @@ PUBLISHED: public: ButtonHandle _button; - short _keycode; + int _keycode; wstring _candidate_string; size_t _highlight_start; size_t _highlight_end; From 7062da944a3fdec34f1ed608bfad35fc7fcb2151 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 29 Mar 2018 14:22:14 +0200 Subject: [PATCH 26/55] cocoa: fix ability to type AltGr characters and dead keys It would seem that interpretKeyEvents/insertText would be the right way to do this, but while that does handle AltGr keys correctly, it does not handle dead keys at all. This approach seems to do the right things. --- panda/src/cocoadisplay/cocoaGraphicsWindow.h | 1 + panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 47 ++++++++++++++----- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.h b/panda/src/cocoadisplay/cocoaGraphicsWindow.h index 6432ecc3e8..de2bd8d61c 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.h +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.h @@ -87,6 +87,7 @@ private: NSWindow *_window; NSView *_view; NSUInteger _modifier_keys; + UInt32 _dead_key_state; CGDirectDisplayID _display; bool _mouse_hidden; bool _context_needs_update; diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 39ecf09162..4984c27062 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -625,6 +625,9 @@ open_window() { } _fb_properties = cocoagsg->get_fb_properties(); + // Reset dead key state. + _dead_key_state = 0; + // Get the initial mouse position. NSPoint pos = [_window mouseLocationOutsideOfEventStream]; NSPoint loc = [_view convertPoint:pos fromView:nil]; @@ -1391,6 +1394,8 @@ handle_foreground_event(bool foreground) { } } + _dead_key_state = 0; + WindowProperties properties; properties.set_foreground(foreground); system_changed_properties(properties); @@ -1564,25 +1569,43 @@ handle_key_event(NSEvent *event) { return; } + if ([event type] == NSKeyDown) { + // Translate it to a unicode character for keystrokes. I would use + // interpretKeyEvents and insertText, but that doesn't handle dead keys. + TISInputSourceRef input_source = TISCopyCurrentKeyboardInputSource(); + CFDataRef layout_data = (CFDataRef)TISGetInputSourceProperty(input_source, kTISPropertyUnicodeKeyLayoutData); + const UCKeyboardLayout *layout = (const UCKeyboardLayout *)CFDataGetBytePtr(layout_data); + + UInt32 modifier_state = (modifierFlags >> 16) & 0xFF; + UniChar ustr[8]; + UniCharCount length; + + UCKeyTranslate(layout, [event keyCode], kUCKeyActionDown, modifier_state, + LMGetKbdType(), 0, &_dead_key_state, sizeof(ustr), &length, ustr); + CFRelease(input_source); + + for (int i = 0; i < length; ++i) { + UniChar c = ustr[i]; + if (cocoadisplay_cat.is_spam()) { + cocoadisplay_cat.spam() + << "Handling keystroke, character " << (int)c; + if (c < 128 && isprint(c)) { + cocoadisplay_cat.spam(false) << " '" << (char)c << "'"; + } + cocoadisplay_cat.spam(false) << "\n"; + } + _input->keystroke(c); + } + } + NSString *str = [event charactersIgnoringModifiers]; if (str == nil || [str length] == 0) { return; } - nassertv([str length] == 1); + nassertv_always([str length] == 1); unichar c = [str characterAtIndex: 0]; ButtonHandle button = map_key(c); - - if (c < 0xF700 || c >= 0xF900) { - // If a down event and not a special function key, process it as keystroke - // as well. - if ([event type] == NSKeyDown) { - NSString *origstr = [event characters]; - c = [str characterAtIndex: 0]; - _input_devices[0].keystroke(c); - } - } - if (button == ButtonHandle::none()) { // That done, continue trying to find out the button handle. if ([str canBeConvertedToEncoding: NSASCIIStringEncoding]) { From 7830aab21d04d523aa564fb2cb6ad00c08e8fc5b Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Sun, 25 Feb 2018 22:26:09 -0600 Subject: [PATCH 27/55] cocoa: Fix unresponsive menubar, add default item for application menu. Closes #259 --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 23 ++++++++++++++++++- .../src/cocoadisplay/cocoaPandaAppDelegate.h | 22 ++++++++++++++++++ .../src/cocoadisplay/cocoaPandaAppDelegate.mm | 23 +++++++++++++++++++ .../cocoadisplay/p3cocoadisplay_composite1.mm | 1 + 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 panda/src/cocoadisplay/cocoaPandaAppDelegate.h create mode 100644 panda/src/cocoadisplay/cocoaPandaAppDelegate.mm diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 4984c27062..0d21a352bf 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -30,6 +30,7 @@ #import "cocoaPandaView.h" #import "cocoaPandaWindow.h" +#import "cocoaPandaAppDelegate.h" #import #import @@ -71,11 +72,31 @@ CocoaGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, if (NSApp == nil) { [CocoaPandaApp sharedApplication]; + CocoaPandaAppDelegate *delegate = [[CocoaPandaAppDelegate alloc] init]; + [NSApp setDelegate:delegate]; + #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; #endif + NSMenu *mainMenu = [[NSMenu alloc] init]; + + NSMenuItem *applicationMenuItem = [[NSMenuItem alloc] init]; + [mainMenu addItem:applicationMenuItem]; + + NSMenu *applicationMenu = [[NSMenu alloc] init]; + + NSMenuItem *item = [[NSMenuItem alloc] init]; + item.action = @selector(terminate:); + item.keyEquivalent = @"q"; + + NSString *appName = [NSRunningApplication currentApplication].localizedName; + item.title = [NSString stringWithFormat:@"Quit %@", appName]; + + [applicationMenu addItem:item]; + + [mainMenu setSubmenu:applicationMenu forItem:applicationMenuItem]; + [NSApp setMainMenu:mainMenu]; [NSApp finishLaunching]; - [NSApp activateIgnoringOtherApps:YES]; } GraphicsWindowInputDevice device = diff --git a/panda/src/cocoadisplay/cocoaPandaAppDelegate.h b/panda/src/cocoadisplay/cocoaPandaAppDelegate.h new file mode 100644 index 0000000000..b4af5deb55 --- /dev/null +++ b/panda/src/cocoadisplay/cocoaPandaAppDelegate.h @@ -0,0 +1,22 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file cocoaPandaAppDelegate.h + * @author Donny Lawrence + * @date 2018-02-25 + */ + +#import +#import + +// Cocoa is picky about where and when certain methods are called in the initialization process. +@interface CocoaPandaAppDelegate : NSObject + +- (void)applicationDidFinishLaunching:(NSNotification *)notification; + +@end diff --git a/panda/src/cocoadisplay/cocoaPandaAppDelegate.mm b/panda/src/cocoadisplay/cocoaPandaAppDelegate.mm new file mode 100644 index 0000000000..dbb5452c75 --- /dev/null +++ b/panda/src/cocoadisplay/cocoaPandaAppDelegate.mm @@ -0,0 +1,23 @@ +/** +* PANDA 3D SOFTWARE +* Copyright (c) Carnegie Mellon University. All rights reserved. +* +* All use of this software is subject to the terms of the revised BSD +* license. You should have received a copy of this license along +* with this source code in a file named "LICENSE." +* +* @file cocoaPandaAppDelegate.mm +* @author Donny Lawrence +* @date 2018-02-25 +*/ + +#import "cocoaPandaAppDelegate.h" + +@implementation CocoaPandaAppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)notification { + // This only seems to work when called here. + [NSApp activateIgnoringOtherApps:YES]; +} + +@end diff --git a/panda/src/cocoadisplay/p3cocoadisplay_composite1.mm b/panda/src/cocoadisplay/p3cocoadisplay_composite1.mm index e85d1e08eb..335443fab1 100644 --- a/panda/src/cocoadisplay/p3cocoadisplay_composite1.mm +++ b/panda/src/cocoadisplay/p3cocoadisplay_composite1.mm @@ -7,3 +7,4 @@ #include "cocoaPandaView.mm" #include "cocoaPandaWindow.mm" #include "cocoaPandaWindowDelegate.mm" +#include "cocoaPandaAppDelegate.mm" From 2bde4d839a8d3998209373a233ee04d0f9d60818 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 29 Mar 2018 14:36:41 +0200 Subject: [PATCH 28/55] makepanda: set MSVC 2015 as default, deprecate MSVC 2010 support See #288 for discussion; make your voice heard there if you object to this change! [skip ci] --- makepanda/makepanda.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index e7565907b2..b772a4a9e7 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -155,7 +155,7 @@ def usage(problem): print(" --everything (enable every third-party lib)") print(" --directx-sdk=X (specify version of DirectX SDK to use: jun2010, aug2009, mar2009, aug2006)") print(" --windows-sdk=X (specify Windows SDK version, eg. 7.0, 7.1 or 10. Default is 7.1)") - print(" --msvc-version=X (specify Visual C++ version, eg. 10, 11, 12, 14. Default is 10)") + print(" --msvc-version=X (specify Visual C++ version, eg. 10, 11, 12, 14. Default is 14)") print(" --use-icl (experimental setting to use an intel compiler instead of MSVC on Windows)") print("") print("The simplest way to compile panda is to just type:") @@ -315,17 +315,33 @@ def parseopts(args): usage("Invalid SHA-1 hash given for --git-commit option!") if GetTarget() == 'windows': + show_warning = False if not MSVC_VERSION: - print("No MSVC version specified. Defaulting to 10 (Visual Studio 2010).") - MSVC_VERSION = (10, 0) + show_warning = True + print("No MSVC version specified. Defaulting to 14 (Visual Studio 2015).") + MSVC_VERSION = (14, 0) else: try: MSVC_VERSION = tuple(int(d) for d in MSVC_VERSION.split('.'))[:2] if (len(MSVC_VERSION) == 1): MSVC_VERSION += (0,) + if MSVC_VERSION < (14, 0): + show_warning = True except: usage("Invalid setting for --msvc-version") + if show_warning: + warn_prefix = "%sWARNING:%s " % (GetColor("red"), GetColor()) + print("=========================================================================") + print(warn_prefix + "Support for MSVC versions before 2015 will soon be discontinued.") + print(warn_prefix + "If you wish to keep using MSVC 2010, make your voice heard at:") + print(warn_prefix + " https://github.com/panda3d/panda3d/issues/288") + if MSVC_VERSION >= (14, 0): + print(warn_prefix + "To squelch this warning, pass --msvc-version {0}.{1}".format(*MSVC_VERSION)) + print("=========================================================================") + sys.stdout.flush() + time.sleep(1.0) + if not WINDOWS_SDK: print("No Windows SDK version specified. Defaulting to '7.1'.") WINDOWS_SDK = '7.1' From b8af5bf64fc836b0a132a2a77eff06f5424ea313 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 29 Mar 2018 14:44:10 +0200 Subject: [PATCH 29/55] cocoa: fix compile error caused by faulty merge [skip ci] --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 0d21a352bf..72c9d57c0f 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -1615,7 +1615,7 @@ handle_key_event(NSEvent *event) { } cocoadisplay_cat.spam(false) << "\n"; } - _input->keystroke(c); + _input_devices[0].keystroke(c); } } From 30cf1dbbb113b30e64668c8724153b674048f0c4 Mon Sep 17 00:00:00 2001 From: deflected Date: Fri, 30 Mar 2018 13:32:17 +0300 Subject: [PATCH 30/55] pgraphnodes: Fixed the type of texture bytes in sceneGraphAnalyzer - Corrected the type of texture bytes variable as it is possible to wrap it around Signed-off-by: deflected --- panda/src/pgraphnodes/sceneGraphAnalyzer.I | 2 +- panda/src/pgraphnodes/sceneGraphAnalyzer.cxx | 2 +- panda/src/pgraphnodes/sceneGraphAnalyzer.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/pgraphnodes/sceneGraphAnalyzer.I b/panda/src/pgraphnodes/sceneGraphAnalyzer.I index 3d7ef0a08d..865326ff65 100644 --- a/panda/src/pgraphnodes/sceneGraphAnalyzer.I +++ b/panda/src/pgraphnodes/sceneGraphAnalyzer.I @@ -224,7 +224,7 @@ get_num_vertices_in_patches() const { /** * */ -int SceneGraphAnalyzer:: +size_t SceneGraphAnalyzer:: get_texture_bytes() const { return _texture_bytes; } diff --git a/panda/src/pgraphnodes/sceneGraphAnalyzer.cxx b/panda/src/pgraphnodes/sceneGraphAnalyzer.cxx index cb4c892e7c..b24678b333 100644 --- a/panda/src/pgraphnodes/sceneGraphAnalyzer.cxx +++ b/panda/src/pgraphnodes/sceneGraphAnalyzer.cxx @@ -485,7 +485,7 @@ collect_statistics(Texture *texture) { _textures.insert(Textures::value_type(texture, 1)); // Attempt to guess how many bytes of texture memory this one requires. - int bytes = + size_t bytes = texture->get_x_size() * texture->get_y_size() * texture->get_num_components() * texture->get_component_width(); diff --git a/panda/src/pgraphnodes/sceneGraphAnalyzer.h b/panda/src/pgraphnodes/sceneGraphAnalyzer.h index f8d0201766..68ca0d14df 100644 --- a/panda/src/pgraphnodes/sceneGraphAnalyzer.h +++ b/panda/src/pgraphnodes/sceneGraphAnalyzer.h @@ -81,7 +81,7 @@ PUBLISHED: INLINE int get_num_triangles_in_fans() const; INLINE int get_num_vertices_in_patches() const; - INLINE int get_texture_bytes() const; + INLINE size_t get_texture_bytes() const; INLINE int get_num_long_normals() const; INLINE int get_num_short_normals() const; @@ -150,7 +150,7 @@ private: int _num_triangles_in_fans; int _num_vertices_in_patches; - int _texture_bytes; + size_t _texture_bytes; int _num_long_normals; int _num_short_normals; From 84915073e1e2bc2ad1dc9a395c823ca771574751 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 30 Mar 2018 20:15:13 +0200 Subject: [PATCH 31/55] Fix compilation warning on MSVC 2015 --- dtool/src/interrogatedb/py_panda.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index 76733237a8..362f5ec6ca 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -736,7 +736,7 @@ PyObject *Dtool_AddToDictionary(PyObject *self1, PyObject *args) { Py_hash_t DTOOL_PyObject_HashPointer(PyObject *self) { if (self != nullptr && DtoolInstance_Check(self)) { - return (Py_hash_t)DtoolInstance_VOID_PTR(self); + return (Py_hash_t)(intptr_t)DtoolInstance_VOID_PTR(self); } return -1; } From 78377ca10cc155c6e25897c33503695457572f1f Mon Sep 17 00:00:00 2001 From: Sebastian Hoffmann Date: Sun, 25 Feb 2018 15:41:26 +0100 Subject: [PATCH 32/55] Cursor after newline character appears on beginning of next line. DirectEntry.updateNumLines updates text geom. DirectEntry API less inadequate. Closes #257 --- direct/src/gui/DirectEntry.py | 6 ++++++ panda/src/pgui/pgEntry.I | 1 + panda/src/pgui/pgEntry.cxx | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/direct/src/gui/DirectEntry.py b/direct/src/gui/DirectEntry.py index 6955e550a2..e345c526e9 100644 --- a/direct/src/gui/DirectEntry.py +++ b/direct/src/gui/DirectEntry.py @@ -302,12 +302,18 @@ class DirectEntry(DirectFrame): else: return self.guiItem.getText() + def getCursorPosition(self): + return self.guiItem.getCursorPosition() + def setCursorPosition(self, pos): if (pos < 0): self.guiItem.setCursorPosition(self.guiItem.getNumCharacters() + pos) else: self.guiItem.setCursorPosition(pos) + def getNumCharacters(self): + return self.guiItem.getNumCharacters() + def enterText(self, text): """ sets the entry's text, and moves the cursor to the end """ self.set(text) diff --git a/panda/src/pgui/pgEntry.I b/panda/src/pgui/pgEntry.I index e90ebce374..dec418c9fd 100644 --- a/panda/src/pgui/pgEntry.I +++ b/panda/src/pgui/pgEntry.I @@ -208,6 +208,7 @@ set_num_lines(int num_lines) { nassertv(num_lines >= 1); _num_lines = num_lines; _text_geom_stale = true; + update_text(); } /** diff --git a/panda/src/pgui/pgEntry.cxx b/panda/src/pgui/pgEntry.cxx index 12e2636e9a..c9f84fae4f 100644 --- a/panda/src/pgui/pgEntry.cxx +++ b/panda/src/pgui/pgEntry.cxx @@ -864,6 +864,10 @@ update_cursor() { ypos = _obscure_text.get_ypos(row, column); } else { _text.calc_r_c(row, column, _cursor_position); + if (_cursor_position > 0 && _text.get_character(_cursor_position - 1) == '\n') { + row += 1; + column = 0; + } xpos = _text.get_xpos(row, column); ypos = _text.get_ypos(row, column); } From 0b1ad67e13533fc9bd2fbb5d26738ee0e3286bad Mon Sep 17 00:00:00 2001 From: Tohka Date: Sat, 31 Mar 2018 13:01:35 +0300 Subject: [PATCH 33/55] distributed: Fix DC file reading regression (#295) --- direct/src/distributed/ConnectionRepository.py | 2 +- direct/src/distributed/ServerRepository.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/direct/src/distributed/ConnectionRepository.py b/direct/src/distributed/ConnectionRepository.py index 974c611bcc..348a4390b6 100644 --- a/direct/src/distributed/ConnectionRepository.py +++ b/direct/src/distributed/ConnectionRepository.py @@ -333,7 +333,7 @@ class ConnectionRepository( continue classDef = getattr(classDef, className) - if inspect.isclass(classDef): + if not inspect.isclass(classDef): self.notify.error("Symbol %s is not a class name." % (className)) else: dclass.setClassDef(classDef) diff --git a/direct/src/distributed/ServerRepository.py b/direct/src/distributed/ServerRepository.py index 7783e2860b..894dfb1349 100644 --- a/direct/src/distributed/ServerRepository.py +++ b/direct/src/distributed/ServerRepository.py @@ -280,7 +280,7 @@ class ServerRepository: self.notify.error("Module %s does not define class %s." % (className, className)) classDef = getattr(classDef, className) - if inspect.isclass(classDef): + if not inspect.isclass(classDef): self.notify.error("Symbol %s is not a class name." % (className)) else: dclass.setClassDef(classDef) From 65210a5e49f4360b718acd29ecf454bddc934e60 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Fri, 30 Mar 2018 23:30:54 -0600 Subject: [PATCH 34/55] ffmpeg: Fix a typo in version detection See f0b3e08e9c75e5cdcd98c0f3142469918d1d2fd5 --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 2 +- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 659925cce3..b45770d20a 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -143,7 +143,7 @@ FfmpegAudioCursor(FfmpegAudio *src) : _can_seek = true; _can_seek_fast = true; -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100) +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 45, 101) _frame = av_frame_alloc(); #else _frame = avcodec_alloc_frame(); diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 8a23853811..ffcccc8aab 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -96,7 +96,7 @@ init_from(FfmpegVideo *source) { ReMutexHolder av_holder(_av_lock); -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100) +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 45, 101) _frame = av_frame_alloc(); _frame_out = av_frame_alloc(); #else From a19e9aea63a44751bedbd3e1b8ba35b4f242fe10 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 27 Mar 2018 13:43:01 -0600 Subject: [PATCH 35/55] ffmpeg: Enforce minimum supported versions of ffmpeg lavcodec: 54.86.100 lavformat: 54.59.106 lavutil: 52.13.100 These are the versions included in FFmpeg 1.1, which is the oldest release that works with Panda already: we've been using `av_opt_set_sample_fmt` (introduced in FFmpeg 1.1) since 03e96d8c4a903be7222365b40613429768659892 (August 2013) and nobody has complained since. In other words, I'm not dropping support for anything here, I'm just making the supported versions explicit. --- panda/src/ffmpeg/config_ffmpeg.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/panda/src/ffmpeg/config_ffmpeg.cxx b/panda/src/ffmpeg/config_ffmpeg.cxx index 8cbc9f51ec..be788eb2f8 100644 --- a/panda/src/ffmpeg/config_ffmpeg.cxx +++ b/panda/src/ffmpeg/config_ffmpeg.cxx @@ -22,12 +22,26 @@ extern "C" { #include "libavcodec/avcodec.h" + #include "libavformat/avformat.h" + #include "libavutil/avutil.h" } #if !defined(CPPPARSER) && !defined(BUILDING_FFMPEG) #error Buildsystem error: BUILDING_FFMPEG not defined #endif +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 86, 100) + #error Minimum supported version of libavcodec is 54.86.100. +#endif + +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54, 59, 106) + #error Minimum supported version of libavformat is 54.59.106. +#endif + +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 13, 100) + #error Minimum supported version of libavutil is 52.13.100. +#endif + ConfigureDef(config_ffmpeg); NotifyCategoryDef(ffmpeg, ""); From 148010c5f020b46e7b38a5b8c3254185f59023a3 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 27 Mar 2018 13:51:08 -0600 Subject: [PATCH 36/55] ffmpeg: Remove code to support deprecated versions See previous commit; now that we're enforcing explicit minimums, any code to support anything older than those minimums is trivially dead. --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 43 +------------------------- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 29 +---------------- panda/src/ffmpeg/ffmpegVirtualFile.cxx | 15 --------- 3 files changed, 2 insertions(+), 85 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index b45770d20a..83ae9dcf28 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -63,11 +63,7 @@ FfmpegAudioCursor(FfmpegAudio *src) : _format_ctx = _ffvfile.get_format_context(); nassertv(_format_ctx != NULL); -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 6, 0) if (avformat_find_stream_info(_format_ctx, NULL) < 0) { -#else - if (av_find_stream_info(_format_ctx) < 0) { -#endif cleanup(); return; } @@ -94,31 +90,20 @@ FfmpegAudioCursor(FfmpegAudio *src) : return; } -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 8, 0) AVDictionary *opts = NULL; av_dict_set(&opts, "request_sample_fmt", "s16", 0); if (avcodec_open2(_audio_ctx, pAudioCodec, NULL) < 0) { -#else - if (avcodec_open(_audio_ctx, pAudioCodec) < 0) { -#endif cleanup(); return; } -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 8, 0) av_dict_free(&opts); -#endif // Set up the resample context if necessary. if (_audio_ctx->sample_fmt != AV_SAMPLE_FMT_S16) { #ifdef HAVE_SWRESAMPLE -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 25, 0) - ffmpeg_cat.error() - << "Codec does not use signed 16-bit sample format. Upgrade libavcodec to 53.25.0 or higher.\n"; -#else ffmpeg_cat.debug() << "Codec does not use signed 16-bit sample format. Setting up swresample context.\n"; -#endif _resample_ctx = swr_alloc(); av_opt_set_int(_resample_ctx, "in_channel_layout", _audio_ctx->channel_layout, 0); @@ -191,10 +176,8 @@ cleanup() { if (_frame) { #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 45, 101) av_frame_free(&_frame); -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100) - avcodec_free_frame(&_frame); #else - av_free(&_frame); + avcodec_free_frame(&_frame); #endif _frame = NULL; } @@ -284,25 +267,6 @@ reload_buffer() { return true; } else if (_packet_size > 0) { int bufsize = _buffer_size * 2; -#if LIBAVCODEC_VERSION_INT < 3349504 - int len = avcodec_decode_audio(_audio_ctx, _buffer, &bufsize, - _packet_data, _packet_size); - movies_debug("avcodec_decode_audio returned " << len); -#elif LIBAVCODEC_VERSION_INT < 3414272 - int len = avcodec_decode_audio2(_audio_ctx, _buffer, &bufsize, - _packet_data, _packet_size); - movies_debug("avcodec_decode_audio2 returned " << len); -#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 25, 0) - // We should technically also consider resampling in this case, but - // whatever. Just upgrade your ffmpeg version if you get garbage. - AVPacket pkt; - av_init_packet(&pkt); - pkt.data = _packet_data; - pkt.size = _packet_size; - int len = avcodec_decode_audio3(_audio_ctx, _buffer, &bufsize, &pkt); - movies_debug("avcodec_decode_audio3 returned " << len); - av_free_packet(&pkt); -#else int got_frame; AVPacket pkt; av_init_packet(&pkt); @@ -332,7 +296,6 @@ reload_buffer() { } #if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(52, 19, 100) av_frame_unref(_frame); -#endif #endif if (len < 0) { @@ -376,11 +339,7 @@ seek(double t) { cleanup(); return; } -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 8, 0) if (avcodec_open2(_audio_ctx, pAudioCodec, NULL) < 0) { -#else - if (avcodec_open(_audio_ctx, pAudioCodec) < 0) { -#endif cleanup(); return; } diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index ffcccc8aab..4000343ba8 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -36,21 +36,10 @@ PStatCollector FfmpegVideoCursor::_fetch_buffer_pcollector("*:FFMPEG Video Decod PStatCollector FfmpegVideoCursor::_seek_pcollector("*:FFMPEG Video Decoding:Seek"); PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Video to BGR"); -#if LIBAVFORMAT_VERSION_MAJOR < 53 - #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO -#endif - #if LIBAVCODEC_VERSION_MAJOR < 54 #define AV_CODEC_ID_VP8 CODEC_ID_VP8 #endif -#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100) -#define AV_PIX_FMT_NONE PIX_FMT_NONE -#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 -#define AV_PIX_FMT_BGRA PIX_FMT_BGRA -typedef PixelFormat AVPixelFormat; -#endif - #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 32, 100) #define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_ALPHA #endif @@ -120,7 +109,6 @@ init_from(FfmpegVideo *source) { _eof_known = false; _eof_frame = 0; -#if LIBAVUTIL_VERSION_MAJOR >= 52 // Check if we got an alpha format. Please note that some video codecs // (eg. libvpx) change the pix_fmt after decoding the first frame, which is // why we didn't do this earlier. @@ -128,9 +116,7 @@ init_from(FfmpegVideo *source) { if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) { _num_components = 4; _pixel_format = (int)AV_PIX_FMT_BGRA; - } else -#endif - { + } else { _num_components = 3; _pixel_format = (int)AV_PIX_FMT_BGR24; } @@ -493,11 +479,7 @@ open_stream() { _format_ctx = _ffvfile.get_format_context(); nassertr(_format_ctx != NULL, false); -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 6, 0) if (avformat_find_stream_info(_format_ctx, NULL) < 0) { -#else - if (av_find_stream_info(_format_ctx) < 0) { -#endif ffmpeg_cat.info() << "Couldn't find stream info\n"; close_stream(); @@ -539,11 +521,7 @@ open_stream() { close_stream(); return false; } -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 8, 0) if (avcodec_open2(_video_ctx, pVideoCodec, NULL) < 0) { -#else - if (avcodec_open(_video_ctx, pVideoCodec) < 0) { -#endif ffmpeg_cat.info() << "Couldn't open codec\n"; close_stream(); @@ -883,12 +861,7 @@ decode_frame(int &finished) { */ void FfmpegVideoCursor:: do_decode_frame(int &finished) { -#if LIBAVCODEC_VERSION_INT < 3414272 - avcodec_decode_video(_video_ctx, _frame, - &finished, _packet->data, _packet->size); -#else avcodec_decode_video2(_video_ctx, _frame, &finished, _packet); -#endif } /** diff --git a/panda/src/ffmpeg/ffmpegVirtualFile.cxx b/panda/src/ffmpeg/ffmpegVirtualFile.cxx index df8f077406..8819db74bc 100644 --- a/panda/src/ffmpeg/ffmpegVirtualFile.cxx +++ b/panda/src/ffmpeg/ffmpegVirtualFile.cxx @@ -107,11 +107,7 @@ open_vfs(const Filename &filename) { // Now we can open the stream. int result = -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 4, 0) avformat_open_input(&_format_context, "", NULL, NULL); -#else - av_open_input_file(&_format_context, "", NULL, 0, NULL); -#endif if (result < 0) { close(); return false; @@ -159,11 +155,7 @@ open_subfile(const SubfileInfo &info) { // Now we can open the stream. int result = -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 4, 0) avformat_open_input(&_format_context, fname.c_str(), NULL, NULL); -#else - av_open_input_file(&_format_context, fname.c_str(), NULL, 0, NULL); -#endif if (result < 0) { close(); return false; @@ -179,12 +171,7 @@ open_subfile(const SubfileInfo &info) { void FfmpegVirtualFile:: close() { if (_format_context != NULL) { -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0) avformat_close_input(&_format_context); -#else - av_close_input_file(_format_context); - _format_context = NULL; -#endif } if (_io_context != NULL) { @@ -218,9 +205,7 @@ register_protocol() { av_register_all(); // And this one. -#if LIBAVFORMAT_VERSION_INT >= 0x351400 avformat_network_init(); -#endif // Let's also register the logging to Panda's notify callback. av_log_set_callback(&log_callback); From cc77c5dbe2e9ef9f889e6b36a4e5aaee441493d5 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 31 Mar 2018 01:33:28 -0600 Subject: [PATCH 37/55] ffmpeg: Clean up ffmpeg_prefer_libvpx implementation --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 4000343ba8..ff3f46a538 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -36,12 +36,8 @@ PStatCollector FfmpegVideoCursor::_fetch_buffer_pcollector("*:FFMPEG Video Decod PStatCollector FfmpegVideoCursor::_seek_pcollector("*:FFMPEG Video Decoding:Seek"); PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Video to BGR"); -#if LIBAVCODEC_VERSION_MAJOR < 54 -#define AV_CODEC_ID_VP8 CODEC_ID_VP8 -#endif - #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 32, 100) -#define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_ALPHA + #define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_ALPHA #endif /** @@ -506,9 +502,12 @@ open_stream() { AVCodec *pVideoCodec = NULL; if (ffmpeg_prefer_libvpx) { - if ((int)_video_ctx->codec_id == 168) { // AV_CODEC_ID_VP9 +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 0, 0) + if (_video_ctx->codec_id == AV_CODEC_ID_VP9) { pVideoCodec = avcodec_find_decoder_by_name("libvpx-vp9"); - } else if (_video_ctx->codec_id == AV_CODEC_ID_VP8) { + } else +#endif + if (_video_ctx->codec_id == AV_CODEC_ID_VP8) { pVideoCodec = avcodec_find_decoder_by_name("libvpx"); } } From 95960952945f79f1a5acc458570703e1c9250b4e Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 31 Mar 2018 01:36:39 -0600 Subject: [PATCH 38/55] ffmpeg: Use AVStream.codecpar AVStream.codec is deprecated as of libavformat version 57.41.100, so if this version is detected, we switch to AVStream.codecpar instead. Note this also makes it necessary to construct and use our own codec context - but doing that is a cleaner approach anyway. --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 49 ++++++++++++++++++--- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 59 +++++++++++++++++++++----- 2 files changed, 91 insertions(+), 17 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 83ae9dcf28..2a94dd25b9 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -68,28 +68,58 @@ FfmpegAudioCursor(FfmpegAudio *src) : return; } + // As of libavformat version 57.41.100, AVStream.codec is deprecated in favor + // of AVStream.codecpar. Fortunately, the two structures have + // similarly-named members, so we can just switch out the declaration. +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 41, 100) + AVCodecParameters *codecpar; +#else + AVCodecContext *codecpar; +#endif + // Find the audio stream + AVStream *stream = nullptr; for (int i = 0; i < (int)_format_ctx->nb_streams; i++) { - if (_format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 41, 100) + codecpar = _format_ctx->streams[i]->codecpar; +#else + codecpar = _format_ctx->streams[i]->codec; +#endif + if (codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { _audio_index = i; - _audio_ctx = _format_ctx->streams[i]->codec; - _audio_timebase = av_q2d(_format_ctx->streams[i]->time_base); - _audio_rate = _audio_ctx->sample_rate; - _audio_channels = _audio_ctx->channels; + stream = _format_ctx->streams[i]; + break; } } - if (_audio_ctx == 0) { + if (stream == nullptr) { cleanup(); return; } - AVCodec *pAudioCodec = avcodec_find_decoder(_audio_ctx->codec_id); + _audio_timebase = av_q2d(stream->time_base); + _audio_rate = codecpar->sample_rate; + _audio_channels = codecpar->channels; + + AVCodec *pAudioCodec = avcodec_find_decoder(codecpar->codec_id); if (pAudioCodec == 0) { cleanup(); return; } + _audio_ctx = avcodec_alloc_context3(pAudioCodec); + + if (_audio_ctx == nullptr) { + cleanup(); + return; + } + +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 41, 100) + avcodec_parameters_to_context(_audio_ctx, codecpar); +#else + avcodec_copy_context(_audio_ctx, codecpar); +#endif + AVDictionary *opts = NULL; av_dict_set(&opts, "request_sample_fmt", "s16", 0); if (avcodec_open2(_audio_ctx, pAudioCodec, NULL) < 0) { @@ -202,6 +232,11 @@ cleanup() { if ((_audio_ctx)&&(_audio_ctx->codec)) { avcodec_close(_audio_ctx); +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 52, 0) + avcodec_free_context(&_audio_ctx); +#else + delete _audio_ctx; +#endif } _audio_ctx = NULL; diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index ff3f46a538..33d0a1d411 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -482,37 +482,55 @@ open_stream() { return false; } - // Find the video stream nassertr(_video_ctx == NULL, false); + + // As of libavformat version 57.41.100, AVStream.codec is deprecated in favor + // of AVStream.codecpar. Fortunately, the two structures have + // similarly-named members, so we can just switch out the declaration. +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 41, 100) + AVCodecParameters *codecpar; +#else + AVCodecContext *codecpar; +#endif + + // Find the video stream + AVStream *stream = nullptr; for (int i = 0; i < (int)_format_ctx->nb_streams; ++i) { - if (_format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 41, 100) + codecpar = _format_ctx->streams[i]->codecpar; +#else + codecpar = _format_ctx->streams[i]->codec; +#endif + if (codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { _video_index = i; - _video_ctx = _format_ctx->streams[i]->codec; - _video_timebase = av_q2d(_format_ctx->streams[i]->time_base); - _min_fseek = (int)(3.0 / _video_timebase); + stream = _format_ctx->streams[i]; + break; } } - if (_video_ctx == NULL) { + if (stream == nullptr) { ffmpeg_cat.info() - << "Couldn't find video_ctx\n"; + << "Couldn't find stream\n"; close_stream(); return false; } + _video_timebase = av_q2d(stream->time_base); + _min_fseek = (int)(3.0 / _video_timebase); + AVCodec *pVideoCodec = NULL; if (ffmpeg_prefer_libvpx) { #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 0, 0) - if (_video_ctx->codec_id == AV_CODEC_ID_VP9) { + if (codecpar->codec_id == AV_CODEC_ID_VP9) { pVideoCodec = avcodec_find_decoder_by_name("libvpx-vp9"); } else #endif - if (_video_ctx->codec_id == AV_CODEC_ID_VP8) { + if (codecpar->codec_id == AV_CODEC_ID_VP8) { pVideoCodec = avcodec_find_decoder_by_name("libvpx"); } } if (pVideoCodec == NULL) { - pVideoCodec = avcodec_find_decoder(_video_ctx->codec_id); + pVideoCodec = avcodec_find_decoder(codecpar->codec_id); } if (pVideoCodec == NULL) { ffmpeg_cat.info() @@ -520,6 +538,22 @@ open_stream() { close_stream(); return false; } + + _video_ctx = avcodec_alloc_context3(pVideoCodec); + + if (_video_ctx == nullptr) { + ffmpeg_cat.info() + << "Couldn't allocate _video_ctx\n"; + close_stream(); + return false; + } + +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 41, 100) + avcodec_parameters_to_context(_video_ctx, codecpar); +#else + avcodec_copy_context(_video_ctx, codecpar); +#endif + if (avcodec_open2(_video_ctx, pVideoCodec, NULL) < 0) { ffmpeg_cat.info() << "Couldn't open codec\n"; @@ -547,6 +581,11 @@ close_stream() { if ((_video_ctx)&&(_video_ctx->codec)) { avcodec_close(_video_ctx); +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 52, 0) + avcodec_free_context(&_video_ctx); +#else + delete _video_ctx; +#endif } _video_ctx = NULL; From eb591674e09bb0a7a39b9b3b36f43c54d820756f Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 27 Mar 2018 21:25:55 -0600 Subject: [PATCH 39/55] ffmpeg: Prefer av_packet_alloc over allocating AVPacket ourselves av_packet_alloc/av_packet_free will know the correct size of AVPacket, even if the ABI should change. So, we use it when it's available. --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 36 ++++++++++++++++++-------- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 12 ++++++--- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 2a94dd25b9..dafcc8f2c5 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -164,7 +164,12 @@ FfmpegAudioCursor(FfmpegAudio *src) : _frame = avcodec_alloc_frame(); #endif +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) + _packet = av_packet_alloc(); +#else _packet = new AVPacket; +#endif + _buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE / 2; _buffer_alloc = new int16_t[_buffer_size + 64]; @@ -213,15 +218,15 @@ cleanup() { } if (_packet) { - if (_packet->data) { #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) - av_packet_unref(_packet); + av_packet_free(&_packet); #else + if (_packet->data) { av_free_packet(_packet); -#endif } delete _packet; _packet = NULL; +#endif } if (_buffer_alloc) { @@ -303,16 +308,25 @@ reload_buffer() { } else if (_packet_size > 0) { int bufsize = _buffer_size * 2; int got_frame; - AVPacket pkt; - av_init_packet(&pkt); - pkt.data = _packet_data; - pkt.size = _packet_size; - int len = avcodec_decode_audio4(_audio_ctx, _frame, &got_frame, &pkt); - movies_debug("avcodec_decode_audio4 returned " << len); + + AVPacket *pkt; #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) - av_packet_unref(&pkt); + pkt = av_packet_alloc(); #else - av_free_packet(&pkt); + AVPacket _pkt; + pkt = &_pkt; + av_init_packet(pkt); +#endif + pkt->data = _packet_data; + pkt->size = _packet_size; + + int len = avcodec_decode_audio4(_audio_ctx, _frame, &got_frame, pkt); + movies_debug("avcodec_decode_audio4 returned " << len); + +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) + av_packet_free(&pkt); +#else + av_free_packet(pkt); #endif bufsize = 0; diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 33d0a1d411..cf2b01bf5c 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -94,8 +94,12 @@ init_from(FfmpegVideo *source) { return; } +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) + _packet = av_packet_alloc(); +#else _packet = new AVPacket; - memset(_packet, 0, sizeof(AVPacket)); + av_init_packet(_packet); +#endif fetch_packet(0); fetch_frame(-1); @@ -624,15 +628,15 @@ cleanup() { } if (_packet) { - if (_packet->data) { #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) - av_packet_unref(_packet); + av_packet_free(&_packet); #else + if (_packet->data) { av_free_packet(_packet); -#endif } delete _packet; _packet = NULL; +#endif } } From 4ffd3644158f7972d91534a7aa5da1c96e16d5a9 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 31 Mar 2018 02:54:48 -0600 Subject: [PATCH 40/55] ffmpeg: Simplify ffmpegAudioCursor.cxx a little This refactors the `reload_buffer` loop so all of the decode logic is inside the loop, and all of the resampling logic is outside. --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 112 ++++++++++++------------- 1 file changed, 54 insertions(+), 58 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index dafcc8f2c5..a897174bc2 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -297,71 +297,67 @@ fetch_packet() { */ bool FfmpegAudioCursor:: reload_buffer() { - - while (_buffer_head == _buffer_tail) { + int got_frame = 0; + while (!got_frame) { // If we're out of packets, generate silence. - if (_packet->data == 0) { + if (_packet->data == nullptr) { _buffer_head = 0; _buffer_tail = _buffer_size; memset(_buffer, 0, _buffer_size * 2); return true; - } else if (_packet_size > 0) { - int bufsize = _buffer_size * 2; - int got_frame; - - AVPacket *pkt; -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) - pkt = av_packet_alloc(); -#else - AVPacket _pkt; - pkt = &_pkt; - av_init_packet(pkt); -#endif - pkt->data = _packet_data; - pkt->size = _packet_size; - - int len = avcodec_decode_audio4(_audio_ctx, _frame, &got_frame, pkt); - movies_debug("avcodec_decode_audio4 returned " << len); - -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) - av_packet_free(&pkt); -#else - av_free_packet(pkt); -#endif - - bufsize = 0; - if (got_frame) { -#ifdef HAVE_SWRESAMPLE - if (_resample_ctx) { - // Resample the data to signed 16-bit sample format. - bufsize = swr_convert(_resample_ctx, (uint8_t **)&_buffer, _buffer_size / 2, (const uint8_t**)_frame->extended_data, _frame->nb_samples); - bufsize *= _audio_channels * 2; - } else -#endif - { - bufsize = _frame->linesize[0]; - memcpy(_buffer, _frame->data[0], bufsize); - } - } -#if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(52, 19, 100) - av_frame_unref(_frame); -#endif - - if (len < 0) { - return false; - } else if (len == 0){ - return true; - } - _packet_data += len; - _packet_size -= len; - if (bufsize > 0) { - _buffer_head = 0; - _buffer_tail = (bufsize/2); - return true; - } - } else { + } else if (_packet_size == 0) { fetch_packet(); } + + AVPacket *pkt; +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) + pkt = av_packet_alloc(); +#else + AVPacket _pkt; + pkt = &_pkt; + av_init_packet(pkt); +#endif + pkt->data = _packet_data; + pkt->size = _packet_size; + + int len = avcodec_decode_audio4(_audio_ctx, _frame, &got_frame, pkt); + movies_debug("avcodec_decode_audio4 returned " << len); + +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100) + av_packet_free(&pkt); +#else + av_free_packet(pkt); +#endif + + if (len < 0) { + return false; + } else if (len == 0) { + return true; + } + _packet_data += len; + _packet_size -= len; + } + + int bufsize; +#ifdef HAVE_SWRESAMPLE + if (_resample_ctx) { + // Resample the data to signed 16-bit sample format. + bufsize = swr_convert(_resample_ctx, (uint8_t **)&_buffer, _buffer_size / 2, (const uint8_t**)_frame->extended_data, _frame->nb_samples); + bufsize *= _audio_channels * 2; + } else +#endif + { + bufsize = _frame->linesize[0]; + memcpy(_buffer, _frame->data[0], bufsize); + } +#if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(52, 19, 100) + av_frame_unref(_frame); +#endif + + if (bufsize > 0) { + _buffer_head = 0; + _buffer_tail = (bufsize/2); + return true; } return true; } From 62f9de101ad2c8aa7f09cc1214011b3832fd1d6d Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 31 Mar 2018 02:59:00 -0600 Subject: [PATCH 41/55] ffmpeg: Tell swresample the channel count --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index a897174bc2..bb12085774 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -136,6 +136,8 @@ FfmpegAudioCursor(FfmpegAudio *src) : << "Codec does not use signed 16-bit sample format. Setting up swresample context.\n"; _resample_ctx = swr_alloc(); + av_opt_set_int(_resample_ctx, "in_channel_count", _audio_channels, 0); + av_opt_set_int(_resample_ctx, "out_channel_count", _audio_channels, 0); av_opt_set_int(_resample_ctx, "in_channel_layout", _audio_ctx->channel_layout, 0); av_opt_set_int(_resample_ctx, "out_channel_layout", _audio_ctx->channel_layout, 0); av_opt_set_int(_resample_ctx, "in_sample_rate", _audio_ctx->sample_rate, 0); From e430428703c149f400922399fa42c56a92023bb9 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 31 Mar 2018 03:12:00 -0600 Subject: [PATCH 42/55] ffmpeg: Add async audio decoding loop This leverages libavcodec >= 57.37.100's new asynchronous API, which both allows decoding in hardware and in a separate thread, and in any case would free up more CPU time for Panda's app loop. This also avoids use of the now-deprecated `avcodec_decode_audio4` --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index bb12085774..651ec7cfb6 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -299,6 +299,62 @@ fetch_packet() { */ bool FfmpegAudioCursor:: reload_buffer() { +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 37, 100) + // lavc >= 57.37.100 deprecates the old (avcodec_decode_audio*) API in favor + // of a newer, asynchronous API. This is great for our purposes - it gives + // the codec the opportunity to decode in the background (e.g. in another + // thread or on a dedicated hardware coprocessor). + + // First, let's fill the codec's input buffer with as many packets as it'll + // take: + int ret; + while (_packet->data != nullptr) { + ret = avcodec_send_packet(_audio_ctx, _packet); + + if (ret != 0) { + // Nonzero return code is an error. + break; + } + + // If we got here, the codec took the packet! Fetch another one. + fetch_packet(); + if (_packet->data == nullptr) { + // fetch_packet() says we're out of packets. Let the codec know. + ret = avcodec_send_packet(_audio_ctx, NULL); + } + } + + // Expected ret codes are 0 (we ran out of packets) and EAGAIN (codec full) + if ((ret != 0) && (ret != AVERROR(EAGAIN))) { + // Some odd error happened. We can't proceed. + ffmpeg_cat.error() + << "avcodec_send_packet returned " << ret << "\n"; + return false; + } + + // Now we retrieve our frame! + ret = avcodec_receive_frame(_audio_ctx, _frame); + + if (ret == AVERROR_EOF) { + // The only way for this to happen is if we're out of packets. + nassertr(_packet->data == nullptr, false); + + // Synthesize silence: + _buffer_head = 0; + _buffer_tail = _buffer_size; + memset(_buffer, 0, _buffer_size * 2); + return true; + + } else if (ret != 0) { + // Some odd error happened. We can't proceed. + ffmpeg_cat.error() + << "avcodec_receive_frame returned " << ret << "\n"; + return false; + } + + // We now have _frame. It will be handled below. + +#else int got_frame = 0; while (!got_frame) { // If we're out of packets, generate silence. @@ -339,6 +395,7 @@ reload_buffer() { _packet_data += len; _packet_size -= len; } +#endif int bufsize; #ifdef HAVE_SWRESAMPLE From 8d36908556d42d0c6feaf3199edb78f6c0cdb312 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 31 Mar 2018 03:25:03 -0600 Subject: [PATCH 43/55] ffmpeg: Use `avcodec_flush_buffers` when seeking Previously this would close and reopen the codec context; that's entirely unnecessary, as all supported versions of libavcodec support flushing the buffers instead. --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 651ec7cfb6..ef6cd14d92 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -437,16 +437,7 @@ seek(double t) { cleanup(); return; } - avcodec_close(_audio_ctx); - AVCodec *pAudioCodec = avcodec_find_decoder(_audio_ctx->codec_id); - if(pAudioCodec == 0) { - cleanup(); - return; - } - if (avcodec_open2(_audio_ctx, pAudioCodec, NULL) < 0) { - cleanup(); - return; - } + avcodec_flush_buffers(_audio_ctx); _buffer_head = 0; _buffer_tail = 0; fetch_packet(); From bb6e0abeba379a4820ce5c04bd6148343f22fc3b Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 31 Mar 2018 03:35:59 -0600 Subject: [PATCH 44/55] ffmpeg: Switch the video cursor to the new decoding API --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index cf2b01bf5c..21137b30e8 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -903,7 +903,18 @@ decode_frame(int &finished) { */ void FfmpegVideoCursor:: do_decode_frame(int &finished) { +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 37, 100) + // While the audio cursor has a really nice async loop for decoding, we + // don't really do that much with video since we're already delegated to + // another thread here. This is just to silence the deprecation warning + // on avcodec_decode_video2. + avcodec_send_packet(_video_ctx, _packet); + + int ret = avcodec_receive_frame(_video_ctx, _frame); + finished = (ret == 0); +#else avcodec_decode_video2(_video_ctx, _frame, &finished, _packet); +#endif } /** From fadbcd91e5f77019d9ec3e346247e3c8ded46f87 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 31 Mar 2018 05:22:04 -0600 Subject: [PATCH 45/55] ffmpeg: Bump supported minimums lower for libav 9.20 We need to support this because Ubuntu 14.04 ships with this version, and has no "backports" option to bring in a newer version (without use of a PPA or compiling it yourself). We can consider raising the minimums again once Trusty is EOL. --- panda/src/ffmpeg/config_ffmpeg.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/panda/src/ffmpeg/config_ffmpeg.cxx b/panda/src/ffmpeg/config_ffmpeg.cxx index be788eb2f8..850cf62937 100644 --- a/panda/src/ffmpeg/config_ffmpeg.cxx +++ b/panda/src/ffmpeg/config_ffmpeg.cxx @@ -30,16 +30,19 @@ extern "C" { #error Buildsystem error: BUILDING_FFMPEG not defined #endif -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 86, 100) - #error Minimum supported version of libavcodec is 54.86.100. +// Minimum supported versions: +// FFmpeg: 1.1 +// libav: 9.20 (for Ubuntu 14.04) +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 35, 1) + #error Minimum supported version of libavcodec is 54.35.1. #endif -#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54, 59, 106) - #error Minimum supported version of libavformat is 54.59.106. +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54, 20, 4) + #error Minimum supported version of libavformat is 54.20.4. #endif -#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 13, 100) - #error Minimum supported version of libavutil is 52.13.100. +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 3, 0) + #error Minimum supported version of libavutil is 52.3.0. #endif ConfigureDef(config_ffmpeg); From e9ae7dcc407d8198a701b761d0431f456c8ad925 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 2 Apr 2018 23:16:03 +0200 Subject: [PATCH 46/55] Use vector_uchar instead of string for binary network/file data This distinction allows us to better support Python 3, since it will raise exceptions when trying to put arbitrary binary data in a str object. This also adds some convenience functions for efficiently initializing a Datagram or PTA_uchar from a vector_uchar. --- .../src/distributed/cConnectionRepository.cxx | 6 +- dtool/src/prc/encryptStreamBuf.cxx | 7 ++- dtool/src/prc/streamReader.cxx | 12 ++-- dtool/src/prc/streamReader.h | 3 +- panda/src/downloader/downloadDb.cxx | 55 ++++++---------- panda/src/downloader/downloadDb.h | 8 +-- panda/src/downloader/socketStream.cxx | 19 +++--- panda/src/downloader/socketStream.h | 3 +- panda/src/express/datagram.I | 62 +++---------------- panda/src/express/datagram.h | 13 +--- panda/src/express/datagramIterator.I | 11 ++-- panda/src/express/datagramIterator.cxx | 14 ++--- panda/src/express/datagramIterator.h | 4 +- panda/src/express/hashVal.cxx | 6 +- panda/src/express/hashVal.h | 4 +- panda/src/express/multifile.cxx | 6 +- panda/src/express/pointerToArray.I | 26 ++++++++ panda/src/express/pointerToArray.h | 2 + panda/src/express/pointerToArrayBase.I | 10 +++ panda/src/express/pointerToArrayBase.h | 1 + panda/src/gobj/texture.cxx | 4 +- panda/src/movies/wavAudioCursor.cxx | 11 ++-- panda/src/recorder/socketStreamRecorder.cxx | 6 +- pandatool/src/flt/fltBeadID.cxx | 12 ++-- pandatool/src/flt/fltRecord.cxx | 5 +- 25 files changed, 143 insertions(+), 167 deletions(-) diff --git a/direct/src/distributed/cConnectionRepository.cxx b/direct/src/distributed/cConnectionRepository.cxx index 67d6ec1658..e247c2bd55 100644 --- a/direct/src/distributed/cConnectionRepository.cxx +++ b/direct/src/distributed/cConnectionRepository.cxx @@ -803,8 +803,9 @@ handle_update_field_owner() { Py_DECREF(dclass_this); // check if we should forward this update to the owner view + vector_uchar data = _di.get_remaining_bytes(); DCPacker packer; - packer.set_unpack_data(_di.get_remaining_bytes()); + packer.set_unpack_data((const char *)data.data(), data.size(), false); int field_id = packer.raw_unpack_uint16(); DCField *field = dclass->get_field_by_index(field_id); if (field->is_ownrecv()) { @@ -845,8 +846,9 @@ handle_update_field_owner() { Py_DECREF(dclass_this); // check if we should forward this update to the owner view + vector_uchar data = _di.get_remaining_bytes(); DCPacker packer; - packer.set_unpack_data(_di.get_remaining_bytes()); + packer.set_unpack_data((const char *)data.data(), data.size(), false); int field_id = packer.raw_unpack_uint16(); DCField *field = dclass->get_field_by_index(field_id); if (true) {//field->is_broadcast()) { diff --git a/dtool/src/prc/encryptStreamBuf.cxx b/dtool/src/prc/encryptStreamBuf.cxx index 21a33f93c0..dc38ac5894 100644 --- a/dtool/src/prc/encryptStreamBuf.cxx +++ b/dtool/src/prc/encryptStreamBuf.cxx @@ -146,14 +146,15 @@ open_read(istream *source, bool owns_source, const string &password) { int iv_length = EVP_CIPHER_iv_length(cipher); _read_block_size = EVP_CIPHER_block_size(cipher); - string iv = sr.extract_bytes(iv_length); + unsigned char *iv = (unsigned char *)alloca(iv_length); + iv_length = (int)sr.extract_bytes(iv, iv_length); _read_ctx = EVP_CIPHER_CTX_new(); nassertv(_read_ctx != NULL); // Initialize the context int result; - result = EVP_DecryptInit(_read_ctx, cipher, NULL, (unsigned char *)iv.data()); + result = EVP_DecryptInit(_read_ctx, cipher, NULL, (unsigned char *)iv); nassertv(result > 0); result = EVP_CIPHER_CTX_set_key_length(_read_ctx, key_length); @@ -170,7 +171,7 @@ open_read(istream *source, bool owns_source, const string &password) { unsigned char *key = (unsigned char *)alloca(key_length); result = PKCS5_PBKDF2_HMAC_SHA1((const char *)password.data(), password.length(), - (unsigned char *)iv.data(), iv.length(), + iv, iv_length, count * iteration_count_factor + 1, key_length, key); nassertv(result > 0); diff --git a/dtool/src/prc/streamReader.cxx b/dtool/src/prc/streamReader.cxx index 17252f5dd2..e9fa173ad1 100644 --- a/dtool/src/prc/streamReader.cxx +++ b/dtool/src/prc/streamReader.cxx @@ -117,16 +117,18 @@ extract_bytes(unsigned char *into, size_t size) { * Extracts the indicated number of bytes in the stream and returns them as a * string. Returns empty string at end-of-file. */ -string StreamReader:: +vector_uchar StreamReader:: extract_bytes(size_t size) { + vector_uchar buffer; if (_in->eof() || _in->fail()) { - return string(); + return buffer; } - char *buffer = (char *)alloca(size); - _in->read(buffer, size); + buffer.resize(size); + _in->read((char *)&buffer[0], size); size_t read_bytes = _in->gcount(); - return string(buffer, read_bytes); + buffer.resize(read_bytes); + return buffer; } /** diff --git a/dtool/src/prc/streamReader.h b/dtool/src/prc/streamReader.h index bedaa0eeb5..1643dd4a9c 100644 --- a/dtool/src/prc/streamReader.h +++ b/dtool/src/prc/streamReader.h @@ -19,6 +19,7 @@ #include "numeric_types.h" #include "littleEndian.h" #include "bigEndian.h" +#include "vector_uchar.h" /** * A class to read sequential binary data directly from an istream. Its @@ -71,7 +72,7 @@ PUBLISHED: EXTENSION(BLOCKING PyObject *readlines()); public: - BLOCKING string extract_bytes(size_t size); + BLOCKING vector_uchar extract_bytes(size_t size); BLOCKING string readline(); private: diff --git a/panda/src/downloader/downloadDb.cxx b/panda/src/downloader/downloadDb.cxx index f2a734af17..a210fba8bd 100644 --- a/panda/src/downloader/downloadDb.cxx +++ b/panda/src/downloader/downloadDb.cxx @@ -583,9 +583,7 @@ add_multifile_record(PT(MultifileRecord) mfr) { * Verifies magic number, returns the number of multifiles or -1 if invalid */ int DownloadDb::Db:: -parse_header(const string &data) { - Datagram dg(data); - +parse_header(Datagram dg) { // Make sure we have a good header DatagramIterator di(dg); uint32_t magic_number = di.get_uint32(); @@ -623,8 +621,7 @@ parse_header(const string &data) { * record */ int DownloadDb::Db:: -parse_record_header(const string &data) { - Datagram dg(data); +parse_record_header(Datagram dg) { DatagramIterator di(dg); int32_t record_length = di.get_int32(); downloader_cat.spam() @@ -639,14 +636,12 @@ parse_record_header(const string &data) { * Parses a multifile record (mfr) and returns one */ PT(DownloadDb::MultifileRecord) DownloadDb::Db:: -parse_mfr(const string &data) { +parse_mfr(Datagram dg) { PT(DownloadDb::MultifileRecord) mfr = new DownloadDb::MultifileRecord; - Datagram dg(data); DatagramIterator di(dg); - int32_t mfr_name_length = di.get_int32(); - mfr->_name = di.extract_bytes(mfr_name_length); + mfr->_name = di.get_string32(); mfr->_phase = di.get_float64(); mfr->_size = di.get_int32(); mfr->_status = di.get_int32(); @@ -676,14 +671,12 @@ parse_mfr(const string &data) { * Parses a file record (fr) and returns one */ PT(DownloadDb::FileRecord) DownloadDb::Db:: -parse_fr(const string &data) { +parse_fr(Datagram dg) { PT(DownloadDb::FileRecord) fr = new DownloadDb::FileRecord; - Datagram dg(data); DatagramIterator di(dg); - int32_t fr_name_length = di.get_int32(); - fr->_name = di.extract_bytes(fr_name_length); + fr->_name = di.get_string32(); // At one time, we stored files in the database with a backslash separator. // Nowadays we use a forward slash, but we should make sure we properly @@ -706,15 +699,14 @@ parse_fr(const string &data) { bool DownloadDb::Db:: read(StreamReader &sr, bool want_server_info) { // Read the header - string header; - header = sr.extract_bytes(_header_length); + vector_uchar header = sr.extract_bytes(_header_length); if (header.size() != (size_t)_header_length) { downloader_cat.error() << "truncated db file" << endl; return false; } // Parse the header - int num_multifiles = parse_header(header); + int num_multifiles = parse_header(Datagram(move(header))); if (num_multifiles < 0) { downloader_cat.error() << "invalid db header" << endl; return false; @@ -727,26 +719,26 @@ read(StreamReader &sr, bool want_server_info) { // of the record int mfr_header_length = sizeof(int32_t); - string mfr_header = sr.extract_bytes(mfr_header_length); + vector_uchar mfr_header = sr.extract_bytes(mfr_header_length); if (mfr_header.size() != (size_t)mfr_header_length) { downloader_cat.error() << "invalid mfr header" << endl; return false; } // Parse the header - int mfr_length = parse_record_header(mfr_header); + int mfr_length = parse_record_header(Datagram(move(mfr_header))); // Ok, now that we know the size of the mfr, read it in Make a buffer to // read the multifile record into do not count the header length twice int read_length = (mfr_length - mfr_header_length); - string mfr_record = sr.extract_bytes(read_length); + vector_uchar mfr_record = sr.extract_bytes(read_length); if (mfr_record.size() != (size_t)read_length) { downloader_cat.error() << "invalid mfr record" << endl; return false; } // Parse the mfr - PT(DownloadDb::MultifileRecord) mfr = parse_mfr(mfr_record); + PT(DownloadDb::MultifileRecord) mfr = parse_mfr(Datagram(move(mfr_record))); // Only read in the individual file info if you are the server if (want_server_info) { @@ -758,27 +750,27 @@ read(StreamReader &sr, bool want_server_info) { int fr_header_length = sizeof(int32_t); // Read the header - string fr_header = sr.extract_bytes(fr_header_length); + vector_uchar fr_header = sr.extract_bytes(fr_header_length); if (fr_header.size() != (size_t)fr_header_length) { downloader_cat.error() << "invalid fr header" << endl; return false; } // Parse the header - int fr_length = parse_record_header(fr_header); + int fr_length = parse_record_header(Datagram(move(fr_header))); // Ok, now that we know the size of the mfr, read it in do not count // the header length twice int read_length = (fr_length - fr_header_length); - string fr_record = sr.extract_bytes(read_length); + vector_uchar fr_record = sr.extract_bytes(read_length); if (fr_record.size() != (size_t)read_length) { downloader_cat.error() << "invalid fr record" << endl; return false; } // Parse the file record - PT(DownloadDb::FileRecord) fr = parse_fr(fr_record); + PT(DownloadDb::FileRecord) fr = parse_fr(Datagram(move(fr_record))); // Add this file record to the current multifilerecord mfr->add_file_record(fr); @@ -900,12 +892,10 @@ write_header(ostream &write_stream) { // Write the number of multifiles dg.add_int32(get_num_multifiles()); - string msg = dg.get_message(); - // Seek back to the beginning of the write stream write_stream.seekp(0); // Overwrite the old bogus header with the real header - write_stream.write(msg.data(), msg.length()); + write_stream.write((const char *)dg.get_data(), dg.get_length()); return true; } @@ -1100,17 +1090,8 @@ read_version_map(StreamReader &sr) { for (int i = 0; i < num_entries; i++) { - // Get the length of the file name - int name_length = sr.get_int32(); - if (sr.get_istream()->fail()) { - return false; - } - downloader_cat.spam() - << "DownloadDb::read_version_map() - name length: " << name_length - << endl; - // Get the file name - string name = sr.extract_bytes(name_length); + string name = sr.get_string32(); downloader_cat.spam() << "DownloadDb::read_version_map() - name: " << name << endl; diff --git a/panda/src/downloader/downloadDb.h b/panda/src/downloader/downloadDb.h index 02adedb3d6..b7f206c3b6 100644 --- a/panda/src/downloader/downloadDb.h +++ b/panda/src/downloader/downloadDb.h @@ -171,10 +171,10 @@ public: bool multifile_exists(string mfname) const; PT(MultifileRecord) get_multifile_record_named(string mfname) const; void add_multifile_record(PT(MultifileRecord) mfr); - int parse_header(const string &data); - int parse_record_header(const string &data); - PT(MultifileRecord) parse_mfr(const string &data); - PT(FileRecord) parse_fr(const string &data); + int parse_header(Datagram dg); + int parse_record_header(Datagram dg); + PT(MultifileRecord) parse_mfr(Datagram dg); + PT(FileRecord) parse_fr(Datagram dg); bool read(StreamReader &sr, bool want_server_info); bool write(StreamWriter &sw, bool want_server_info); Filename _filename; diff --git a/panda/src/downloader/socketStream.cxx b/panda/src/downloader/socketStream.cxx index af43847fb5..4e441f8f2b 100644 --- a/panda/src/downloader/socketStream.cxx +++ b/panda/src/downloader/socketStream.cxx @@ -50,17 +50,17 @@ SSReader:: bool SSReader:: do_receive_datagram(Datagram &dg) { if (_tcp_header_size == 0) { - _data_expected = _data_so_far.length(); + _data_expected = _data_so_far.size(); } if (_data_expected == 0) { // Read the first two bytes: the datagram length. - while ((int)_data_so_far.length() < _tcp_header_size) { + while ((int)_data_so_far.size() < _tcp_header_size) { int ch = _istream->get(); if (_istream->eof() || _istream->fail()) { _istream->clear(); return false; } - _data_so_far += (char)ch; + _data_so_far.push_back((unsigned char)ch); } Datagram header(_data_so_far); @@ -70,7 +70,7 @@ do_receive_datagram(Datagram &dg) { } else if (_tcp_header_size == 4) { _data_expected = di.get_uint32(); } - _data_so_far = _data_so_far.substr(_tcp_header_size); + _data_so_far.erase(_data_so_far.begin(), _data_so_far.begin() + _tcp_header_size); if (_data_expected == 0) { // Empty datagram. @@ -84,20 +84,19 @@ do_receive_datagram(Datagram &dg) { static const size_t buffer_size = 1024; char buffer[buffer_size]; - size_t read_count = min(_data_expected - _data_so_far.length(), - buffer_size); + size_t read_count = min(_data_expected - _data_so_far.size(), buffer_size); _istream->read(buffer, read_count); size_t count = _istream->gcount(); while (count != 0) { - _data_so_far.append(buffer, count); + _data_so_far.insert(_data_so_far.end(), buffer, buffer + count); - read_count = min(_data_expected - _data_so_far.length(), + read_count = min(_data_expected - _data_so_far.size(), buffer_size); _istream->read(buffer, read_count); count = _istream->gcount(); } - if (_data_so_far.length() < _data_expected) { + if (_data_so_far.size() < _data_expected) { // Not yet here. Clear the istream error flag and return false to // indicate more coming. _istream->clear(); @@ -108,7 +107,7 @@ do_receive_datagram(Datagram &dg) { dg.append_data(_data_so_far); _data_expected = 0; - _data_so_far = string(); + _data_so_far.clear(); return true; } diff --git a/panda/src/downloader/socketStream.h b/panda/src/downloader/socketStream.h index 36065e42af..84ce907a5e 100644 --- a/panda/src/downloader/socketStream.h +++ b/panda/src/downloader/socketStream.h @@ -21,6 +21,7 @@ #include "pdeque.h" #include "typedReferenceCount.h" #include "pointerTo.h" +#include "vector_uchar.h" // At the present, this module is not compiled if OpenSSL is not available, // since the only current use for it is to implement OpenSSL-defined @@ -54,7 +55,7 @@ private: istream *_istream; size_t _data_expected; - string _data_so_far; + vector_uchar _data_so_far; int _tcp_header_size; #ifdef SIMULATE_NETWORK_DELAY diff --git a/panda/src/express/datagram.I b/panda/src/express/datagram.I index fa6063805b..3bd7812969 100644 --- a/panda/src/express/datagram.I +++ b/panda/src/express/datagram.I @@ -42,58 +42,16 @@ Datagram(const void *data, size_t size) : * Constructs a datagram from an existing block of data. */ INLINE Datagram:: -Datagram(const string &data) : +Datagram(vector_uchar data) : + _data(move(data)), #ifdef STDFLOAT_DOUBLE _stdfloat_double(true) #else _stdfloat_double(false) #endif { - append_data(data); } -/** - * - */ -INLINE Datagram:: -Datagram(const Datagram ©) : - _data(copy._data), - _stdfloat_double(copy._stdfloat_double) -{ -} - -/** - * - */ -INLINE void Datagram:: -operator = (const Datagram ©) { - _data = copy._data; - _stdfloat_double = copy._stdfloat_double; -} - -#ifdef USE_MOVE_SEMANTICS -/** - * - */ -INLINE Datagram:: -Datagram(Datagram &&from) NOEXCEPT : - _data(move(from._data)), - _stdfloat_double(from._stdfloat_double) -{ -} -#endif // USE_MOVE_SEMANTICS - -#ifdef USE_MOVE_SEMANTICS -/** - * - */ -INLINE void Datagram:: -operator = (Datagram &&from) NOEXCEPT { - _data = move(from._data); - _stdfloat_double = from._stdfloat_double; -} -#endif // USE_MOVE_SEMANTICS - /** * Adds a boolean value to the datagram. */ @@ -291,7 +249,7 @@ add_string(const string &str) { add_uint16((uint16_t)str.length()); // Add the string - append_data(str); + append_data(str.data(), str.length()); } /** @@ -304,18 +262,18 @@ add_string32(const string &str) { add_uint32((uint32_t)str.length()); // Add the string - append_data(str); + append_data(str.data(), str.length()); } /** * Adds a variable-length string to the datagram, as a NULL-terminated string. */ INLINE void Datagram:: -add_z_string(string str) { +add_z_string(const string &str) { // We must not have any nested null characters in the string. size_t null_pos = str.find('\0'); // Add the string (sans the null character). - append_data(str.substr(0, null_pos)); + append_data(str.data(), std::min(null_pos, str.length())); // And the null character. add_uint8('\0'); @@ -329,11 +287,11 @@ add_z_string(string str) { INLINE void Datagram:: add_fixed_string(const string &str, size_t size) { if (str.length() < size) { - append_data(str); + append_data(str.data(), str.length()); pad_bytes(size - str.length()); } else { // str.length() >= size - append_data(str.substr(0, size)); + append_data(str.data(), size); } } @@ -341,8 +299,8 @@ add_fixed_string(const string &str, size_t size) { * Appends some more raw data to the end of the datagram. */ INLINE void Datagram:: -append_data(const string &data) { - append_data(data.data(), data.length()); +append_data(const vector_uchar &data) { + append_data(data.data(), data.size()); } /** diff --git a/panda/src/express/datagram.h b/panda/src/express/datagram.h index c2cb3b4c8b..9250ac89d3 100644 --- a/panda/src/express/datagram.h +++ b/panda/src/express/datagram.h @@ -39,14 +39,7 @@ class EXPCL_PANDAEXPRESS Datagram : public TypedObject { PUBLISHED: INLINE Datagram(); INLINE Datagram(const void *data, size_t size); - INLINE Datagram(const string &data); - INLINE Datagram(const Datagram ©); - INLINE void operator = (const Datagram ©); - -#ifdef USE_MOVE_SEMANTICS - INLINE Datagram(Datagram &&from) NOEXCEPT; - INLINE void operator = (Datagram &&from) NOEXCEPT; -#endif + INLINE explicit Datagram(vector_uchar data); virtual ~Datagram(); @@ -80,13 +73,13 @@ PUBLISHED: INLINE void add_string(const string &str); INLINE void add_string32(const string &str); - INLINE void add_z_string(string str); + INLINE void add_z_string(const string &str); INLINE void add_fixed_string(const string &str, size_t size); void add_wstring(const wstring &str); void pad_bytes(size_t size); void append_data(const void *data, size_t size); - INLINE void append_data(const string &data); + INLINE void append_data(const vector_uchar &data); void assign(const void *data, size_t size); diff --git a/panda/src/express/datagramIterator.I b/panda/src/express/datagramIterator.I index cefde399f2..42c25eeed4 100644 --- a/panda/src/express/datagramIterator.I +++ b/panda/src/express/datagramIterator.I @@ -422,14 +422,13 @@ skip_bytes(size_t size) { * Returns the remaining bytes in the datagram as a string, but does not * extract them from the iterator. */ -INLINE string DatagramIterator:: +INLINE vector_uchar DatagramIterator:: get_remaining_bytes() const { - nassertr(_datagram != (const Datagram *)NULL, ""); - nassertr(_current_index <= _datagram->get_length(), ""); + nassertr(_datagram != (const Datagram *)NULL, vector_uchar()); + nassertr(_current_index <= _datagram->get_length(), vector_uchar()); - const char *ptr = (const char *)_datagram->get_data(); - size_t remaining_size = _datagram->get_length() - _current_index; - return string(ptr + _current_index, remaining_size); + const unsigned char *ptr = (const unsigned char *)_datagram->get_data(); + return vector_uchar(ptr + _current_index, ptr + _datagram->get_length()); } /** diff --git a/panda/src/express/datagramIterator.cxx b/panda/src/express/datagramIterator.cxx index 22ac9ecb19..880719f32b 100644 --- a/panda/src/express/datagramIterator.cxx +++ b/panda/src/express/datagramIterator.cxx @@ -119,18 +119,18 @@ get_wstring() { * Extracts the indicated number of bytes in the datagram and returns them as * a string. */ -string DatagramIterator:: +vector_uchar DatagramIterator:: extract_bytes(size_t size) { - nassertr((int)size >= 0, ""); - nassertr(_datagram != (const Datagram *)NULL, ""); - nassertr(_current_index + size <= _datagram->get_length(), ""); + nassertr((int)size >= 0, vector_uchar()); + nassertr(_datagram != (const Datagram *)NULL, vector_uchar()); + nassertr(_current_index + size <= _datagram->get_length(), vector_uchar()); - const char *ptr = (const char *)_datagram->get_data(); - size_t last_index = _current_index; + const unsigned char *ptr = (const unsigned char *)_datagram->get_data(); + ptr += _current_index; _current_index += size; - return string(ptr + last_index, size); + return vector_uchar(ptr, ptr + size); } /** diff --git a/panda/src/express/datagramIterator.h b/panda/src/express/datagramIterator.h index 7126901324..ec76be3f07 100644 --- a/panda/src/express/datagramIterator.h +++ b/panda/src/express/datagramIterator.h @@ -62,10 +62,10 @@ PUBLISHED: wstring get_wstring(); INLINE void skip_bytes(size_t size); - string extract_bytes(size_t size); + vector_uchar extract_bytes(size_t size); size_t extract_bytes(unsigned char *into, size_t size); - INLINE string get_remaining_bytes() const; + INLINE vector_uchar get_remaining_bytes() const; INLINE size_t get_remaining_size() const; INLINE const Datagram &get_datagram() const; diff --git a/panda/src/express/hashVal.cxx b/panda/src/express/hashVal.cxx index 7d52dc5a5e..aa08714668 100644 --- a/panda/src/express/hashVal.cxx +++ b/panda/src/express/hashVal.cxx @@ -143,11 +143,11 @@ set_from_hex(const string &text) { /** * Returns the HashVal as a 16-byte binary string. */ -string HashVal:: +vector_uchar HashVal:: as_bin() const { Datagram dg; write_datagram(dg); - return dg.get_message(); + return vector_uchar((unsigned char *)dg.get_data(), (unsigned char *)dg.get_data() + dg.get_length()); } /** @@ -155,7 +155,7 @@ as_bin() const { * false otherwise. */ bool HashVal:: -set_from_bin(const string &text) { +set_from_bin(const vector_uchar &text) { nassertr(text.size() == 16, false); Datagram dg(text); DatagramIterator dgi(dg); diff --git a/panda/src/express/hashVal.h b/panda/src/express/hashVal.h index d0652d1e01..a4b3754614 100644 --- a/panda/src/express/hashVal.h +++ b/panda/src/express/hashVal.h @@ -55,8 +55,8 @@ PUBLISHED: string as_hex() const; bool set_from_hex(const string &text); - string as_bin() const; - bool set_from_bin(const string &text); + vector_uchar as_bin() const; + bool set_from_bin(const vector_uchar &text); INLINE void write_datagram(Datagram &destination) const; INLINE void read_datagram(DatagramIterator &source); diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index 0d98849efe..5a7d86f17b 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -2402,7 +2402,7 @@ check_signatures() { nassertv(stream != NULL); StreamReader reader(*stream); size_t sig_size = reader.get_uint32(); - string sig_string = reader.extract_bytes(sig_size); + vector_uchar sig_data = reader.extract_bytes(sig_size); size_t num_certs = reader.get_uint32(); @@ -2470,9 +2470,7 @@ check_signatures() { // Now check that the signature matches the hash. int verify_result = - EVP_VerifyFinal(md_ctx, - (unsigned char *)sig_string.data(), - sig_string.size(), pkey); + EVP_VerifyFinal(md_ctx, sig_data.data(), sig_data.size(), pkey); if (verify_result == 1) { // The signature matches; save the certificate and its chain. _signatures.push_back(chain); diff --git a/panda/src/express/pointerToArray.I b/panda/src/express/pointerToArray.I index c3a10f3737..535de63d01 100644 --- a/panda/src/express/pointerToArray.I +++ b/panda/src/express/pointerToArray.I @@ -92,6 +92,19 @@ PointerToArray(PointerToArray &&from) NOEXCEPT : } #endif // USE_MOVE_SEMANTICS +#ifdef USE_MOVE_SEMANTICS +/** + * Initializes the PTA from a vector. + */ +template +INLINE PointerToArray:: +PointerToArray(pvector &&from, TypeHandle type_handle) : + PointerToArrayBase(new ReferenceCountedVector(move(from))), + _type_handle(type_handle) +{ +} +#endif // USE_MOVE_SEMANTICS + /** * */ @@ -710,6 +723,19 @@ ConstPointerToArray(ConstPointerToArray &&from) NOEXCEPT : } #endif // USE_MOVE_SEMANTICS +#ifdef USE_MOVE_SEMANTICS +/** + * Initializes the PTA from a vector. + */ +template +INLINE ConstPointerToArray:: +ConstPointerToArray(pvector &&from, TypeHandle type_handle) : + PointerToArrayBase(new ReferenceCountedVector(move(from))), + _type_handle(type_handle) +{ +} +#endif // USE_MOVE_SEMANTICS + /** * */ diff --git a/panda/src/express/pointerToArray.h b/panda/src/express/pointerToArray.h index 762a6cb8ce..4e8a052e0f 100644 --- a/panda/src/express/pointerToArray.h +++ b/panda/src/express/pointerToArray.h @@ -141,6 +141,7 @@ public: #ifdef USE_MOVE_SEMANTICS INLINE PointerToArray(PointerToArray &&from) NOEXCEPT; + INLINE explicit PointerToArray(pvector &&from, TypeHandle type_handle = get_type_handle(Element)); #endif public: @@ -302,6 +303,7 @@ PUBLISHED: #ifdef USE_MOVE_SEMANTICS INLINE ConstPointerToArray(PointerToArray &&from) NOEXCEPT; INLINE ConstPointerToArray(ConstPointerToArray &&from) NOEXCEPT; + INLINE explicit ConstPointerToArray(pvector &&from, TypeHandle type_handle = get_type_handle(Element)); #endif // Duplicating the interface of vector. diff --git a/panda/src/express/pointerToArrayBase.I b/panda/src/express/pointerToArrayBase.I index 89acba1206..de8c17d843 100644 --- a/panda/src/express/pointerToArrayBase.I +++ b/panda/src/express/pointerToArrayBase.I @@ -39,6 +39,16 @@ ReferenceCountedVector(const Element *begin, const Element *end, TypeHandle type { } +/** + * Creates an array that takes its elements from the given vector. + */ +template +INLINE ReferenceCountedVector:: +ReferenceCountedVector(pvector &&from) : + pvector(move(from)) +{ +} + /** * */ diff --git a/panda/src/express/pointerToArrayBase.h b/panda/src/express/pointerToArrayBase.h index 3220ca4c70..8c33f69be2 100644 --- a/panda/src/express/pointerToArrayBase.h +++ b/panda/src/express/pointerToArrayBase.h @@ -43,6 +43,7 @@ public: INLINE ReferenceCountedVector(TypeHandle type_handle); INLINE ReferenceCountedVector(size_type initial_size, TypeHandle type_handle); INLINE ReferenceCountedVector(const Element *begin, const Element *end, TypeHandle type_handle); + INLINE ReferenceCountedVector(pvector &&from); ALLOC_DELETED_CHAIN(ReferenceCountedVector); INLINE size_type size() const; diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index c4a8149ab4..5328b921d9 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -4207,7 +4207,9 @@ bool Texture:: do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only) { StreamReader ktx(in); - if (ktx.extract_bytes(12) != "\xABKTX 11\xBB\r\n\x1A\n") { + unsigned char magic[12]; + if (ktx.extract_bytes(magic, 12) != 12 || + memcmp(magic, "\xABKTX 11\xBB\r\n\x1A\n", 12) != 0) { gobj_cat.error() << filename << " is not a KTX file.\n"; return false; diff --git a/panda/src/movies/wavAudioCursor.cxx b/panda/src/movies/wavAudioCursor.cxx index 3b220749c4..ccfaa9733e 100644 --- a/panda/src/movies/wavAudioCursor.cxx +++ b/panda/src/movies/wavAudioCursor.cxx @@ -106,7 +106,8 @@ WavAudioCursor(WavAudio *src, istream *stream) : nassertv(stream != NULL); // Beginning of "RIFF" chunk. - if (_reader.extract_bytes(4) != "RIFF") { + unsigned char magic[4]; + if (_reader.extract_bytes(magic, 4) != 4 || memcmp(magic, "RIFF", 4) != 0) { movies_cat.error() << ".wav file is not a valid RIFF file.\n"; return; @@ -114,7 +115,7 @@ WavAudioCursor(WavAudio *src, istream *stream) : unsigned int chunk_size = _reader.get_uint32(); - if (_reader.extract_bytes(4) != "WAVE") { + if (_reader.extract_bytes(magic, 4) != 4 || memcmp(magic, "WAVE", 4) != 0) { movies_cat.error() << ".wav file is a RIFF file but does not start with a WAVE chunk.\n"; return; @@ -126,10 +127,10 @@ WavAudioCursor(WavAudio *src, istream *stream) : while ((!have_fmt || !have_data) && _stream->good() && (bytes_read + 8) < chunk_size) { - string subchunk_id = _reader.extract_bytes(4); + _reader.extract_bytes(magic, 4); unsigned int subchunk_size = _reader.get_uint32(); - if (subchunk_id == "fmt ") { + if (memcmp(magic, "fmt ", 4) == 0) { // The format chunk specifies information about the storage. nassertv(subchunk_size >= 16); have_fmt = true; @@ -202,7 +203,7 @@ WavAudioCursor(WavAudio *src, istream *stream) : _reader.skip_bytes(subchunk_size - read_bytes); } - } else if (subchunk_id == "data") { + } else if (memcmp(magic, "data", 4) == 0) { // The data chunk contains the actual sammples. if (!have_fmt) { movies_cat.error() diff --git a/panda/src/recorder/socketStreamRecorder.cxx b/panda/src/recorder/socketStreamRecorder.cxx index 1b9493fc03..6209239044 100644 --- a/panda/src/recorder/socketStreamRecorder.cxx +++ b/panda/src/recorder/socketStreamRecorder.cxx @@ -82,8 +82,10 @@ play_frame(DatagramIterator &scan, BamReader *manager) { int num_packets = scan.get_uint16(); for (int i = 0; i < num_packets; i++) { - string packet = scan.get_string(); - _data.push_back(Datagram(packet)); + size_t size = scan.get_uint16(); + vector_uchar packet(size); + scan.extract_bytes(&packet[0], size); + _data.push_back(Datagram(move(packet))); } } diff --git a/pandatool/src/flt/fltBeadID.cxx b/pandatool/src/flt/fltBeadID.cxx index 6346d6282e..f55d3e88cc 100644 --- a/pandatool/src/flt/fltBeadID.cxx +++ b/pandatool/src/flt/fltBeadID.cxx @@ -78,9 +78,8 @@ extract_record(FltRecordReader &reader) { bool FltBeadID:: extract_ancillary(FltRecordReader &reader) { if (reader.get_opcode() == FO_long_id) { - string s = reader.get_iterator().get_remaining_bytes(); - size_t zero_byte = s.find('\0'); - _id = s.substr(0, zero_byte); + vector_uchar s = reader.get_iterator().get_remaining_bytes(); + _id.assign((const char *)s.data(), strnlen((const char *)s.data(), s.size())); return true; } @@ -109,14 +108,11 @@ build_record(FltRecordWriter &writer) const { FltError FltBeadID:: write_ancillary(FltRecordWriter &writer) const { if (_id.length() > 7) { + Datagram dc; // Although the manual mentions nothing of this, it is essential that the // length of the record be a multiple of 4 bytes. - string id = _id; - while ((id.length() % 4) != 0) { - id += '\0'; - } - Datagram dc(id); + dc.add_fixed_string(_id, (_id.length() + 3) & ~3); FltError result = writer.write_record(FO_long_id, dc); if (result != FE_ok) { diff --git a/pandatool/src/flt/fltRecord.cxx b/pandatool/src/flt/fltRecord.cxx index c3dc21d070..a0af83e180 100644 --- a/pandatool/src/flt/fltRecord.cxx +++ b/pandatool/src/flt/fltRecord.cxx @@ -621,7 +621,8 @@ extract_record(FltRecordReader &) { bool FltRecord:: extract_ancillary(FltRecordReader &reader) { if (reader.get_opcode() == FO_comment) { - _comment = reader.get_iterator().get_remaining_bytes(); + vector_uchar s = reader.get_iterator().get_remaining_bytes(); + _comment.assign((const char *)s.data(), strnlen((const char *)s.data(), s.size())); return true; } @@ -735,7 +736,7 @@ build_record(FltRecordWriter &) const { FltError FltRecord:: write_ancillary(FltRecordWriter &writer) const { if (!_comment.empty()) { - Datagram dc(_comment); + Datagram dc(_comment.data(), _comment.size()); FltError result = writer.write_record(FO_comment, dc); if (result != FE_ok) { return result; From 7cbdd3b6c49312b90489ba7ebfce5b2b0f22910b Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Apr 2018 21:36:10 +0200 Subject: [PATCH 47/55] gobj: release GIL for (un)compress_ram_image --- panda/src/gobj/texture.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/gobj/texture.h b/panda/src/gobj/texture.h index 5816b8c538..890710a216 100644 --- a/panda/src/gobj/texture.h +++ b/panda/src/gobj/texture.h @@ -464,10 +464,10 @@ PUBLISHED: MAKE_PROPERTY(keep_ram_image, get_keep_ram_image, set_keep_ram_image); MAKE_PROPERTY(cacheable, is_cacheable); - INLINE bool compress_ram_image(CompressionMode compression = CM_on, - QualityLevel quality_level = QL_default, - GraphicsStateGuardianBase *gsg = NULL); - INLINE bool uncompress_ram_image(); + BLOCKING INLINE bool compress_ram_image(CompressionMode compression = CM_on, + QualityLevel quality_level = QL_default, + GraphicsStateGuardianBase *gsg = NULL); + BLOCKING INLINE bool uncompress_ram_image(); INLINE int get_num_ram_mipmap_images() const; INLINE bool has_ram_mipmap_image(int n) const; From 94476fd1f0e402a237f1b4cf5d77347a7ec4f682 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Apr 2018 21:46:01 +0200 Subject: [PATCH 48/55] glgsg: fix invalid operation error with multisample FBO Panda is forgetting to reset the current FBO when resolving multisamples. --- panda/src/glstuff/glGraphicsBuffer_src.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index 43f3dbd809..35daa0b225 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -1767,6 +1767,7 @@ resolve_multisamples() { } glgsg->_glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, fbo); glgsg->_glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, _fbo_multisample); + glgsg->_current_fbo = fbo; // If the depth buffer is shared, resolve it only on the last to render FBO. bool do_depth_blit = false; From 552a649ef3fcad1690f99e53b1d50e7494bce21c Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Apr 2018 21:48:02 +0200 Subject: [PATCH 49/55] interrogate: add back NULL definition, fixes some keyword arguments I am not sure why the definition of NULL was removed; it might have been by mistake, but in any case it broke code like this: img = PNMImage(w, h, color_space=CS_srgb) since it would not understand the default value (NULL) for the argument preceding color_space. --- dtool/src/parser-inc/stdtypedefs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dtool/src/parser-inc/stdtypedefs.h b/dtool/src/parser-inc/stdtypedefs.h index c1febd3955..f971d7e1f2 100644 --- a/dtool/src/parser-inc/stdtypedefs.h +++ b/dtool/src/parser-inc/stdtypedefs.h @@ -41,6 +41,11 @@ inline namespace std { struct timeval; +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void *)0) +#endif typedef decltype(nullptr) nullptr_t; // One day, we might extend interrogate to be able to parse this, From 7125a3e5877edc056b6e076285b54f3869dce9f6 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 5 Apr 2018 20:49:13 +0200 Subject: [PATCH 50/55] interrogate: allow passing None for args that have NULL as default value --- .../interfaceMakerPythonNative.cxx | 64 ++++++++++++++++--- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 96420ef663..5ae2d3fca9 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -5414,6 +5414,18 @@ write_function_instance(ostream &out, FunctionRemap *remap, parameter_list += ", &" + param_name; } + // If the default value is NULL, we also accept a None value. + bool maybe_none = false; + if (default_value != nullptr && (return_flags & RF_coerced) == 0) { + CPPExpression::Result res = param->get_default_value()->evaluate(); + if (res._type == CPPExpression::RT_integer || + res._type == CPPExpression::RT_pointer) { + if (res.as_integer() == 0) { + maybe_none = true; + } + } + } + string class_name = obj_type->get_local_name(&parser); // need to a forward scope for this class.. @@ -5464,17 +5476,27 @@ write_function_instance(ostream &out, FunctionRemap *remap, type->output_instance(extra_convert, param_name + "_this", &parser); - if (is_optional) { + if (is_optional && maybe_none) { + extra_convert + << default_expr << ";\n" + << "if (" << param_name << " != NULL && " << param_name << " != Py_None) {\n" + << " " << param_name << "_this"; + } else if (is_optional) { extra_convert << default_expr << ";\n" << "if (" << param_name << " != NULL) {\n" << " " << param_name << "_this"; + } else if (maybe_none) { + extra_convert + << " = NULL;\n" + << "if (" << param_name << " != Py_None) {\n" + << " " << param_name << "_this"; } extra_convert << " = Dtool_Coerce_" + make_safe_name(class_name) + "(" + param_name + ", " + param_name + "_local);\n"; - if (is_optional) { + if (is_optional || maybe_none) { extra_convert << "}\n"; } @@ -5485,8 +5507,12 @@ write_function_instance(ostream &out, FunctionRemap *remap, if (report_errors) { // We were asked to report any errors. Let's do it. - if (is_optional) { + if (is_optional && maybe_none) { + extra_convert << "if (" << param_name << " != NULL && " << param_name << " != Py_None && !" << coerce_call << ") {\n"; + } else if (is_optional) { extra_convert << "if (" << param_name << " != NULL && !" << coerce_call << ") {\n"; + } else if (maybe_none) { + extra_convert << "if (" << param_name << " != Py_None && !" << coerce_call << ") {\n"; } else { extra_convert << "if (!" << coerce_call << ") {\n"; } @@ -5509,19 +5535,35 @@ write_function_instance(ostream &out, FunctionRemap *remap, } extra_convert << "}\n"; + } else if (is_optional && maybe_none) { + extra_param_check << " && (" << param_name << " == NULL || " << param_name << " == Py_None || " << coerce_call << ")"; + } else if (is_optional) { extra_param_check << " && (" << param_name << " == NULL || " << coerce_call << ")"; + } else if (maybe_none) { + extra_param_check << " && (" << param_name << " == Py_None || " << coerce_call << ")"; + } else { extra_param_check << " && " << coerce_call; } - } else { + } else { // The regular, non-coercion case. type->output_instance(extra_convert, param_name + "_this", &parser); - if (is_optional) { + if (is_optional && maybe_none) { extra_convert << default_expr << ";\n" - << "if (" << param_name << " != (PyObject *)NULL) {\n" + << "if (" << param_name << " != NULL && " << param_name << " != Py_None) {\n" + << " " << param_name << "_this"; + } else if (is_optional) { + extra_convert + << default_expr << ";\n" + << "if (" << param_name << " != NULL) {\n" + << " " << param_name << "_this"; + } else if (maybe_none) { + extra_convert + << " = NULL;\n" + << "if (" << param_name << " != Py_None) {\n" << " " << param_name << "_this"; } if (const_ok && !report_errors) { @@ -5529,7 +5571,7 @@ write_function_instance(ostream &out, FunctionRemap *remap, // simpler. But maybe we should just reorganize these functions // entirely? extra_convert << " = NULL;\n"; - int indent_level = is_optional ? 2 : 0; + int indent_level = (is_optional || maybe_none) ? 2 : 0; indent(extra_convert, indent_level) << "DtoolInstance_GetPointer(" << param_name << ", " << param_name << "_this" @@ -5545,9 +5587,15 @@ write_function_instance(ostream &out, FunctionRemap *remap, << "\", " << const_ok << ", " << report_errors << ");\n"; } - if (is_optional) { + if (is_optional && maybe_none) { + extra_convert << "}\n"; + extra_param_check << " && (" << param_name << " == NULL || " << param_name << " == Py_None || " << param_name << "_this != NULL)"; + } else if (is_optional) { extra_convert << "}\n"; extra_param_check << " && (" << param_name << " == NULL || " << param_name << "_this != NULL)"; + } else if (maybe_none) { + extra_convert << "}\n"; + extra_param_check << " && (" << param_name << " == Py_None || " << param_name << "_this != NULL)"; } else { extra_param_check << " && " << param_name << "_this != NULL"; } From de6d753f79886ab45d8c3cec6b231d15afe64d94 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 6 Apr 2018 17:16:18 +0200 Subject: [PATCH 51/55] net: don't use get_message() when constructing datagram header This is causing an unnecessary copy operation. --- panda/src/net/datagramTCPHeader.cxx | 13 ++++++------- panda/src/net/datagramUDPHeader.cxx | 15 ++++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/panda/src/net/datagramTCPHeader.cxx b/panda/src/net/datagramTCPHeader.cxx index 533e3e671b..bd013f0c33 100644 --- a/panda/src/net/datagramTCPHeader.cxx +++ b/panda/src/net/datagramTCPHeader.cxx @@ -24,23 +24,23 @@ */ DatagramTCPHeader:: DatagramTCPHeader(const NetDatagram &datagram, int header_size) { - const string &str = datagram.get_message(); + size_t length = datagram.get_length(); switch (header_size) { case 0: break; case datagram_tcp16_header_size: { - uint16_t size = str.length(); - nassertv(size == str.length()); + uint16_t size = (uint16_t)length; + nassertv((size_t)size == length); _header.add_uint16(size); } break; case datagram_tcp32_header_size: { - uint32_t size = str.length(); - nassertv(size == str.length()); + uint32_t size = (uint32_t)length; + nassertv((size_t)size == length); _header.add_uint32(size); } break; @@ -93,8 +93,7 @@ verify_datagram(const NetDatagram &datagram, int header_size) const { return true; } - const string &str = datagram.get_message(); - int actual_size = str.length(); + int actual_size = (int)datagram.get_length(); int expected_size = get_datagram_size(header_size); if (actual_size == expected_size) { return true; diff --git a/panda/src/net/datagramUDPHeader.cxx b/panda/src/net/datagramUDPHeader.cxx index b491190187..2191c0241a 100644 --- a/panda/src/net/datagramUDPHeader.cxx +++ b/panda/src/net/datagramUDPHeader.cxx @@ -24,10 +24,11 @@ */ DatagramUDPHeader:: DatagramUDPHeader(const NetDatagram &datagram) { - const string &str = datagram.get_message(); + const unsigned char *begin = (const unsigned char *)datagram.get_data(); + const unsigned char *end = begin + datagram.get_length(); uint16_t checksum = 0; - for (size_t p = 0; p < str.size(); p++) { - checksum += (uint16_t)(uint8_t)str[p]; + for (const unsigned char *p = begin; p != end; ++p) { + checksum += (uint16_t)(uint8_t)*p; } // Now pack the header. @@ -49,11 +50,11 @@ DatagramUDPHeader(const void *data) : _header(data, datagram_udp_header_size) { */ bool DatagramUDPHeader:: verify_datagram(const NetDatagram &datagram) const { - const string &str = datagram.get_message(); - + const unsigned char *begin = (const unsigned char *)datagram.get_data(); + const unsigned char *end = begin + datagram.get_length(); uint16_t checksum = 0; - for (size_t p = 0; p < str.size(); p++) { - checksum += (uint16_t)(uint8_t)str[p]; + for (const unsigned char *p = begin; p != end; ++p) { + checksum += (uint16_t)(uint8_t)*p; } if (checksum == get_datagram_checksum()) { From b4d29e609657e15a807da4832aaed20373b5ab26 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 6 Apr 2018 17:41:12 +0200 Subject: [PATCH 52/55] express: allow using bytes() on Datagram Closes: #297 --- panda/src/express/datagram.I | 12 ++++++++++++ panda/src/express/datagram.h | 1 + tests/putil/test_datagram.py | 10 ++++++++++ 3 files changed, 23 insertions(+) diff --git a/panda/src/express/datagram.I b/panda/src/express/datagram.I index 3bd7812969..499bfab48b 100644 --- a/panda/src/express/datagram.I +++ b/panda/src/express/datagram.I @@ -316,6 +316,18 @@ get_message() const { } } +/** + * Returns the datagram's data as a bytes object. + */ +INLINE vector_uchar Datagram:: +__bytes__() const { + if (!_data.empty()) { + return vector_uchar(_data.v()); + } else { + return vector_uchar(); + } +} + /** * Returns a pointer to the beginning of the datagram's data. */ diff --git a/panda/src/express/datagram.h b/panda/src/express/datagram.h index 9250ac89d3..00a46ef36f 100644 --- a/panda/src/express/datagram.h +++ b/panda/src/express/datagram.h @@ -84,6 +84,7 @@ PUBLISHED: void assign(const void *data, size_t size); INLINE string get_message() const; + INLINE vector_uchar __bytes__() const; INLINE const void *get_data() const; INLINE size_t get_length() const; diff --git a/tests/putil/test_datagram.py b/tests/putil/test_datagram.py index 4a34bc88a2..ceadff67b8 100644 --- a/tests/putil/test_datagram.py +++ b/tests/putil/test_datagram.py @@ -76,6 +76,16 @@ def datagram_large(): return dg, readback_function +def test_datagram_bytes(): + """Tests that we can put and get a bytes object on Datagram.""" + dg = core.Datagram(b'abc\x00') + dg.append_data(b'\xff123') + assert bytes(dg) == b'abc\x00\xff123' + + dgi = core.DatagramIterator(dg) + dgi.get_remaining_bytes() == b'abc\x00\xff123' + + def test_iterator(datagram_small): """This tests Datagram/DatagramIterator, and sort of serves as a self-check of the test fixtures too.""" From 22f933a41970e285d6abc4fd6c5d19e50fd423de Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 6 Apr 2018 20:34:48 +0200 Subject: [PATCH 53/55] tests: disable datagram bytes() test on Python 2 See #297 --- tests/putil/test_datagram.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/putil/test_datagram.py b/tests/putil/test_datagram.py index ceadff67b8..1349bd5656 100644 --- a/tests/putil/test_datagram.py +++ b/tests/putil/test_datagram.py @@ -1,5 +1,6 @@ import pytest from panda3d import core +import sys # Fixtures for generating interesting datagrams (and verification functions) on # the fly... @@ -76,6 +77,7 @@ def datagram_large(): return dg, readback_function +@pytest.mark.skipif(sys.version_info < (3, 0), reason="Requires Python 3") def test_datagram_bytes(): """Tests that we can put and get a bytes object on Datagram.""" dg = core.Datagram(b'abc\x00') From d13464104c19be8cb5c41390a6db4aab58ca0817 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 6 Apr 2018 20:49:43 +0200 Subject: [PATCH 54/55] Fix compilation issue with --nothing on MSVC I have no idea why this error happens, but it does not seem worth the effort to investigate further, so I'm just reverting the previous change to this file. --- dtool/src/dtoolbase/pvector.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dtool/src/dtoolbase/pvector.h b/dtool/src/dtoolbase/pvector.h index b146947543..14bd542f37 100644 --- a/dtool/src/dtoolbase/pvector.h +++ b/dtool/src/dtoolbase/pvector.h @@ -46,9 +46,24 @@ public: typedef TYPENAME base_class::size_type size_type; explicit pvector(TypeHandle type_handle = pvector_type_handle) : base_class(allocator(type_handle)) { } + pvector(const pvector ©) : base_class(copy) { } explicit pvector(size_type n, TypeHandle type_handle = pvector_type_handle) : base_class(n, Type(), allocator(type_handle)) { } explicit pvector(size_type n, const Type &value, TypeHandle type_handle = pvector_type_handle) : base_class(n, value, allocator(type_handle)) { } pvector(const Type *begin, const Type *end, TypeHandle type_handle = pvector_type_handle) : base_class(begin, end, allocator(type_handle)) { } + +#ifdef USE_MOVE_SEMANTICS + pvector(pvector &&from) NOEXCEPT : base_class(move(from)) {}; + + pvector &operator =(pvector &&from) NOEXCEPT { + base_class::operator =(move(from)); + return *this; + } +#endif + + pvector &operator =(const pvector ©) { + base_class::operator =(copy); + return *this; + } }; #endif // USE_STL_ALLOCATOR From 753ae3974079ec54a49315381cecc091f25692ff Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Apr 2018 13:50:33 +0200 Subject: [PATCH 55/55] readme: use MSVC 2015 instead of 2010 (see #288) [skip ci] --- README.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fde01c38f0..cf45f0dfd2 100644 --- a/README.md +++ b/README.md @@ -43,24 +43,26 @@ Building Panda3D Windows ------- -We currently build using the Microsoft Visual C++ 2010 compiler. You do not -need Microsoft Visual Studio to build Panda3D, though - the relevant compilers -are included as part of the Windows 7.1 SDK. +We currently build using the Microsoft Visual C++ 2015 compiler. You will +also need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk), +and if you intend to target Windows XP, you will also need the +[Windows 7.1 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=8279). 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.4/panda3d-1.9.4-tools-win32.zip -https://www.panda3d.org/download/panda3d-1.9.4/panda3d-1.9.4-tools-win64.zip +depending on whether you are on a 32-bit or 64-bit system, or you can +[click here](https://github.com/rdb/panda3d-thirdparty) for instructions on +building them from source. -(It is also possible to build using MSVC 2015 and 2017, which requires a -different set of thirdparty libraries, but that is not described here.) +http://rdb.name/thirdparty-vc14-x64.7z +http://rdb.name/thirdparty-vc14.7z After acquiring these dependencies, you may simply build Panda3D from the -command prompt using the following command: +command prompt using the following command. (Add the `--windows-sdk=10` +option if you don't need to support Windows XP.) ```bash -makepanda\makepanda.bat --everything --installer --no-eigen +makepanda\makepanda.bat --everything --installer --no-eigen --threads=2 ``` When the build succeeds, it will produce an .exe file that you can use to