diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-04-12 17:54:45 -0500 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-04-12 17:54:45 -0500 |
| commit | a0355c9b897281d0bfea48bec9d490724ecabd96 (patch) | |
| tree | 42c56ea4f4829a6115f688956858ada3e59fd9ef /libs/preview_nif/src/CMakeLists.txt | |
| parent | fa43a71f9d05b3673d42296a80decb2228d68f83 (diff) | |
Add NIF previewer plugin with Linux-specific fixes
Vendored from github.com/Parapets/mo2-preview_nif and adapted for Linux:
- BSA texture resolution via MO2 virtual tree with case-insensitive
fallback walk (Linux FS is case-sensitive; NIFs reference textures
with arbitrary case against files on disk)
- Process-wide cached BSA candidate list, keyed by profile path,
priority-sorted, filtering disabled mods
- Path backslash normalization before loose-file lookup
- Polygon offset on SLSF1_Decal-flagged shapes to break z-ties with
coincident base meshes (road decals, moss overlays)
- Opaque framebuffer via glColorMask alpha lock so alpha-blended shapes
can't bleed the dialog background through the preview area
- QMouseEvent::globalPosition().toPoint() for Qt6 compatibility
Preview dialog behavior (organizercore.cpp):
- Switch previewFile and previewFileWithAlternatives from stack-allocated
exec() to heap + ApplicationModal + show() + WA_DeleteOnClose.
- Parent passed as nullptr so preview lifetime is decoupled from the
stack-allocated ModInfoDialog that spawns it. Nested exec() inside
the enclosing dialog's exec() was softlocking on close.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'libs/preview_nif/src/CMakeLists.txt')
| -rw-r--r-- | libs/preview_nif/src/CMakeLists.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libs/preview_nif/src/CMakeLists.txt b/libs/preview_nif/src/CMakeLists.txt new file mode 100644 index 0000000..28bb30f --- /dev/null +++ b/libs/preview_nif/src/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.22) + +find_package(Qt6 CONFIG REQUIRED COMPONENTS Widgets OpenGL OpenGLWidgets) +find_package(fmt CONFIG REQUIRED) + +file(GLOB preview_nif_SOURCES CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.h +) + +add_library(preview_nif SHARED ${preview_nif_SOURCES}) + +mo2_configure_plugin(preview_nif NO_SOURCES WARNINGS OFF) + +target_include_directories(preview_nif PRIVATE + ${CMAKE_SOURCE_DIR}/libs/uibase/include/uibase/game_features + ${CMAKE_SOURCE_DIR}/libs/libbsarch/include/libbsarch +) + +target_link_libraries(preview_nif PRIVATE + mo2::uibase + libbsarch + Qt6::Widgets + Qt6::OpenGL + Qt6::OpenGLWidgets + fmt::fmt +) + +mo2_install_plugin(preview_nif) + +# Stage shader files next to the plugin under plugins/data/shaders/. +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../data/shaders + DESTINATION plugins/data + FILES_MATCHING PATTERN "*.vert" PATTERN "*.frag" +) |
