grebtsew / FloorplanToBlender3d

Create 3d rooms in blender from floorplans.
GNU General Public License v3.0
396 stars 103 forks source link

3D modeling is created as <ID>.gltf.glb. #42

Closed Arc-Jung closed 1 month ago

Arc-Jung commented 1 month ago

@grebtsew

I created a model with the below code, but even though I requested it as a gltf file, it was generated as ID.gltf.glb Below are the logs and the actual generated files.

Do you have any opinions on this issue?

      const createandtransformResponse = await fetch(`${url}/?func=createandtransform&id=${id}&hash=${hash}&iformat=.${fileExtension}&oformat=.gltf`, {
        method: 'PUT',
        body: formData,
        headers: {
          'Content-Type': 'multipart/form-data' // Do not set this header manually, let the browser set it
        },
      });

스크린샷 2024-10-08 104134

127.0.0.1 - - [08/Oct/2024 10:28:06] "PUT /?func=createandtransform&id=5AFFAS&hash=1c48818a950542a57191613460e6570f8ea9d167ed635cf74eb57277&iformat=.png&oformat=.gltf HTTP/1.1" 200 -
WARNING: Auto rescale failed due to non good walls found in image.If rescale still is needed, please rescale manually.
Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Users\tmr\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\tmr\FloorplanToBlender3d\Server\process\create.py", line 144, in run
    fh.remove("./storage/data/" + self.process["in"] + "0/")
  File "C:\tmr\FloorplanToBlender3d\Server\file\file_handler.py", line 24, in remove
    raise ValueError("file {} is not a file or dir.".format(path))
ValueError: file ./storage/data/5AFFAS0/ is not a file or dir.
grebtsew commented 1 month ago

Hi @Arc-Jung,

I have a few comments on this. And I pushed a fix for it today.

First off, it appears I broke some stuff in the server with my last commit by removing a "/" symbol, so I have now reverted that.

The main cause of your problem is in blender/blender_export_any.py where bpy.ops.export_scene.gltf(filepath=output_path) is used to convert to gltf. Per default gltf files are then exported to the compressed format .glb. Read blender library docs here.

I have solved it by replacing the row with: bpy.ops.export_scene.gltf(filepath=output_path, export_format='GLTF_SEPARATE')

Fixed from commit https://github.com/grebtsew/FloorplanToBlender3d/commit/2da4c9532e9866b025c67aee17f87ff7e0b8db98.

I have also added a print in server/process/create.py which will show which blender command has been used when a task is done.

It can be worth metioning that the server implementation is not fully implemented, so you will probably find many similar missing features.

I'm also closing this issue, as I consider it solved.

Cheers, @grebtsew