summarylogtreecommitdiffstats
path: root/denoise.patch
blob: 53dcf0c4f829044ea0a3f1fb9b8f8c684415f59c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
diff --git a/__init__.py b/__init__.py
index 1570b8a..7f0a2a1 100644
--- a/__init__.py
+++ b/__init__.py
@@ -2,6 +2,7 @@ import bpy
 import addon_utils
 import platform
 import os
+from shutil import which
 
 
 _, luxblend_is_enabled = addon_utils.check("luxrender")
@@ -43,10 +44,7 @@ if platform.system() in {"Linux", "Darwin"}:
     
     # Make sure denoiser is executable
     current_dir = os.path.dirname(os.path.realpath(__file__))
-    denoiser_path = os.path.join(current_dir, "bin", "denoise")
-    if not os.access(denoiser_path, os.X_OK):
-        print("Making LuxCore denoiser executable")
-        os.chmod(denoiser_path, 0o755)
+    denoiser_path = which('oidnDenoise')
 
 try:
     from .bin import pyluxcore
diff --git a/draw/viewport.py b/draw/viewport.py
index a28cf9f..f7fd34c 100644
--- a/draw/viewport.py
+++ b/draw/viewport.py
@@ -8,6 +8,7 @@ import tempfile
 from ..bin import pyluxcore
 from .. import utils
 from ..utils import pfm
+from shutil import which
 
 NULL = 0
 
@@ -72,8 +73,7 @@ class FrameBuffer(object):
         self._albedo_file_path = self._make_denoiser_filepath("albedo")
         self._normal_file_path = self._make_denoiser_filepath("normal")
         self._denoised_file_path = self._make_denoiser_filepath("denoised")
-        current_dir = os.path.dirname(os.path.realpath(__file__))
-        self._denoiser_path = os.path.join(os.path.dirname(current_dir), "bin", "denoise")
+        self._denoiser_path = which('oidnDenoise')
         if platform.system() == "Windows":
             self._denoiser_path += ".exe"
         self._denoiser_process = None