Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material-Export adding Linebreake in the Comment-Section of the Shader-Code (With possible Solution?) #415

Open
zurrealStudios opened this issue May 10, 2022 · 0 comments
Labels

Comments

@zurrealStudios
Copy link

OS:
Windows 10 and ArchLinux (5.17.5-arch1-1)

Godot version:
3.4.2 and 3.4.4

Blender version:
3.0 and 3.1

Issue description:
Sometimes while exporting 3D-Models with Materials from Blender to Godot, the Shadernode-Names the Export-Addon generates, while converting Shader-Nodes to a Shader-Code, are to long. Now if the Names are to long, the commented Section in the Shader-Code will exceed the "SCRIPT_MAX_WIDTH = 80" and will add a Line Break, which will generate following Compiler-Error in Godot:
pre_fix

After some tinkering in the ../io_scene_godot/converters/material/script_shader/node_tree.py File I came up with the following "solution":
Between Line 122 and 123 I added: self._fragment_code_lines.append("/*") and
between Line 161 and 162 I added: self._fragment_code_lines.append("// */")

After the "Hack" the Shader-Code is as follows:
post_fix

Now I am a Beginner when it comes to coding and I don't know if this Fix is passable, or not. I attached the Blender-File with the Material the Error occurs with and the changed node_tree.py File

Minimal reproduction project:
Export the Cube from the given Blender-Project with the Godot-Exporter Addon and "Generate external Material" ticked on

Blender and PythonFile.zip

I hope this will have some use and have a great Day you all :)

@Calinou Calinou added the bug label May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants