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

.blend files with quotation marks in filename fail to import #78447

Closed
lyuma opened this issue Jun 19, 2023 · 3 comments · Fixed by #94004
Closed

.blend files with quotation marks in filename fail to import #78447

lyuma opened this issue Jun 19, 2023 · 3 comments · Fixed by #94004

Comments

@lyuma
Copy link
Contributor

lyuma commented Jun 19, 2023

Godot version

4.0, 4.1.beta.custom_build.e92abf33e

System information

Godot v4.1.beta (e92abf33e) - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3090 (NVIDIA; 31.0.15.2756) - Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 Threads)

Issue description

This file was originally sent in by the comment here: #67275 (comment)

It seems as though blend files with single quotes are somehow not invoking the blender conversion correctly. I think it's escaping it with backslashes but generating XML which is not the correct escape for XML

  modules\gltf\gltf_document.cpp:7440 - Condition "err != OK" is true. Returning: ERR_FILE_CANT_OPEN
  Error importing 'res://Mermaid's Grotto.blend'.

This is the command line reported by windows:

"C:\Program Files\Blender Foundation\Blender 3.4\blender.exe" --background --python-expr "
import bpy, sys, threading
from xmlrpc.server import SimpleXMLRPCServer
req = threading.Condition()
res = threading.Condition()
info = None
def xmlrpc_server():
  server = SimpleXMLRPCServer(('127.0.0.1', 6011))
  server.register_function(export_gltf)
  server.serve_forever()
def export_gltf(opts):
  with req:
    global info
    info = ('export_gltf', opts)
    req.notify()
  with res:
    res.wait()
if bpy.app.version < (3, 0, 0):
  print('Blender 3.0 or higher is required.', file=sys.stderr)
threading.Thread(target=xmlrpc_server).start()
while True:
  with req:
    while info is None:
      req.wait()
  method, opts = info
  if method == 'export_gltf':
    try:
      bpy.ops.wm.open_mainfile(filepath=opts['path'])
      if opts['unpack_all']:
        bpy.ops.file.unpack_all(method='USE_LOCAL')
      bpy.ops.export_scene.gltf(**opts['gltf_options'])
    except:
      pass
  info = None
  with res:
    res.notify()
"

These are the packets sent to port 6011, as captured by wireshark:

POST / HTTP/1.1
Host: 127.0.0.1:6011
Content-Length: 2228
User-Agent: GodotEngine/4.1.beta.custom_build (Windows)
Accept: */*

<?xml version="1.0"?><methodCall><methodName>export_gltf</methodName><params><param><value><struct><member><name>unpack_all</name><value><boolean>1</boolean></value></member><member><name>path</name><value><string>S:/GDProjects/_BugReports/ShaderMaterialEdit/Mermaid\'s Grotto.blend</string></value></member><member><name>gltf_options</name><value><struct><member><name>filepath</name><value><string>S:/GDProjects/_BugReports/ShaderMaterialEdit/.godot/imported/Mermaid\'s Grotto-fb46f6ba2bc4fff24f97496fa91c5c3d.gltf</string></value></member><member><name>export_keep_originals</name><value><boolean>1</boolean></value></member><member><name>export_format</name><value><string>GLTF_SEPARATE</string></value></member><member><name>export_yup</name><value><boolean>1</boolean></value></member><member><name>export_extras</name><value><boolean>1</boolean></value></member><member><name>export_skins</name><value><boolean>1</boolean></value></member><member><name>export_all_influences</name><value><boolean>1</boolean></value></member><member><name>export_materials</name><value><string>EXPORT</string></value></member><member><name>export_cameras</name><value><boolean>1</boolean></value></member><member><name>export_lights</name><value><boolean>1</boolean></value></member><member><name>export_colors</name><value><boolean>0</boolean></value></member><member><name>use_renderable</name><value><boolean>0</boolean></value></member><member><name>use_visible</name><value><boolean>0</boolean></value></member><member><name>export_texcoords</name><value><boolean>1</boolean></value></member><member><name>export_normals</name><value><boolean>1</boolean></value></member><member><name>export_tangents</name><value><boolean>1</boolean></value></member><member><name>export_nla_strips</name><value><boolean>1</boolean></value></member><member><name>export_frame_range</name><value><boolean>1</boolean></value></member><member><name>export_force_sampling</name><value><boolean>1</boolean></value></member><member><name>export_def_bones</name><value><boolean>0</boolean></value></member><member><name>export_apply</name><value><boolean>1</boolean></value></member></struct></value></member></struct></value></param></params></methodCall>

reply:

HTTP/1.0 200 OK
Server: BaseHTTP/0.6 Python/3.10.8
Date: Mon, 19 Jun 2023 21:25:38 GMT
Content-type: text/xml
Content-length: 329

<?xml version='1.0'?>
<methodResponse>
<fault>
<value><struct>
<member>
<name>faultCode</name>
<value><int>1</int></value>
</member>
<member>
<name>faultString</name>
<value><string>&lt;class 'TypeError'&gt;:cannot marshal None unless allow_none is enabled</string></value>
</member>
</struct></value>
</fault>
</methodResponse>

Steps to reproduce

  1. Make sure Blender is configured in editor settings, and restart the editor after changing it.
  2. Open the attached project
  3. See the Mermaid's Grotto fails to import.

Minimal reproduction project

BlendSingleQuote.zip

@lyuma
Copy link
Contributor Author

lyuma commented Jun 19, 2023

Another note, but it might also be nice for Godot to print the faultString returned by Blender, since I can't find what happens to it.

For example, the single quote filename has this in the RPC XML response:

<fault>
<value><struct>
<member>
<name>faultCode</name>
<value><int>1</int></value>
</member>
<member>
<name>faultString</name>
<value><string>&lt;class 'TypeError'&gt;:cannot marshal None unless allow_none is enabled</string></value>
</member>
</struct></value>
</fault>

yet the output log just says Condition "err != OK" is true so Godot is throwing away this error message and not presenting it to the user.

Also, the error message seems like another bug that stems from Blender failing to convert, so it would also be good to improve the error handling on Blender's end too.

@RedMser
Copy link
Contributor

RedMser commented Jun 19, 2023

I have exams for the next few weeks so I can't really look into it much, but once I have time sure 👍

@RedMser
Copy link
Contributor

RedMser commented Jul 1, 2023

This is caused by the fix in #59996 (specifically the c_escape calls).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants