Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-03-18 17:01:04 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-03-18 17:01:04 +0400
commit6c32300be8cc8d48a3e02055dc43bea2ab98a525 (patch)
tree59541ff94cdee03300663f49a34fff4e7b4bb303
parent8ad356e3324cddef42d41f9b9b588ef1ebd2f8bf (diff)
Backport revisions for the final 2.70 releasev2.70
8b0864a
-rw-r--r--io_online_sketchfab/__init__.py6
-rw-r--r--io_online_sketchfab/pack_for_export.py5
2 files changed, 8 insertions, 3 deletions
diff --git a/io_online_sketchfab/__init__.py b/io_online_sketchfab/__init__.py
index 3e5d7472..b39f4f7f 100644
--- a/io_online_sketchfab/__init__.py
+++ b/io_online_sketchfab/__init__.py
@@ -47,6 +47,7 @@ else:
import bpy
import os
+import tempfile
import threading
import subprocess
@@ -244,7 +245,8 @@ class ExportSketchfab(bpy.types.Operator):
basename = os.path.join(basename, "temp")
if not ext:
ext = ".blend"
- filepath = basename + "-export-sketchfab" + ext
+ tempdir = tempfile.mkdtemp()
+ filepath = os.path.join(tempdir, "export-sketchfab" + ext)
try:
# save a copy of actual scene but don't interfere with the users models
@@ -262,6 +264,7 @@ class ExportSketchfab(bpy.types.Operator):
"-noaudio",
filepath,
"--python", os.path.join(script_path, "pack_for_export.py"),
+ "--", tempdir
])
os.remove(filepath)
@@ -434,6 +437,7 @@ class SketchfabEmailToken(bpy.types.Operator):
# remove file copy
def terminate(filepath):
os.remove(filepath)
+ os.rmdir(os.path.dirname(filepath))
# registration
classes = (
diff --git a/io_online_sketchfab/pack_for_export.py b/io_online_sketchfab/pack_for_export.py
index a8e7fc9b..16d38cca 100644
--- a/io_online_sketchfab/pack_for_export.py
+++ b/io_online_sketchfab/pack_for_export.py
@@ -23,10 +23,12 @@
import os
import bpy
import json
+import sys
SKETCHFAB_EXPORT_DATA_FILENAME = 'sketchfab-export-data.json'
+SKETCHFAB_EXPORT_TEMP_DIR = sys.argv[-1]
SKETCHFAB_EXPORT_DATA_FILE = os.path.join(
bpy.utils.user_resource('SCRIPTS'),
"presets",
@@ -38,7 +40,7 @@ SKETCHFAB_EXPORT_DATA_FILE = os.path.join(
def save_blend_copy():
import time
- filepath = os.path.dirname(bpy.data.filepath)
+ filepath = SKETCHFAB_EXPORT_TEMP_DIR
filename = time.strftime("Sketchfab_%Y_%m_%d_%H_%M_%S.blend",
time.localtime(time.time()))
filepath = os.path.join(filepath, filename)
@@ -119,6 +121,5 @@ if __name__ == "__main__":
import traceback
traceback.print_exc()
- import sys
sys.exit(1)