diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index f801426173..f9cc39a639 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -464,11 +464,11 @@ #define alt_libs $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_libs] $[nspr_libs] $[python_libs]] #if $[WINDOWS_PLATFORM] - #set alt_libs $[alt_libs] $[WIN_SYS_LIBS] $[components $[WIN_SYS_LIBS],$[active_component_libs] $[transitive_link]] + #set alt_libs $[alt_libs] $[WIN_SYS_LIBS] $[components $[WIN_SYS_LIBS],$[active_libs] $[transitive_link]] #elif $[OSX_PLATFORM] - #set alt_libs $[alt_libs] $[OSX_SYS_LIBS] $[components $[OSX_SYS_LIBS],$[active_component_libs] $[transitive_link]] + #set alt_libs $[alt_libs] $[OSX_SYS_LIBS] $[components $[OSX_SYS_LIBS],$[active_libs] $[transitive_link]] #else - #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_component_libs] $[transitive_link]] + #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_libs] $[transitive_link]] #endif #foreach package $[use_packages] diff --git a/dtool/src/prc/notify.cxx b/dtool/src/prc/notify.cxx index fb65a8c970..35c349aca8 100644 --- a/dtool/src/prc/notify.cxx +++ b/dtool/src/prc/notify.cxx @@ -444,6 +444,10 @@ assert_failure(const char *expression, int line, nout << "Assertion failed: " << message << "\n"; + // This is redeclared here to ensure that it is initialized before + // use, in case we get into a static-init loop. + bool assert_abort = true; + // ConfigVariableBool assert_abort("assert-abort", false); if (assert_abort) { #ifdef WIN32 // How to trigger an exception in VC++ that offers to take us into diff --git a/panda/src/display/Sources.pp b/panda/src/display/Sources.pp index f959adb12d..ff70651b0c 100644 --- a/panda/src/display/Sources.pp +++ b/panda/src/display/Sources.pp @@ -1,6 +1,6 @@ #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \ dtoolutil:c dtoolbase:c dtool:m -#define WIN_SYS_LIBS $[WIN_SYS_LIBS] Ws2_32.lib +#define WIN_SYS_LIBS $[WIN_SYS_LIBS] ws2_32.lib #begin lib_target #define TARGET display diff --git a/panda/src/express/Sources.pp b/panda/src/express/Sources.pp index b827be1b3d..9d3836c84b 100644 --- a/panda/src/express/Sources.pp +++ b/panda/src/express/Sources.pp @@ -198,6 +198,8 @@ zStream.I zStream.h zStreamBuf.h #define IGATESCAN all + #define WIN_SYS_LIBS \ + advapi32.lib ws2_32.lib $[WIN_SYS_LIBS] #end lib_target diff --git a/panda/src/framework/pandaFramework.I b/panda/src/framework/pandaFramework.I index e103dd51c5..53c4fc2447 100644 --- a/panda/src/framework/pandaFramework.I +++ b/panda/src/framework/pandaFramework.I @@ -26,7 +26,10 @@ //////////////////////////////////////////////////////////////////// INLINE GraphicsEngine *PandaFramework:: get_graphics_engine() { - return &_engine; + if (_engine == (GraphicsEngine *)NULL) { + _engine = new GraphicsEngine; + } + return _engine; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/framework/pandaFramework.cxx b/panda/src/framework/pandaFramework.cxx index 76ce7e7420..3353879cea 100644 --- a/panda/src/framework/pandaFramework.cxx +++ b/panda/src/framework/pandaFramework.cxx @@ -40,7 +40,6 @@ PandaFramework() : { _is_open = false; _made_default_pipe = false; - _data_root = NodePath("data"); _window_title = string(); _start_time = 0.0; _frame_count = 0; @@ -49,24 +48,8 @@ PandaFramework() : _two_sided_enabled = false; _lighting_enabled = false; _background_type = WindowFramework::BT_default; - _highlight_wireframe = NodePath("wireframe"); - _highlight_wireframe.set_render_mode_wireframe(1); - _highlight_wireframe.set_color(1.0f, 0.0f, 0.0f, 1.0f, 1); _default_keys_enabled = false; _exit_flag = false; - - if (!playback_session.empty()) { - // If the config file so indicates, create a recorder and start it - // playing. - _recorder = new RecorderController; - _recorder->begin_playback(Filename::from_os_specific(playback_session)); - - } else if (!record_session.empty()) { - // If the config file so indicates, create a recorder and start it - // recording. - _recorder = new RecorderController; - _recorder->begin_record(Filename::from_os_specific(record_session)); - } } //////////////////////////////////////////////////////////////////// @@ -100,6 +83,24 @@ open_framework(int &argc, char **&argv) { reset_frame_rate(); + _data_root = NodePath("data"); + _highlight_wireframe = NodePath("wireframe"); + _highlight_wireframe.set_render_mode_wireframe(1); + _highlight_wireframe.set_color(1.0f, 0.0f, 0.0f, 1.0f, 1); + + if (!playback_session.empty()) { + // If the config file so indicates, create a recorder and start it + // playing. + _recorder = new RecorderController; + _recorder->begin_playback(Filename::from_os_specific(playback_session)); + + } else if (!record_session.empty()) { + // If the config file so indicates, create a recorder and start it + // recording. + _recorder = new RecorderController; + _recorder->begin_record(Filename::from_os_specific(record_session)); + } + _event_handler.add_hook("window-event", event_window_event, this); } @@ -118,7 +119,11 @@ close_framework() { close_all_windows(); // Also close down any other windows that might have been opened. - _engine.remove_all_windows(); + if (_engine != (GraphicsEngine *)NULL) { + delete _engine; + _engine = NULL; + } + _event_handler.remove_all_hooks(); _is_open = false; @@ -317,7 +322,8 @@ open_window(const WindowProperties &props, GraphicsPipe *pipe, wf->set_lighting(get_lighting()); wf->set_background_type(get_background_type()); - GraphicsWindow *win = wf->open_window(props, &_engine, pipe, gsg); + GraphicsWindow *win = wf->open_window(props, get_graphics_engine(), + pipe, gsg); if (win == (GraphicsWindow *)NULL) { // Oops, couldn't make an actual window. framework_cat.error() @@ -380,7 +386,7 @@ close_window(int n) { GraphicsWindow *win = wf->get_graphics_window(); if (win != (GraphicsWindow *)NULL) { - _engine.remove_window(win); + _engine->remove_window(win); } wf->close_window(); @@ -401,7 +407,7 @@ close_all_windows() { GraphicsWindow *win = wf->get_graphics_window(); if (win != (GraphicsWindow *)NULL) { - _engine.remove_window(win); + _engine->remove_window(win); } wf->close_window(); @@ -695,8 +701,10 @@ do_frame() { if (_recorder != (RecorderController *)NULL) { _recorder->record_frame(); } - - _engine.render_frame(); + + if (_engine != (GraphicsEngine *)NULL) { + _engine->render_frame(); + } if (_recorder != (RecorderController *)NULL) { _recorder->play_frame(); @@ -1166,7 +1174,7 @@ event_f9(CPT_Event event, void *data) { if (self->clear_text()) { // Render one more frame to remove the text. - self->_engine.render_frame(); + self->_engine->render_frame(); } Filename filename = wf->get_graphics_window()->save_screenshot_default(); diff --git a/panda/src/framework/pandaFramework.h b/panda/src/framework/pandaFramework.h index c2682e5eb4..1181951285 100644 --- a/panda/src/framework/pandaFramework.h +++ b/panda/src/framework/pandaFramework.h @@ -150,7 +150,7 @@ private: string _window_title; PT(GraphicsPipe) _default_pipe; - GraphicsEngine _engine; + GraphicsEngine *_engine; NodePath _data_root; EventHandler _event_handler; diff --git a/pandatool/src/mayaprogs/Sources.pp b/pandatool/src/mayaprogs/Sources.pp index 9515715621..dd9cd6d5f0 100644 --- a/pandatool/src/mayaprogs/Sources.pp +++ b/pandatool/src/mayaprogs/Sources.pp @@ -74,6 +74,7 @@ #begin lib_target + #define BUILD_TARGET $[not $[LINK_ALL_STATIC]] #define USE_PACKAGES maya #define TARGET mayapview #define LOCAL_LIBS mayaegg maya @@ -99,6 +100,7 @@ #end lib_target #begin lib_target + #define BUILD_TARGET $[not $[LINK_ALL_STATIC]] #define USE_PACKAGES maya #define TARGET mayasavepview