Fixed more bugs and continued the readme
This commit is contained in:
parent
1281ad7bfb
commit
ede40f0c93
Binary file not shown.
Binary file not shown.
71
README.md
71
README.md
@ -1,4 +1,5 @@
|
|||||||
# Fusion
|
# Fusion
|
||||||
|
## an a more unreal fuel then diesel
|
||||||
|
|
||||||
## Collection of scripts to help port payday2 diesel maps to unreal engine
|
## 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 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.
|
Extract the contents, make sure you have enough space for the game assets later. The extracted game assets are quite large.
|
||||||
|
|
||||||
### Export Level data
|
### Export Level data
|
||||||
Install [DieselBundleViewer](https://github.com/Luffyyy/DieselBundleViewer) and open payday2s bundle_db.blb
|
Install [DieselBundleViewer](https://github.com/Luffyyy/DieselBundleViewer) and open payday2s bundle_db.blb
|
||||||
|
Open DieselBundleViewer
|
||||||
|
|
||||||
![Open DieselBundleViewer](/assets/images/DBV1.png)
|
![](/assets/images/DBV1.png)
|
||||||
![Open bundle_db.blb](/assets/images/DBV2.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 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
|
### Get started with pdworld2json.py
|
||||||
|
|
||||||
Install python
|
Install python
|
||||||
|
|
||||||
![Open a Powershell Terminal and write python](/assets/images/IP31.png)
|
Open a Powershell Terminal and write python3
|
||||||
![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)
|
![](/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.
|
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)
|
![](/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**
|
**It should also have printed out what files you will need to export u will need to remember that**
|
||||||
![](/assets/images/PDWJ4.png)
|
![](/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)
|
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.
|
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.
|
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.
|
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)
|
![](/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.
|
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)
|
|
||||||
|
![](/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???
|
@ -2,14 +2,14 @@ import bpy
|
|||||||
import os
|
import os
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
# Display print() in the blender console window for debuging
|
def custom_print(*args):
|
||||||
#def print(data):
|
message = ' '.join(map(str, args))
|
||||||
# for window in bpy.context.window_manager.windows:
|
for window in bpy.context.window_manager.windows:
|
||||||
# screen = window.screen
|
screen = window.screen
|
||||||
# for area in screen.areas:
|
for area in screen.areas:
|
||||||
# if area.type == 'CONSOLE':
|
if area.type == 'CONSOLE':
|
||||||
# override = {'window': window, 'screen': screen, 'area': area}
|
override = {'window': window, 'screen': screen, 'area': area}
|
||||||
# bpy.ops.console.scrollback_append(override, text=str(data), type="OUTPUT")
|
bpy.ops.console.scrollback_append(override, text=message, type="OUTPUT")
|
||||||
|
|
||||||
for material in bpy.data.materials:
|
for material in bpy.data.materials:
|
||||||
bpy.data.materials.remove(material, do_unlink=True)
|
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)
|
output_directory = os.path.join(parent_dir, wheretosave)
|
||||||
texture_directory = os.path.join(parent_dir, wherethetexturesare)
|
texture_directory = os.path.join(parent_dir, wherethetexturesare)
|
||||||
|
|
||||||
print("Input Directory:", input_directory)
|
custom_print("Input Directory:", input_directory)
|
||||||
print("Output Directory:", output_directory)
|
custom_print("Output Directory:", output_directory)
|
||||||
print("Texture Directory:", texture_directory)
|
custom_print("Texture Directory:", texture_directory)
|
||||||
|
|
||||||
def get_object_filepath(file_path):
|
def get_object_filepath(file_path):
|
||||||
# Replace the extension with .object
|
# Replace the extension with .object
|
||||||
@ -66,14 +66,14 @@ def process_xml_file(file_path):
|
|||||||
# Find the value of the 'materials' attribute
|
# Find the value of the 'materials' attribute
|
||||||
materials_value = root.find('.//diesel').get('materials')
|
materials_value = root.find('.//diesel').get('materials')
|
||||||
|
|
||||||
# Print the result
|
# custom_print the result
|
||||||
print(f"The value of 'materials' is: {materials_value}")
|
custom_print(f"The value of 'materials' is: {materials_value}")
|
||||||
|
|
||||||
# return the materials_value
|
# return the materials_value
|
||||||
return materials_value
|
return materials_value
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error processing XML file: {e}")
|
custom_print(f"Error processing XML file: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_diffuse_texture_name(xml_file_path, material_name):
|
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
|
texture_name = diffuse_texture_path.split("/")[-1] # Extracting the texture name from the file path
|
||||||
return f"{texture_name}.dds"
|
return f"{texture_name}.dds"
|
||||||
else:
|
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
|
return None
|
||||||
else:
|
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
|
return None
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(f"File not found: {xml_file_path}")
|
custom_print(f"File not found: {xml_file_path}")
|
||||||
return None
|
return None
|
||||||
except Exception as e:
|
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
|
return None
|
||||||
|
|
||||||
# Main function to process the object
|
# 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()
|
# Get the diffuse texture name using get_diffuse_texture_name()
|
||||||
# Makes this not hardcoded
|
# Makes this not hardcoded
|
||||||
if material_config is not None:
|
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)
|
diffuse_texture_name = get_diffuse_texture_name(get_material_config_path, material_name)
|
||||||
else:
|
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
|
# CRASHES WHEN IT CANT FIND THE FILES TO LAZY TO FIX IT JUST HAVE THE FILES
|
||||||
# Check if the texture exists
|
# Check if the texture exists
|
||||||
@ -233,9 +233,9 @@ def process_gltf(file_path):
|
|||||||
# Set the diffuse texture as the base color
|
# Set the diffuse texture as the base color
|
||||||
set_diffuse_texture_as_base_color(material, texture_path)
|
set_diffuse_texture_as_base_color(material, texture_path)
|
||||||
else:
|
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:
|
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
|
# Ensure the output directory exists
|
||||||
@ -258,7 +258,7 @@ def process_gltf(file_path):
|
|||||||
bpy.data.images.remove(image, do_unlink=True)
|
bpy.data.images.remove(image, do_unlink=True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("No objects selected.")
|
custom_print("No objects selected.")
|
||||||
|
|
||||||
for material in bpy.data.materials:
|
for material in bpy.data.materials:
|
||||||
bpy.data.materials.remove(material, do_unlink=True)
|
bpy.data.materials.remove(material, do_unlink=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user