Cycles / Motion Blur:
authorThomas Dinges <blender@dingto.org>
Fri, 16 Aug 2013 12:18:01 +0000 (12:18 +0000)
committerThomas Dinges <blender@dingto.org>
Fri, 16 Aug 2013 12:18:01 +0000 (12:18 +0000)
* Added a new panel "Settings" to the object tab.
* Motion blur can now be enabled/disabled on a per object basis, so we can disable motion blur for certain objects.
* Also added some code for the Motion Multiplier, to weaken/strengthen the motion effect per object, but that is still disabled and hidden from the UI.

intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_object.cpp
intern/cycles/render/object.cpp
intern/cycles/render/object.h

index eba94604a88c436b804f16f9e27ec5fd5c698e06..083fa643fe77f9925ff3b7290c03af7d33f0580e 100644 (file)
@@ -591,6 +591,31 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
         del bpy.types.World.cycles
 
 
+class CyclesObjectSettings(bpy.types.PropertyGroup):
+    @classmethod
+    def register(cls):
+        bpy.types.Object.cycles_settings = PointerProperty(
+                name="Cycles Object Settings",
+                description="Cycles object settings",
+                type=cls,
+                ) 
+        cls.use_motion = BoolProperty(
+                name="Motion Blur",
+                description="Enable or disable motion blur for this object",
+                default=True,
+                )
+        cls.motion_multiplier = FloatProperty(
+                name="Motion Multiplier",
+                description="Multiplier for Object motion blur shutter time",
+                min=0.0, soft_max=10.0, max=100.0,
+                default=1.0,
+                )
+
+
+    @classmethod
+    def unregister(cls):
+        del bpy.types.Object.cycles_settings
+
 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
     @classmethod
     def register(cls):
index 64fda3ef53562b460ac214ad8d5e8b56f7adc55e..5ef718e1db4ff18a66475c11269b0c3ca723a722 100644 (file)
@@ -572,6 +572,26 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
             flow.prop(visibility, "shadow")
 
 
+class CyclesObject_PT_settings(CyclesButtonsPanel, Panel):
+    bl_label = "Settings"
+    bl_context = "object"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        ob = context.object
+        return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+        settings = ob.cycles_settings
+        
+        layout.prop(settings, "use_motion")
+        #layout.prop(settings, "motion_multiplier")
+
+
 class CYCLES_OT_use_shading_nodes(Operator):
     """Enable nodes on a material, world or lamp"""
     bl_idname = "cycles.use_shading_nodes"
index 3410c73fbde5a02e25a8805e641850b5ad44e771..39ebb3dc1c6856d80ef04b8c59958613521d1e3d 100644 (file)
@@ -241,13 +241,17 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
                object = object_map.find(key);
 
                if(object) {
+                       PointerRNA csettings = RNA_pointer_get(&b_ob.ptr, "cycles_settings");
+
+                       object->motion_multiplier = get_float(csettings, "motion_multiplier");
+
                        if(tfm != object->tfm) {
                                if(motion == -1)
                                        object->motion.pre = tfm;
                                else
                                        object->motion.post = tfm;
-
-                               object->use_motion = true;
+                                       
+                               object->use_motion = get_boolean(csettings, "use_motion");
                        }
 
                        /* mesh deformation blur not supported yet */
index 7931a51b99d94dfe1faa659dc0a56a2f47182dd5..adac22b64fec49f7095f0d623605c5d85d5d41da 100644 (file)
@@ -47,6 +47,7 @@ Object::Object()
        use_motion = false;
        use_holdout = false;
        curverender = false;
+       motion_multiplier = 1.0f;
 }
 
 Object::~Object()
index b3ab0e93b5c9a9524bf537e9ccc4f11e5e83374d..c45d5b1d5a63ceae296137c4b60d9ac8ec47f376 100644 (file)
@@ -54,6 +54,8 @@ public:
        float2 dupli_uv;
 
        int particle_id;
+       
+       float motion_multiplier;
 
        Object();
        ~Object();