Skip to content

Commit

Permalink
Merge pull request #167 from dictoon/master
Browse files Browse the repository at this point in the history
Small improvements
  • Loading branch information
dictoon authored Jan 14, 2018
2 parents edc029f + b4ab9b1 commit 8437565
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 2 additions & 3 deletions properties/nodes/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@

import bpy
from bpy.types import NodeSocket, Node
from ...util import strip_spaces, realpath, join_names_underscore, filter_params, debug, asUpdate, sep
from ..materials import AppleseedMatProps
from . import AppleseedNode, AppleseedSocket
from ...util import asUpdate
from . import AppleseedNode


class AppleseedTexNode(Node, AppleseedNode):
Expand Down
9 changes: 6 additions & 3 deletions render.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import struct
import subprocess
import shutil
import tempfile
import threading
from shutil import copyfile

import bpy
from extensions_framework import util as efutil

from . import projectwriter
from . import util
Expand Down Expand Up @@ -69,7 +69,7 @@ def __render_scene(self, scene):
"""

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

# Create target directories if necessary.
Expand Down Expand Up @@ -117,7 +117,7 @@ def __render_material_preview(self, scene):
return

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

# Create target directories if necessary.
Expand Down Expand Up @@ -160,6 +160,9 @@ def __render_project_file(self, scene, project_filepath, project_dir=None):
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.")
return

# Properly handle relative Blender paths.
appleseed_bin_dir = util.realpath(appleseed_bin_dir)

# Check that the path to the bin folder indeed points to a folder.
if not os.path.isdir(appleseed_bin_dir):
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))
Expand Down
14 changes: 11 additions & 3 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@
# THE SOFTWARE.
#

import datetime
import multiprocessing
import os
from math import tan, atan, degrees

import bpy
import mathutils
from extensions_framework import util as efutil

from . import bl_info

Expand Down Expand Up @@ -83,7 +81,17 @@ def filter_params(params):


def realpath(path):
return os.path.realpath(efutil.filesystem_path(path))
"""Resolve a relative Blender path to a real filesystem path"""

if path.startswith('//'):
path = bpy.path.abspath(path)
else:
path = os.path.realpath(path)

path = path.replace('\\', '/')
path = os.path.realpath(path)

return path


# ------------------------------------
Expand Down

0 comments on commit 8437565

Please sign in to comment.