[Bf-blender-cvs] [23042a3fb18] master: Cycles: add view layer option to disable motion blur, in the Filter panel

Brecht Van Lommel noreply at git.blender.org
Fri Jun 25 18:48:18 CEST 2021


Commit: 23042a3fb189620a6d908ced1af98b10ad2f8afd
Author: Brecht Van Lommel
Date:   Fri Jun 25 18:29:17 2021 +0200
Branches: master
https://developer.blender.org/rB23042a3fb189620a6d908ced1af98b10ad2f8afd

Cycles: add view layer option to disable motion blur, in the Filter panel

===================================================================

M	intern/cycles/blender/addon/ui.py
M	intern/cycles/blender/blender_sync.cpp
M	intern/cycles/blender/blender_sync.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index ce93bd96bd5..62a2fa7f036 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -821,6 +821,11 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
         col.prop(view_layer, "use_strand", text="Hair")
         col.prop(view_layer, "use_volumes", text="Volumes")
 
+        col = layout.column(heading="Use")
+        sub = col.row()
+        sub.prop(view_layer, "use_motion_blur", text="Motion Blur")
+        sub.active = rd.use_motion_blur
+
 
 class CYCLES_RENDER_PT_override(CyclesButtonsPanel, Panel):
     bl_label = "Override"
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 82b3abd4432..b77051b2419 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -281,7 +281,6 @@ void BlenderSync::sync_data(BL::RenderSettings &b_render,
 
 void BlenderSync::sync_integrator()
 {
-  BL::RenderSettings r = b_scene.render();
   PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
 
   experimental = (get_enum(cscene, "feature_set") != 0);
@@ -325,7 +324,7 @@ void BlenderSync::sync_integrator()
   integrator->set_sample_clamp_direct(get_float(cscene, "sample_clamp_direct"));
   integrator->set_sample_clamp_indirect(get_float(cscene, "sample_clamp_indirect"));
   if (!preview) {
-    integrator->set_motion_blur(r.use_motion_blur());
+    integrator->set_motion_blur(view_layer.use_motion_blur);
   }
 
   integrator->set_method((Integrator::Method)get_enum(
@@ -456,6 +455,8 @@ void BlenderSync::sync_view_layer(BL::ViewLayer &b_view_layer)
   view_layer.use_surfaces = b_view_layer.use_solid() || scene->bake_manager->get_baking();
   view_layer.use_hair = b_view_layer.use_strand();
   view_layer.use_volumes = b_view_layer.use_volumes();
+  view_layer.use_motion_blur = b_view_layer.use_motion_blur() &&
+                               b_scene.render().use_motion_blur();
 
   /* Material override. */
   view_layer.material_override = b_view_layer.material_override();
@@ -602,7 +603,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
   for (BL::RenderPass &b_pass : b_rlay.passes) {
     PassType pass_type = get_pass_type(b_pass);
 
-    if (pass_type == PASS_MOTION && b_scene.render().use_motion_blur())
+    if (pass_type == PASS_MOTION && view_layer.use_motion_blur)
       continue;
     if (pass_type != PASS_NONE)
       Pass::add(pass_type, passes, b_pass.name().c_str());
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index 1c98e529190..949482b1f9c 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -246,6 +246,7 @@ class BlenderSync {
           use_surfaces(true),
           use_hair(true),
           use_volumes(true),
+          use_motion_blur(true),
           samples(0),
           bound_samples(false)
     {
@@ -258,6 +259,7 @@ class BlenderSync {
     bool use_surfaces;
     bool use_hair;
     bool use_volumes;
+    bool use_motion_blur;
     int samples;
     bool bound_samples;
   } view_layer;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index bb6b58e023d..fad3b2a8475 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -241,7 +241,8 @@ typedef struct SceneRenderLayer {
 #define SCE_LAY_FRS (1 << 6)
 #define SCE_LAY_AO (1 << 7)
 #define SCE_LAY_VOLUMES (1 << 8)
-/* flags between (1 << 8) and (1 << 15) are set to 1 already, for future options */
+#define SCE_LAY_MOTION_BLUR (1 << 9)
+/* flags between (1 << 9) and (1 << 15) are set to 1 already, for future options */
 
 #define SCE_LAY_ALL_Z (1 << 15)
 /* #define SCE_LAY_XOR         (1 << 16) */ /* UNUSED */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 22fa5dfe1fb..3862d2e4040 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -4204,6 +4204,16 @@ void rna_def_view_layer_common(BlenderRNA *brna, StructRNA *srna, const bool sce
     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   }
 
+  prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_MOTION_BLUR);
+  RNA_def_property_ui_text(prop, "Motion Blur", "Render motion blur in this Layer, if enabled in the scene");
+  if (scene) {
+    RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+  }
+  else {
+    RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  }
+
   /* passes */
   prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);



More information about the Bf-blender-cvs mailing list