Fixed more bugs and continued the readme

This commit is contained in:
boo3 2023-11-12 19:10:30 +01:00
parent 1281ad7bfb
commit ede40f0c93
4 changed files with 79 additions and 38 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,5 @@
# Fusion
## an a more unreal fuel then diesel
## Collection of scripts to help port payday2 diesel maps to unreal engine
@ -28,33 +29,55 @@ Makes it easier to set up a work folder for blender
### Download the project files.
![Download files by using Download ZIP](/assets/images/DWL1.png)
Download files by using Download ZIP
![](/assets/images/DWL1.png)
Extract the contents, make sure you have enough space for the game assets later. The extracted game assets are quite large.
### Export Level data
Install [DieselBundleViewer](https://github.com/Luffyyy/DieselBundleViewer) and open payday2s bundle_db.blb
Open DieselBundleViewer
![Open DieselBundleViewer](/assets/images/DBV1.png)
![Open bundle_db.blb](/assets/images/DBV2.png)
![](/assets/images/DBV1.png)
Open bundle_db.blb
![](/assets/images/DBV2.png)
Navigate to /levels/narratives and chose a map to port in my case First World Bank
![Navigate to /levels/narratives/classics/red2](/assets/images/DBV3.png)
Navigate to /levels/narratives/classics/red2
![Then go in the world folder](/assets/images/DBV4.png)
![](/assets/images/DBV3.png)
![Press Convert and Save as](/assets/images/DBV5.png)
Then go in the world folder
![Then save it on the /WorldFiles/DieselWorldCONTINENT](/assets/images/DBV6.png)
![](/assets/images/DBV4.png)
Press Convert and Save as
![](/assets/images/DBV5.png)
Then save it on the /WorldFiles/DieselWorldCONTINENT
![](/assets/images/DBV6.png)
### Get started with pdworld2json.py
Install python
![Open a Powershell Terminal and write python](/assets/images/IP31.png)
![It should open the windows store, hit install and let it finish installing python](/assets/images/IP32.png)
![After the install make sure if it is installed](/assets/images/IP33.png)
Open a Powershell Terminal and write python3
![](/assets/images/IP31.png)
It should open the windows store, hit install and let it finish installing python
![](/assets/images/IP32.png)
After the install make sure if it is installed
![](/assets/images/IP33.png)
You can also just install it a different way this is just the easiest.
@ -76,7 +99,10 @@ python .\pdworld2json.py
```
![](/assets/images/PDWJ2.png)
![You should have a world.json like this](/assets/images/PDWJ3.png)
You should have a world.json like this
![](/assets/images/PDWJ3.png)
**It should also have printed out what files you will need to export u will need to remember that**
![](/assets/images/PDWJ4.png)
@ -97,9 +123,13 @@ Mark them Right Click and Press save as and save them in your project folder in
Make sure to download [PAYDAY 2 Model Tool](https://github.com/kythyria/payday2-model-tool/releases) [PAYDAY-2-Hashlist](https://github.com/Luffyyy/PAYDAY-2-Hashlist)
![Extract PD2ModelParser.exe like this](/assets/images/TMF1.png)
Extract PD2ModelParser.exe like this
![Next extract the hashlist in the root of the PD2ModelParser.exe this is very important or else the rest will not work](/assets/images/TMF2.png)
![](/assets/images/TMF1.png)
Next extract the hashlist in the root of the PD2ModelParser.exe this is very important or else the rest will not work
![](/assets/images/TMF2.png)
If all done right just open ExportModels.bat and it should export the models. It will take a bit for it to finish so sit back and relax.
@ -119,7 +149,18 @@ Now we should have a bunch of models with the .gltf inside output with the prope
So download [Blender](https://www.blender.org/) if you haven't already and open ConvertExportedToUnreal.blend.
If for some reason you cant open the .blend file anymore, you can just make a new project and load the blender_script.py.
![](/assets/images/B1.png)
If up to this point you have done everything correct you should be able to hit the run script button, and wait for it to finish.
![](/assets/images/B2.png)
If up to this point you have done everything correct you should be able to hit the run script button, and wait for it to finish. It will take a while depending of the amount of files you have.
![](/assets/images/B2.png)
When done it should have created a folder called "done" there you will find the models fixed and if you had the textures that where needed in the "texture" folder they should have applied the textures.
(Sometimes Overkill uses textures outside dlc folder so there will be missing textures i will have to fix that)
### Importing models into unreal
### Importing map data
### Profit???

View File

@ -2,14 +2,14 @@ import bpy
import os
import xml.etree.ElementTree as ET
# Display print() in the blender console window for debuging
#def print(data):
# for window in bpy.context.window_manager.windows:
# screen = window.screen
# for area in screen.areas:
# if area.type == 'CONSOLE':
# override = {'window': window, 'screen': screen, 'area': area}
# bpy.ops.console.scrollback_append(override, text=str(data), type="OUTPUT")
def custom_print(*args):
message = ' '.join(map(str, args))
for window in bpy.context.window_manager.windows:
screen = window.screen
for area in screen.areas:
if area.type == 'CONSOLE':
override = {'window': window, 'screen': screen, 'area': area}
bpy.ops.console.scrollback_append(override, text=message, type="OUTPUT")
for material in bpy.data.materials:
bpy.data.materials.remove(material, do_unlink=True)
@ -34,9 +34,9 @@ input_directory = os.path.join(parent_dir, wherethefilesare)
output_directory = os.path.join(parent_dir, wheretosave)
texture_directory = os.path.join(parent_dir, wherethetexturesare)
print("Input Directory:", input_directory)
print("Output Directory:", output_directory)
print("Texture Directory:", texture_directory)
custom_print("Input Directory:", input_directory)
custom_print("Output Directory:", output_directory)
custom_print("Texture Directory:", texture_directory)
def get_object_filepath(file_path):
# Replace the extension with .object
@ -66,14 +66,14 @@ def process_xml_file(file_path):
# Find the value of the 'materials' attribute
materials_value = root.find('.//diesel').get('materials')
# Print the result
print(f"The value of 'materials' is: {materials_value}")
# custom_print the result
custom_print(f"The value of 'materials' is: {materials_value}")
# return the materials_value
return materials_value
except Exception as e:
print(f"Error processing XML file: {e}")
custom_print(f"Error processing XML file: {e}")
return None
def get_diffuse_texture_name(xml_file_path, material_name):
@ -105,16 +105,16 @@ def get_diffuse_texture_name(xml_file_path, material_name):
texture_name = diffuse_texture_path.split("/")[-1] # Extracting the texture name from the file path
return f"{texture_name}.dds"
else:
print(f"Diffuse texture not found for material '{material_name}' in the XML file.")
custom_print(f"Diffuse texture not found for material '{material_name}' in the XML file.")
return None
else:
print(f"Material '{material_name}' not found in the XML file.")
custom_print(f"Material '{material_name}' not found in the XML file.")
return None
except FileNotFoundError:
print(f"File not found: {xml_file_path}")
custom_print(f"File not found: {xml_file_path}")
return None
except Exception as e:
print(f"Error while processing {xml_file_path}: {e}")
custom_print(f"Error while processing {xml_file_path}: {e}")
return None
# Main function to process the object
@ -217,10 +217,10 @@ def process_gltf(file_path):
# Get the diffuse texture name using get_diffuse_texture_name()
# Makes this not hardcoded
if material_config is not None:
get_material_config_path = material_config.replace("units/", "D:/PayDay2/output/") + ".material_config"
get_material_config_path = material_config.replace("units/", f"{input_directory}/") + ".material_config"
diffuse_texture_name = get_diffuse_texture_name(get_material_config_path, material_name)
else:
print("Material config is None. Handle this case accordingly.")
custom_print("Material config is None. Handle this case accordingly.")
# CRASHES WHEN IT CANT FIND THE FILES TO LAZY TO FIX IT JUST HAVE THE FILES
# Check if the texture exists
@ -233,9 +233,9 @@ def process_gltf(file_path):
# Set the diffuse texture as the base color
set_diffuse_texture_as_base_color(material, texture_path)
else:
print(f"Texture not found for material {material_name}: {texture_path}")
custom_print(f"Texture not found for material {material_name}: {texture_path}")
else:
print(f"No diffuse texture found for material {material_name}")
custom_print(f"No diffuse texture found for material {material_name}")
# Ensure the output directory exists
@ -258,7 +258,7 @@ def process_gltf(file_path):
bpy.data.images.remove(image, do_unlink=True)
else:
print("No objects selected.")
custom_print("No objects selected.")
for material in bpy.data.materials:
bpy.data.materials.remove(material, do_unlink=True)