grantwilk / d-noise

An AI denoising pipeline between Blender and NVIDIA's OptiX AI-Accelerated Denoiser.
http://remingtoncreative.com/software/blender/d-noise
GNU General Public License v3.0
304 stars 36 forks source link

D-NOISE disables passes even if they aren't related to D-NOISE. #28

Closed grantwilk closed 4 years ago

grantwilk commented 5 years ago

I recently downloaded your D-Noise add-on for Blender 2.79 and I just noticed a bug: every time it loads a blendfile, it will disable the Diffuse Color output and Normal Output from the currently selected RenderLayer. I believe this happens in __init__.py:333:

    # append app handlers
    bpy.app.handlers.load_post.append(loaddnoisesettings)

and then in loaddnoisesettings:

@persistent
def loaddnoisesettings(placeholder = None):
    ...
    else:
        fmutils.disablepasses(active_layer)

Problem is, disablepasses() will unconditionally remove the outputs I mentioned previously even if they are not related to D-Noise at all.

I noticed this because I had some old blendfiles that had multiple outputs to do some post-processing; but some of the outputs were getting disabled when I loaded them.

Great work otherwise, and thanks for making this add-on!

maekern commented 5 years ago

I am also having this problem. (Blender 2,79b) Specifically it seems to be related to the "Use extra passes" option in D-Noise, even when D-noise denoising is disabled. Basically it seems to be assuming that if it is not using certain layers (like normal) then nothing else is either, and disables them.

A work-around is to enable "use extra passes", but then if you don't a keep the D-noise file output node in the compositor, D-noise crashes. It's clearly crashing due to the file/layers it expects being missing, but for completeness, that crash traceback is:

Traceback (most recent call last): File "C:\Users\Adrian\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\DNOISE__init.py", line 138, in runrenderdenoiser optix.denoise(SCRIPT_DIR, source_name) File "C:\Users\Adrian\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\DNOISE\optix.py", line 36, in denoise fulldenoise(directory, source_name, normal_name, albedo_name, gethdr(), getblend()) File "C:\Users\Adrian\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\DNOISE\optix.py", line 50, in fulldenoise convertnormals(directory, normal_name) File "C:\Users\Adrian\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\DNOISE\optix.py", line 162, in convertnormals fmutils.load(directory, filename, 'Normal') File "C:\Users\Adrian\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\DNOISE\fmutils.py", line 48, in load bpy.data.images.load(filepath=os.path.join(directory, filename)) File "C:\Program Files\Blender Foundation\Blender\2.79\python\lib\ntpath.py", line 113, in join genericpath._check_arg_types('join', path, *paths) File "C:\Program Files\Blender Foundation\Blender\2.79\python\lib\genericpath.py", line 143, in _check_arg_types (funcname, s.class.name__)) from None TypeError: join() argument must be str or bytes, not 'NoneType'