Skip to content

Commit d1e57bd

Browse files
committed
Fix build obj from loaded scene, fix long room names, bump version to 2.5.1
1 parent 6c058ad commit d1e57bd

5 files changed

Lines changed: 18 additions & 24 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.0
6+
VERSION 2.5.1
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)

include/NavKit/NavKitConfig.h

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

src/module/Obj.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ void Obj::buildObj() {
220220
}
221221

222222
void Obj::extractAlocsOrPrimsAndStartObjBuild() {
223+
const Scene &scene = Scene::getInstance();
224+
const std::string &fileNameString = scene.lastLoadSceneFile;
223225
NavKitSettings &navKitSettings = NavKitSettings::getInstance();
224226
std::string retailFolder = "\"";
225227
retailFolder += navKitSettings.hitmanFolder;
226228
retailFolder += "\\Retail\"";
227229
std::string gameVersion = "HM3";
228-
std::string navJsonFilePath = "\"";
229-
navJsonFilePath += navKitSettings.outputFolder;
230-
navJsonFilePath += "\\output.nav.json\"";
230+
std::string navJsonFilePath = "\"" + fileNameString + "\"";
231231
std::string runtimeFolder = "\"";
232232
runtimeFolder += navKitSettings.hitmanFolder;
233233
runtimeFolder += "\\Runtime\"";
@@ -276,8 +276,6 @@ char *Obj::openSetBlenderFileDialog(const char *lastBlenderFile) {
276276
}
277277

278278
void Obj::finalizeExtractAlocsOrPrims() {
279-
NavKitSettings &navKitSettings = NavKitSettings::getInstance();
280-
281279
if (errorExtracting) {
282280
errorBuilding = false;
283281
startedObjGeneration = false;
@@ -291,12 +289,9 @@ void Obj::finalizeExtractAlocsOrPrims() {
291289
}
292290
if (doneExtractingAlocsOrPrims) {
293291
doneExtractingAlocsOrPrims = false;
294-
std::string sceneFile = navKitSettings.outputFolder;
295-
sceneFile += "\\output.nav.json";
296-
Scene &scene = Scene::getInstance();
297-
const std::string &fileNameString = sceneFile;
292+
const Scene &scene = Scene::getInstance();
293+
const std::string &fileNameString = scene.lastLoadSceneFile;
298294
extractingAlocsOrPrims = false;
299-
scene.lastLoadSceneFile = sceneFile;
300295
buildObj();
301296
Logger::log(NK_INFO, ("Done loading nav.json file: '" + fileNameString + "'.").c_str());
302297
errorExtracting = false;

src/resource/glacier2obj.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,21 +2450,24 @@ def load_scenario(context, path_to_nav_json, path_to_output_obj_file, mesh_type,
24502450
else:
24512451
mesh_hash = hash_and_entity['primHash']
24522452

2453-
room_folder_name = hash_and_entity["roomFolderName"]
2453+
room_folder_name = hash_and_entity["roomFolderName"][:63]
24542454
if room_folder_name not in bpy.data.collections:
24552455
coll = bpy.data.collections.new(room_folder_name)
24562456
bpy.context.scene.collection.children.link(coll)
24572457
coll.color_tag = "COLOR_0" + str(room_folder_color_index%8 + 1)
24582458
room_folder_color_index += 1
2459+
log("INFO", "Adding new collection for room folder name: " + room_folder_name, "load_scenario")
2460+
24592461
room_folder_coll = bpy.data.collections.get(room_folder_name)
2460-
2461-
room_name = hash_and_entity["roomName"]
2462+
2463+
room_name = hash_and_entity["roomName"][:63]
24622464
if room_name not in bpy.data.collections:
24632465
coll = bpy.data.collections.new(room_name)
24642466
room_folder_coll.children.link(coll)
2465-
coll.color_tag = "COLOR_0" + str(room_color_index%8 + 1)
2467+
coll.color_tag = "COLOR_0" + str(room_color_index % 8 + 1)
24662468
room_color_index += 1
2467-
2469+
log("INFO", "Adding new collection for room name: " + room_name, "load_scenario")
2470+
24682471
entity = hash_and_entity['entity']
24692472
transform = {"position": entity["position"], "rotate": entity["rotation"],
24702473
"scale": entity["scale"]["data"], "id": entity["id"]}
@@ -2554,7 +2557,7 @@ def load_scenario(context, path_to_nav_json, path_to_output_obj_file, mesh_type,
25542557
p = mesh_transform["position"]
25552558
r = mesh_transform["rotate"]
25562559
s = mesh_transform["scale"]
2557-
log("INFO", "Transforming " + mesh_type + " [" + str(current_mesh_in_scene_index) + "/" + str(meshes_in_scenario_count) + "]: " + mesh_hash + " #" + str(i) + " Mesh: [" + str(mesh_i + 1) + "/" + str(mesh_count) + "]", "load_scenario")
2560+
log("INFO", "Transforming " + mesh_type + " [" + str(current_mesh_in_scene_index) + "/" + str(meshes_in_scenario_count) + "]: " + mesh_hash + " #" + str(i) + " Mesh: [" + str(mesh_i + 1) + "/" + str(mesh_count) + "] Room name: " + room_name, "load_scenario")
25582561
mesh_i += 1
25592562
for obj in objects:
25602563
if i != 0:

src/util/CommandRunner.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,10 @@ void CommandRunner::runCommand(std::string command, std::string logFileName, std
108108
errorCallback();
109109
return;
110110
}
111-
bool pythonError = false;
112111
if (outputString.find("Error") != std::string::npos) {
113-
pythonError = true;
114-
}
115-
if (pythonError) {
116112
Logger::log(
117113
NK_ERROR,
118-
"Error extracting scene from game. The blender python script threw an unhandled exception. Please report this to AtomicForce.");
114+
"Error building obj or blend file. The blender python script threw an unhandled exception. Please report this to AtomicForce.");
119115
errorCallback();
120116
WaitForSingleObject(pi.hProcess, INFINITE);
121117
CloseHandle(hReadPipe);
@@ -130,7 +126,7 @@ void CommandRunner::runCommand(std::string command, std::string logFileName, std
130126
}
131127
errorMessage += outputString;
132128
errorMessage +=
133-
"Error extracting scene from game. The blender python script threw an unhandled exception. Please report this to AtomicForce.";
129+
"Error building obj or blend file. The blender python script threw an unhandled exception. Please report this to AtomicForce.";
134130
ErrorHandler::openErrorDialog(errorMessage);
135131
fclose(logFile);
136132
return;

0 commit comments

Comments
 (0)