StjerneIdioten / I3D-Blender-Addon

Rewriting the I3D blender addon from scratch and adding long-sought community features
GNU General Public License v3.0
67 stars 18 forks source link

[Bug Report] Faulty GamePath hendling #179

Open nilBrain opened 1 year ago

nilBrain commented 1 year ago

The path specifications are not referenced to the BaseGame. Example:

I3D Shader Settings | Shader Source: D:\Program Files (x86)\Steam\steamapps\common\Farming Simulator 22\data\shaders\vehicleShader.xml

Add-Ons | FS Data Folder: D:\Program Files (x86)\Farming Simulator 2022\data\

When exporting, the Shader Source path is used and not the Game Data Path.

Log file: File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\node_classes\material.py", line 43, in populate_xml_element self._export_shader_settings() File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\node_classes\material.py", line 158, in _export_shader_settings shader_file_id = self.i3d.add_file_shader(shader_settings.source) File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\i3d.py", line 229, in add_file_shader return self.add_file(Shader, path_to_file) File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\i3d.py", line 217, in add_file file = file_type(file_id, self, path_to_file) File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\nodeclasses\file.py", line 33, in init super().init(id, i3d, None) File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\node_classes\node.py", line 43, in init self._create_xml_element() File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\node_classes\file.py", line 55, in _create_xml_element self._resolve_filepath() File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\node_classes\file.py", line 64, in _resolve_filepath self._copy_file() File "C:\Users\userX\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\i3dio\node_classes\file.py", line 106, in _copy_file shutil.copy(bpy.path.abspath(self.blender_path), write_directory) File "D:\Program Files\Blender Foundation\Blender 3.4\3.4\python\lib\shutil.py", line 417, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "D:\Program Files\Blender Foundation\Blender 3.4\3.4\python\lib\shutil.py", line 254, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: 'D:\Program Files (x86)\Steam\steamapps\common\Farming Simulator 22\data\shaders\vehicleShader.xml'

StjerneIdioten commented 1 year ago

Do you have FS in two places? Or how did you end up in a situation where selecting a shader from the game doesn't have the same path as the game? If I recall correctly the shader export code does compare it's own paths with the FS Data folder and correctly does the $Data replacement, but in your case the paths aren't the same and thus it considers the shader to be a custom shader and tries to copy it. But apparently the folder path you have selected the shader from doesn't actually exists?

StjerneIdioten commented 1 year ago

@NMC-TBone I know that you are looking into this a bit. PR #170 is tangibly related to this and if it isn't already solved by your solution, it should at least be consider to get that one out of the way as well in the same go 😅

nilBrain commented 1 year ago

Do you have FS in two places? Or how did you end up in a situation where selecting a shader from the game doesn't have the same path as the game? If I recall correctly the shader export code does compare it's own paths with the FS Data folder and correctly does the $Data replacement, but in your case the paths aren't the same and thus it considers the shader to be a custom shader and tries to copy it. But apparently the folder path you have selected the shader from doesn't actually exists?

It is a Team File... Member01 started ingaming, handed it over to me. He has FS in Steam, I from the eShop.

When several People are working on a blend file, it becomes quite exhausting to always adjust the path 😅

StjerneIdioten commented 1 year ago

It is a Team File... Member01 started ingaming, handed it over to me. He has FS in Steam, I from the eShop.

When several People are working on a blend file, it becomes quite exhausting to always adjust the path 😅

Ahhh, that has never been supported by the shader picker though, by (poor) design 😆 But we are looking into changing it 👍🏻

StjerneIdioten commented 11 months ago

On top of the shaders I suppose using images from the $data folder would also be a problem for sharing .blend files in a team. It should be fairly easy to check and fix that though: https://blender.stackexchange.com/questions/280337/find-missing-files-per-script