silverslade / aframe_blender_exporter

Blender Exporter for A-Frame VR
MIT License
103 stars 17 forks source link

allow relative path for `export_path`field #8

Closed s-light closed 1 year ago

s-light commented 3 years ago

currently only absolute paths are supported as the value for the export_path field. so if you set this to // the blender default for the blend-file location the exporter crashes.

way to reproduce

result

$ ./blender
Read prefs: /home/stefan/.config/blender/2.90/config/userpref.blend
found bundled python: /home/stefan/mydata/tools/blender/blender-2.90.1-linux64/2.90/python
Info: Total files 0 | Changed 0 | Failed 0
[AFRAME EXPORTER] Exporting project...
[AFRAME EXPORTER] Target Dir = /home/stefan/mydata/github/blender/aframe_blender_exporter
--- DEST [//aframe-prj] [//aframe-prj/.] {.}
Traceback (most recent call last):
  File "/home/stefan/.config/blender/scripts/addons/aframe_blender_exporter/__init__.py", line 527, in execute
    os.makedirs ( dp, exist_ok=True )
  File "/home/stefan/mydata/tools/blender/blender-2.90.1-linux64/2.90/python/lib/python3.7/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/home/stefan/mydata/tools/blender/blender-2.90.1-linux64/2.90/python/lib/python3.7/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '//aframe-prj'

location: <unknown location>:-1

location: <unknown location>:-1
Error: Traceback (most recent call last):
  File "/home/stefan/.config/blender/scripts/addons/aframe_blender_exporter/__init__.py", line 527, in execute
    os.makedirs ( dp, exist_ok=True )
  File "/home/stefan/mydata/tools/blender/blender-2.90.1-linux64/2.90/python/lib/python3.7/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/home/stefan/mydata/tools/blender/blender-2.90.1-linux64/2.90/python/lib/python3.7/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '//aframe-prj'

location: <unknown location>:-1
s-light commented 2 years ago

https://docs.blender.org/api/current/bpy.path.html#bpy.path.abspath should do the trick..

s-light commented 2 years ago

implemented fixed by 370254868ace91e6d6e1ca5b5da38e129d15a51d