diff --git a/panda/src/display/graphicsPipeSelection.cxx b/panda/src/display/graphicsPipeSelection.cxx index 8be3f856a8..24fd0b5ffc 100644 --- a/panda/src/display/graphicsPipeSelection.cxx +++ b/panda/src/display/graphicsPipeSelection.cxx @@ -49,6 +49,7 @@ GraphicsPipeSelection() : _lock("GraphicsPipeSelection") { _default_display_module = load_display.get_word(0); _default_pipe_name = load_display.get_word(1); + _default_pipe_type = TypeHandle::none(); if (_default_display_module == "*") { // '*' or empty string is the key for all display modules. @@ -124,7 +125,11 @@ print_pipe_types() const { LightMutexHolder holder(_lock); nout << "Known pipe types:" << std::endl; for (const PipeType &pipe_type : _pipe_types) { - nout << " " << pipe_type._type << "\n"; + nout << " " << pipe_type._type; + if (_pipe_types.size() > 1 && pipe_type._type == _default_pipe_type) { + nout << " (default)"; + } + nout << "\n"; } if (_display_modules.empty()) { nout << "(all display modules loaded.)\n"; @@ -256,7 +261,7 @@ make_default_pipe() { if (!_default_pipe_name.empty()) { // First, look for an exact match of the default type name from the - // Configrc file (excepting case and hyphenunderscore). + // Config.prc file (excepting case and hyphen / underscore). for (const PipeType &ptype : _pipe_types) { if (cmp_nocase_uh(ptype._type.get_name(), _default_pipe_name) == 0) { // Here's an exact match. @@ -281,6 +286,18 @@ make_default_pipe() { } } + // Look for the preferred type of the default display module. + if (_default_pipe_type != TypeHandle::none()) { + for (const PipeType &ptype : _pipe_types) { + if (ptype._type == _default_pipe_type) { + PT(GraphicsPipe) pipe = (*ptype._constructor)(); + if (pipe != nullptr) { + return pipe; + } + } + } + } + // Couldn't find a matching pipe type; choose the first one on the list. for (const PipeType &ptype : _pipe_types) { PT(GraphicsPipe) pipe = (*ptype._constructor)(); @@ -358,7 +375,7 @@ do_load_default_module() { return; } - load_named_module(_default_display_module); + _default_pipe_type = load_named_module(_default_display_module); DisplayModules::iterator di = std::find(_display_modules.begin(), _display_modules.end(), diff --git a/panda/src/display/graphicsPipeSelection.h b/panda/src/display/graphicsPipeSelection.h index c62d5b16a4..42445336d7 100644 --- a/panda/src/display/graphicsPipeSelection.h +++ b/panda/src/display/graphicsPipeSelection.h @@ -87,6 +87,7 @@ private: DisplayModules _display_modules; std::string _default_display_module; std::string _default_pipe_name; + TypeHandle _default_pipe_type; bool _default_module_loaded; static GraphicsPipeSelection *_global_ptr;