Skip to content

Commit 8437565

Browse files
authored
Merge pull request #167 from dictoon/master
Small improvements
2 parents edc029f + b4ab9b1 commit 8437565

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

properties/nodes/texture.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828

2929
import bpy
3030
from bpy.types import NodeSocket, Node
31-
from ...util import strip_spaces, realpath, join_names_underscore, filter_params, debug, asUpdate, sep
32-
from ..materials import AppleseedMatProps
33-
from . import AppleseedNode, AppleseedSocket
31+
from ...util import asUpdate
32+
from . import AppleseedNode
3433

3534

3635
class AppleseedTexNode(Node, AppleseedNode):

render.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
import struct
3232
import subprocess
3333
import shutil
34+
import tempfile
3435
import threading
3536
from shutil import copyfile
3637

3738
import bpy
38-
from extensions_framework import util as efutil
3939

4040
from . import projectwriter
4141
from . import util
@@ -69,7 +69,7 @@ def __render_scene(self, scene):
6969
"""
7070

7171
# Name and location of the exported project.
72-
project_dir = os.path.join(efutil.temp_directory(), "blenderseed", "render")
72+
project_dir = os.path.join(tempfile.gettempdir(), "blenderseed", "render")
7373
project_filepath = os.path.join(project_dir, "render.appleseed")
7474

7575
# Create target directories if necessary.
@@ -117,7 +117,7 @@ def __render_material_preview(self, scene):
117117
return
118118

119119
# Build the path to the output preview project.
120-
preview_output_dir = os.path.join(efutil.temp_directory(), "blenderseed", "material_preview")
120+
preview_output_dir = os.path.join(tempfile.gettempdir(), "blenderseed", "material_preview")
121121
preview_project_filepath = os.path.join(preview_output_dir, "material_preview.appleseed")
122122

123123
# Create target directories if necessary.
@@ -160,6 +160,9 @@ def __render_project_file(self, scene, project_filepath, project_dir=None):
160160
self.report({'ERROR'}, "The path to the folder containing the appleseed.cli executable has not been specified. Set the path in the add-on user preferences.")
161161
return
162162

163+
# Properly handle relative Blender paths.
164+
appleseed_bin_dir = util.realpath(appleseed_bin_dir)
165+
163166
# Check that the path to the bin folder indeed points to a folder.
164167
if not os.path.isdir(appleseed_bin_dir):
165168
self.report({'ERROR'}, "The path to the folder containing the appleseed.cli executable was set to {0} but this does not appear to be a valid folder.".format(appleseed_bin_dir))

util.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@
2626
# THE SOFTWARE.
2727
#
2828

29-
import datetime
3029
import multiprocessing
3130
import os
3231
from math import tan, atan, degrees
3332

3433
import bpy
3534
import mathutils
36-
from extensions_framework import util as efutil
3735

3836
from . import bl_info
3937

@@ -83,7 +81,17 @@ def filter_params(params):
8381

8482

8583
def realpath(path):
86-
return os.path.realpath(efutil.filesystem_path(path))
84+
"""Resolve a relative Blender path to a real filesystem path"""
85+
86+
if path.startswith('//'):
87+
path = bpy.path.abspath(path)
88+
else:
89+
path = os.path.realpath(path)
90+
91+
path = path.replace('\\', '/')
92+
path = os.path.realpath(path)
93+
94+
return path
8795

8896

8997
# ------------------------------------

0 commit comments

Comments
 (0)