Commit: 3f8e26370925c94e07f0bbdd51cddad6601fa125 Author: Brecht Van Lommel Date: Mon Feb 11 13:37:45 2019 +0100 Branches: master https://developer.blender.org/rB3f8e26370925c94e07f0bbdd51cddad6601fa125
Merge branch 'blender2.7' =================================================================== =================================================================== diff --cc intern/cycles/blender/addon/operators.py index 00000000000,c39aa386203..ed7f5c6b98c mode 000000,100644..100644 --- a/intern/cycles/blender/addon/operators.py +++ b/intern/cycles/blender/addon/operators.py @@@ -1,0 -1,133 +1,133 @@@ + # + # Copyright 2011-2019 Blender Foundation + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # + + # <pep8 compliant> + + import bpy + from bpy.types import Operator + from bpy.props import StringProperty + + + class CYCLES_OT_use_shading_nodes(Operator): + """Enable nodes on a material, world or light""" + bl_idname = "cycles.use_shading_nodes" + bl_label = "Use Nodes" + + @classmethod + def poll(cls, context): + return (getattr(context, "material", False) or getattr(context, "world", False) or + getattr(context, "light", False)) + + def execute(self, context): + if context.material: + context.material.use_nodes = True + elif context.world: + context.world.use_nodes = True + elif context.light: + context.light.use_nodes = True + + return {'FINISHED'} + + + class CYCLES_OT_denoise_animation(Operator): + """Denoise rendered animation sequence using current scene and view """ \ + """layer settings. Requires denoising data passes and output to """ \ + """OpenEXR multilayer files""" + bl_idname = "cycles.denoise_animation" + bl_label = "Denoise Animation" + - input_filepath = StringProperty( ++ input_filepath: StringProperty( + name='Input Filepath', + description='File path for frames to denoise. If not specified, uses the render file path from the scene', + default='', + subtype='FILE_PATH') + - output_filepath = StringProperty( ++ output_filepath: StringProperty( + name='Output Filepath', + description='If not specified, renders will be denoised in-place', + default='', + subtype='FILE_PATH') + + def execute(self, context): + import os + - preferences = context.user_preferences ++ preferences = context.preferences + scene = context.scene - render_layer = scene.render.layers.active ++ view_layer = context.view_layer + + in_filepath = self.input_filepath + out_filepath = self.output_filepath + + if in_filepath == '': + in_filepath = scene.render.filepath + if out_filepath == '': + out_filepath = in_filepath + + # Backup since we will overwrite the scene path temporarily + original_filepath = scene.render.filepath + + # Expand filepaths for each frame so we match Blender render output exactly. + in_filepaths = [] + out_filepaths = [] + + for frame in range(scene.frame_start, scene.frame_end + 1): + scene.render.filepath = in_filepath + filepath = scene.render.frame_path(frame=frame) + in_filepaths.append(filepath) + + if not os.path.isfile(filepath): + scene.render.filepath = original_filepath + self.report({'ERROR'}, f"Frame '{filepath}' not found, animation must be complete.") + return {'CANCELLED'} + + scene.render.filepath = out_filepath + filepath = scene.render.frame_path(frame=frame) + out_filepaths.append(filepath) + + scene.render.filepath = original_filepath + + # Run denoiser + # TODO: support cancel and progress reports. + import _cycles + try: + _cycles.denoise(preferences.as_pointer(), + scene.as_pointer(), - render_layer.as_pointer(), ++ view_layer.as_pointer(), + input=in_filepaths, + output=out_filepaths) + except Exception as e: + self.report({'ERROR'}, str(e)) + return {'FINISHED'} + + self.report({'INFO'}, "Denoising completed.") + return {'FINISHED'} + + + classes = ( + CYCLES_OT_use_shading_nodes, + CYCLES_OT_denoise_animation + ) + + def register(): + from bpy.utils import register_class + for cls in classes: + register_class(cls) + + + def unregister(): + from bpy.utils import unregister_class + for cls in classes: + unregister_class(cls) diff --cc intern/cycles/blender/addon/properties.py index c60db9ffc2b,1106923f529..c14d7014234 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@@ -1236,163 -1219,209 +1236,169 @@@ def update_render_passes(self, context) class CyclesRenderLayerSettings(bpy.types.PropertyGroup): - @classmethod - def register(cls): - bpy.types.SceneRenderLayer.cycles = PointerProperty( - name="Cycles SceneRenderLayer Settings", - description="Cycles SceneRenderLayer Settings", - type=cls, - ) - cls.pass_debug_bvh_traversed_nodes = BoolProperty( - name="Debug BVH Traversed Nodes", - description="Store Debug BVH Traversed Nodes pass", - default=False, - update=update_render_passes, - ) - cls.pass_debug_bvh_traversed_instances = BoolProperty( - name="Debug BVH Traversed Instances", - description="Store Debug BVH Traversed Instances pass", - default=False, - update=update_render_passes, - ) - cls.pass_debug_bvh_intersections = BoolProperty( - name="Debug BVH Intersections", - description="Store Debug BVH Intersections", - default=False, - update=update_render_passes, - ) - cls.pass_debug_ray_bounces = BoolProperty( - name="Debug Ray Bounces", - description="Store Debug Ray Bounces pass", - default=False, - update=update_render_passes, - ) - cls.pass_debug_render_time = BoolProperty( - name="Debug Render Time", - description="Render time in milliseconds per sample and pixel", - default=False, - update=update_render_passes, - ) - cls.use_pass_volume_direct = BoolProperty( - name="Volume Direct", - description="Deliver direct volumetric scattering pass", - default=False, - update=update_render_passes, - ) - cls.use_pass_volume_indirect = BoolProperty( - name="Volume Indirect", - description="Deliver indirect volumetric scattering pass", - default=False, - update=update_render_passes, - ) - cls.use_denoising = BoolProperty( - name="Use Denoising", - description="Denoise the rendered image", - default=False, - update=update_render_passes, - ) - cls.denoising_diffuse_direct = BoolProperty( - name="Diffuse Direct", - description="Denoise the direct diffuse lighting", - default=True, - ) - cls.denoising_diffuse_indirect = BoolProperty( - name="Diffuse Indirect", - description="Denoise the indirect diffuse lighting", - default=True, - ) - cls.denoising_glossy_direct = BoolProperty( - name="Glossy Direct", - description="Denoise the direct glossy lighting", - default=True, - ) - cls.denoising_glossy_indirect = BoolProperty( - name="Glossy Indirect", - description="Denoise the indirect glossy lighting", - default=True, - ) - cls.denoising_transmission_direct = BoolProperty( - name="Transmission Direct", - description="Denoise the direct transmission lighting", - default=True, - ) - cls.denoising_transmission_indirect = BoolProperty( - name="Transmission Indirect", - description="Denoise the indirect transmission lighting", - default=True, - ) - cls.denoising_subsurface_direct = BoolProperty( - name="Subsurface Direct", - description="Denoise the direct subsurface lighting", - default=True, - ) - cls.denoising_subsurface_indirect = BoolProperty( - name="Subsurface Indirect", - description="Denoise the indirect subsurface lighting", - default=True, - ) - cls.denoising_strength = FloatProperty( - name="Denoising Strength", - description="Controls neighbor pixel weighting for the denoising filter (lower values preserve more detail, but aren't as smooth)", - min=0.0, max=1.0, - default=0.5, - ) - cls.denoising_feature_strength = FloatProperty( - name="Denoising Feature Strength", - description="Controls removal of noisy image feature passes (lower values preserve more detail, but aren't as smooth)", - min=0.0, max=1.0, - default=0.5, - ) - cls.denoising_radius = IntProperty( - name="Denoising Radius", - description="Size of the image area that's used to denoise a pixel (higher values are smoother, but might lose detail and are slower)", - min=1, max=25, - default=8, - ) - cls.denoising_relative_pca = BoolProperty( - name="Relative filter", - @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
