elmopl / ktba

Blender addons
MIT License
56 stars 12 forks source link

Ability to set Relative path for output directory #3

Closed elmopl closed 7 years ago

elmopl commented 7 years ago

As it says on the tin. Currently relative path as output dir puts files not where one would expect it.

mond-cz commented 7 years ago

May I ask you where is it? Since I rendered several times (for testing purpose) to relative path I would like to delete them. I tried to check my "tmp" folder, but there is nothing related to this. Thanks for help.

elmopl commented 7 years ago

This is where the tempfile is created so it uses standard Python module:

    project_file = tempfile.NamedTemporaryFile(suffix='.blend', delete=False).name

You should be able to run in Blender's Python console:

    import tempfile
    print(tempfile.NamedTemporaryFile())

to see where it creates those.

mond-cz commented 7 years ago

Do you ever sleep, man? :) Thanks for response.

I tried to educate myself, but no way :) sorry "end user" :) How can someone recognise path from this console print? <tempfile._TemporaryFileWrapper object at 0x10ff5e390> Search on net without success.

I expected something like this - path as answer bpy.app.tempdir '/tmp/blender_8xXx6t/'

I'm interested in this directory just because I understood that thanks to relative path are now files saved somewhere and are not deleted automatically. Right?

elmopl commented 7 years ago

My mistake. Object returned by NamedTemporaryFile has a name property (see here):

That name can be retrieved from the name attribute of the returned file-like object.

So the code snippet should have been:

import tempfile
print(tempfile.NamedTemporaryFile().name)
mond-cz commented 7 years ago

Thanks ! I got it :)