Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-06-12 14:54:17 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-06-22 14:59:59 +0300
commit97a6b67d51daabdde8768d675b38886a16393329 (patch)
treeb905a3d89bc835f0b678481ee796f6c1e5775c61
parentc135f41ac582488bef82bc25970fce39c7fcdd1c (diff)
Cycles: Respect duplicator's object motion blur settings
The idea is to make it possible to control linked duplicated objects motion blur from the scene file without need to do overrides on the linked object settings. Currently only supported for dupligroup duplication and all now if duplicator object has motion blur disabled then it'll be inherited into all the duplicated objects. There should be no regressions/changes in look of existing files because objects do have motion blur enabled by default.
-rw-r--r--intern/cycles/blender/addon/ui.py12
-rw-r--r--intern/cycles/blender/blender_object.cpp8
-rw-r--r--intern/cycles/blender/blender_util.h26
3 files changed, 36 insertions, 10 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index fb6a3d76dec..e60b70c3209 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -650,7 +650,13 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
ob = context.object
- return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}
+ if CyclesButtonsPanel.poll(context) and ob:
+ if ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}:
+ return True
+ if ob.dupli_type == 'GROUP' and ob.dupli_group:
+ return True
+ # TODO(sergey): More duplicator types here?
+ return False
def draw_header(self, context):
layout = self.layout
@@ -693,8 +699,8 @@ class CyclesObject_PT_cycles_settings(CyclesButtonsPanel, Panel):
def poll(cls, context):
ob = context.object
return (CyclesButtonsPanel.poll(context) and
- ob and ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'} or
- ob and ob.dupli_type == 'GROUP' and ob.dupli_group)
+ ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'}) or
+ (ob.dupli_type == 'GROUP' and ob.dupli_group)))
def draw(self, context):
layout = self.layout
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index e999945e955..764e160f6fc 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -311,7 +311,9 @@ Object *BlenderSync::sync_object(BL::Object b_parent,
if(motion) {
object = object_map.find(key);
- if(object && (scene->need_motion() == Scene::MOTION_PASS || object_use_motion(b_ob))) {
+ if(object && (scene->need_motion() == Scene::MOTION_PASS ||
+ object_use_motion(b_parent, b_ob)))
+ {
/* object transformation */
if(tfm != object->tfm) {
VLOG(1) << "Object " << b_ob.name() << " motion detected.";
@@ -395,8 +397,8 @@ Object *BlenderSync::sync_object(BL::Object b_parent,
mesh->use_motion_blur = false;
- if(object_use_motion(b_ob)) {
- if(object_use_deform_motion(b_ob)) {
+ if(object_use_motion(b_parent, b_ob)) {
+ if(object_use_deform_motion(b_parent, b_ob)) {
mesh->motion_steps = object_motion_steps(b_ob);
mesh->use_motion_blur = true;
}
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index 3199afedf3c..e28964b3d48 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -366,11 +366,20 @@ static inline void mesh_texture_space(BL::Mesh b_mesh, float3& loc, float3& size
}
/* object used for motion blur */
-static inline bool object_use_motion(BL::Object b_ob)
+static inline bool object_use_motion(BL::Object b_parent, BL::Object b_ob)
{
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
bool use_motion = get_boolean(cobject, "use_motion_blur");
-
+ /* If motion blur is enabled for the object we also check
+ * whether it's enabled for the parent object as well.
+ *
+ * This way we can control motion blur from the dupligroup
+ * duplicator much easier.
+ */
+ if(use_motion && b_parent.ptr.data != b_ob.ptr.data) {
+ PointerRNA parent_cobject = RNA_pointer_get(&b_parent.ptr, "cycles");
+ use_motion &= get_boolean(parent_cobject, "use_motion_blur");
+ }
return use_motion;
}
@@ -387,11 +396,20 @@ static inline uint object_motion_steps(BL::Object b_ob)
}
/* object uses deformation motion blur */
-static inline bool object_use_deform_motion(BL::Object b_ob)
+static inline bool object_use_deform_motion(BL::Object b_parent, BL::Object b_ob)
{
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
bool use_deform_motion = get_boolean(cobject, "use_deform_motion");
-
+ /* If motion blur is enabled for the object we also check
+ * whether it's enabled for the parent object as well.
+ *
+ * This way we can control motion blur from the dupligroup
+ * duplicator much easier.
+ */
+ if(use_deform_motion && b_parent.ptr.data != b_ob.ptr.data) {
+ PointerRNA parent_cobject = RNA_pointer_get(&b_parent.ptr, "cycles");
+ use_deform_motion &= get_boolean(parent_cobject, "use_deform_motion");
+ }
return use_deform_motion;
}