Skip to content

Commit eddf2d6

Browse files
authored
Add instance, skip extract, and debug settings (#73)
1 parent 82ef800 commit eddf2d6

12 files changed

Lines changed: 230 additions & 77 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_policy(SET CMP0141 NEW)
33
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<CONFIG:Debug>,EditAndContinue,ProgramDatabase>" CACHE STRING "MSVC debug information format")
44
project(
55
NavKit
6-
VERSION 2.5.3
6+
VERSION 2.6.0
77
DESCRIPTION "An app to create NAVP and AIRG files for use with Hitman: World of Assassination"
88
LANGUAGES CXX)
99
set(CMAKE_CXX_STANDARD 20)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# How to Use
44
The [NavKit Guide](https://glaciermodding.org/docs/modding/hitman/customcampaigns/using_navkit) is available on the [Glacier Modding Wiki](https://glaciermodding.org/).
55

6-
You can run NavKit by opening `NavKit.exe`. To use the **View Navp in game** and **Scene Extraction** features, you will need ZHMModSdk installed. For the **Scene Extraction** feature, you will also need to have Blender installed.
6+
You can run NavKit by opening `NavKit.exe`. To use the **Scene Extraction** feature, you will need ZHMModSdk installed. For the **Build Obj** and **Build Blend file** feature, you will also need to have Blender installed.
77

88
You will also need to install the latest Visual C++ Redistributable from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-140. Make sure you get the X64 version.
99

10-
Functions available are loading and saving Navp and Navp.json, loading Airg and Airg.json, loading and saving Obj, scene extraction, building Navp, building Airg and viewing navp in game.
10+
Functions available are loading and saving Navp and Navp.json, loading Airg and Airg.json, loading and saving Obj, scene extraction, building Obj, building blend files, building Navp, and building Airg.
1111

1212
# Full generation of Navp and Airg (Scene Extraction, Navp generation, Airg generation)
1313
1. Download the latest release of NavKit (https://github.com/glacier-modding/NavKit/releases/latest) and run the installer

include/NavKit/NavKitConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#define NavKit_VERSION_MAJOR "2"
2-
#define NavKit_VERSION_MINOR "5"
3-
#define NavKit_VERSION_PATCH "3"
2+
#define NavKit_VERSION_MINOR "6"
3+
#define NavKit_VERSION_PATCH "0"

include/NavKit/Resource.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define IDM_BUILD_OBJ_FROM_SCENE 1500
4242
#define IDM_BUILD_OBJ_FROM_NAVP 1501
4343
#define IDM_BUILD_BLEND_FROM_SCENE 1502
44+
#define IDM_BUILD_BLEND_AND_OBJ_FROM_SCENE 1503
4445
#define IDM_BUILD_NAVP 1510
4546
#define IDM_BUILD_AIRG 1520
4647
#define IDM_HELP_ABOUT 1600
@@ -140,3 +141,7 @@
140141
#define IDC_CHECK_PRIM_LOD_6 30408
141142
#define IDC_CHECK_PRIM_LOD_7 30409
142143
#define IDC_CHECK_PRIM_LOD_8 30410
144+
#define IDC_RADIO_BUILD_TYPE_COPY 30411
145+
#define IDC_RADIO_BUILD_TYPE_INSTANCE 30412
146+
#define IDC_CHECK_SKIP_RPKG_EXTRACT 30413
147+
#define IDC_CHECK_SHOW_BLENDER_DEBUG_LOGS 30414

include/NavKit/module/Obj.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ enum MeshType {
1212
PRIM
1313
};
1414

15+
enum SceneMeshBuildType {
16+
INSTANCE,
17+
COPY
18+
};
19+
1520
class Obj {
1621
explicit Obj();
1722

@@ -32,13 +37,13 @@ class Obj {
3237
bool showObj;
3338
bool loadObj;
3439
std::vector<std::string> files;
35-
const std::string meshesFolder = "Obj";
3640
std::string objToLoad;
3741
std::vector<bool> objLoadDone;
3842
bool startedObjGeneration;
3943
bool blenderObjStarted;
4044
bool blenderObjGenerationDone;
41-
bool blendFileOnlyExtract;
45+
bool blendFileOnlyBuild;
46+
bool blendFileAndObjBuild;
4247
bool glacier2ObjDebugLogsEnabled;
4348
bool errorBuilding;
4449
bool skipExtractingAlocsOrPrims;
@@ -48,6 +53,7 @@ class Obj {
4853
std::map<std::string, std::pair<int, int> > objectTriangleRanges;
4954
bool doObjHitTest;
5055
MeshType meshTypeForBuild;
56+
SceneMeshBuildType sceneMeshBuildType;
5157
bool primLods[8];
5258
static HWND hObjDialog;
5359

@@ -57,13 +63,15 @@ class Obj {
5763

5864
void loadObjMesh();
5965

66+
void handleBuildBlendAndObjFromSceneClicked();
67+
6068
static void copyObjFile(const std::string &from, const std::string &to);
6169

6270
void saveObjMesh(char *objToCopy, char *newFileName);
6371

6472
void buildObjFromNavp(bool alsoLoadIntoUi);
6573

66-
void buildObj();
74+
void buildObjFromScene();
6775

6876
void finalizeObjBuild();
6977

@@ -81,13 +89,15 @@ class Obj {
8189

8290
void handleSaveObjClicked();
8391

84-
bool canLoad() const;
92+
[[nodiscard]] bool canLoad() const;
8593

8694
static bool canBuildObjFromNavp();
8795

88-
bool canBuildObjFromScene() const;
96+
[[nodiscard]] bool canBuildObjFromScene() const;
97+
98+
[[nodiscard]] bool canBuildBlendFromScene() const;
8999

90-
bool canBuildBlendFromScene() const;
100+
[[nodiscard]] bool canBuildBlendAndObjFromScene() const;
91101

92102
void handleBuildObjFromSceneClicked();
93103

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ set(RUNTIME_FILE_DEPENDENCIES
113113
"${NavKit_SOURCE_DIR}/src/resource/DroidSans.ttf"
114114
"${NavKit_SOURCE_DIR}/src/resource/NavKit.ini"
115115
"${NavKit_SOURCE_DIR}/src/resource/Glacier2Obj.py"
116+
"${NavKit_SOURCE_DIR}/src/resource/res.blend"
116117
"${NavKit_SOURCE_DIR}/bin/glacier2Obj.exe"
117118
)
118119
set(RUNTIME_FILE_DEPENDENCIES ${RUNTIME_FILE_DEPENDENCIES} PARENT_SCOPE)

src/NavKit.rc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ BEGIN
3232
MENUITEM "&NavKit Settings", IDM_SETTINGS_NAVKIT
3333
MENUITEM "&Scene Settings", IDM_SETTINGS_SCENE
3434
MENUITEM "&Recast Settings", IDM_SETTINGS_RECAST
35-
MENUITEM "&Obj Settings", IDM_SETTINGS_OBJ
35+
MENUITEM "&Scene Mesh Settings", IDM_SETTINGS_OBJ
3636
MENUITEM "&Airg Settings", IDM_SETTINGS_AIRG
3737
END
3838
POPUP "&View"
@@ -77,6 +77,7 @@ BEGIN
7777
MENUITEM "Build &Airg from Navp", IDM_BUILD_AIRG
7878
MENUITEM SEPARATOR
7979
MENUITEM "Build Blend from &Scene" IDM_BUILD_BLEND_FROM_SCENE
80+
MENUITEM "Build Blend and Obj from &Scene" IDM_BUILD_BLEND_AND_OBJ_FROM_SCENE
8081
END
8182

8283
POPUP "&Help"
@@ -251,9 +252,9 @@ BEGIN
251252
PUSHBUTTON "Reset Defaults",IDC_BUTTON_RESET_DEFAULTS,188,490,65,14
252253
END
253254

254-
IDD_OBJ_SETTINGS DIALOGEX 0, 0, 260, 150
255+
IDD_OBJ_SETTINGS DIALOGEX 0, 0, 260, 285
255256
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
256-
CAPTION "Obj Settings"
257+
CAPTION "Scene Mesh Settings"
257258
FONT 8, "MS Shell Dlg", 400, 0, 0x1
258259
BEGIN
259260
GROUPBOX "Mesh Type for Build",IDC_STATIC,7,7,246,35
@@ -269,5 +270,16 @@ BEGIN
269270
AUTOCHECKBOX "LOD 6", IDC_CHECK_PRIM_LOD_6, 84, 80, 50, 8
270271
AUTOCHECKBOX "LOD 7", IDC_CHECK_PRIM_LOD_7, 84, 95, 50, 8
271272
AUTOCHECKBOX "LOD 8", IDC_CHECK_PRIM_LOD_8, 84, 110, 50, 8
272-
PUSHBUTTON "Reset Defaults",IDC_BUTTON_RESET_DEFAULTS,188,130,65,14
273+
274+
GROUPBOX "Build Type for Blender File",IDC_STATIC,7,135,246,35
275+
CONTROL "Copy",IDC_RADIO_BUILD_TYPE_COPY,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,150,40,10
276+
CONTROL "Instance",IDC_RADIO_BUILD_TYPE_INSTANCE,"Button",BS_AUTORADIOBUTTON,64,150,40,10
277+
278+
GROUPBOX "Skip Aloc / Prim Extraction from RPKG files",IDC_STATIC,7,180,246,35
279+
AUTOCHECKBOX "Skip Extraction",IDC_CHECK_SKIP_RPKG_EXTRACT,14,195,80,10
280+
281+
GROUPBOX "Show Blender Debug logs",IDC_STATIC,7,225,246,35
282+
AUTOCHECKBOX "Show Debug Logs",IDC_CHECK_SHOW_BLENDER_DEBUG_LOGS,14,240,80,10
283+
284+
PUSHBUTTON "Reset Defaults",IDC_BUTTON_RESET_DEFAULTS,188,265,65,14
273285
END

src/module/Menu.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ void Menu::updateMenuState() {
105105
setMenuItemEnabled(IDM_BUILD_OBJ_FROM_SCENE, obj.canBuildObjFromScene());
106106
setMenuItemEnabled(IDM_BUILD_OBJ_FROM_NAVP, obj.canBuildObjFromNavp());
107107
setMenuItemEnabled(IDM_BUILD_BLEND_FROM_SCENE, obj.canBuildBlendFromScene());
108+
setMenuItemEnabled(IDM_BUILD_BLEND_AND_OBJ_FROM_SCENE, obj.canBuildBlendAndObjFromScene());
108109

109110
setMenuItemEnabled(IDM_EXTRACT_SCENE, sceneExtract.canExtractFromGame());
110111
setMenuItemEnabled(IDM_EXTRACT_SCENE_AND_BUILD_OBJ, sceneExtract.canExtractFromGameAndBuildObj());
@@ -250,6 +251,9 @@ int Menu::handleMenuClicked(const SDL_SysWMmsg *wmMsg) {
250251
case IDM_BUILD_BLEND_FROM_SCENE:
251252
obj.handleBuildBlendFromSceneClicked();
252253
break;
254+
case IDM_BUILD_BLEND_AND_OBJ_FROM_SCENE:
255+
obj.handleBuildBlendAndObjFromSceneClicked();
256+
break;
253257
case IDM_BUILD_OBJ_FROM_SCENE:
254258
obj.handleBuildObjFromSceneClicked();
255259
break;

0 commit comments

Comments
 (0)