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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 08:55:39 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 08:55:39 +0300
commitd27158aae9bc48b2a07760a2dbe8e642fcecbe57 (patch)
tree7ecfe898e53f07e589ee4be0ea5b297153d7dfcf /intern/cycles/blender/blender_util.h
parentf3161bd2abe4bcc41f0e9169275be315ecc6b054 (diff)
parent8a76f8dac3475b1d24956e0d384d65295f15c76a (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r--intern/cycles/blender/blender_util.h54
1 files changed, 28 insertions, 26 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index a813a09f38a..5b67ff85a9b 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -248,14 +248,15 @@ static inline float *image_get_float_pixels_for_frame(BL::Image& image,
static inline Transform get_transform(const BL::Array<float, 16>& array)
{
- Transform tfm;
+ ProjectionTransform projection;
- /* we assume both types to be just 16 floats, and transpose because blender
- * use column major matrix order while we use row major */
- memcpy(&tfm, &array, sizeof(float)*16);
- tfm = transform_transpose(tfm);
+ /* We assume both types to be just 16 floats, and transpose because blender
+ * use column major matrix order while we use row major. */
+ memcpy(&projection, &array, sizeof(float)*16);
+ projection = projection_transpose(projection);
- return tfm;
+ /* Drop last row, matrix is assumed to be affine transform. */
+ return projection_to_transform(projection);
}
static inline float2 get_float2(const BL::Array<float, 2>& array)
@@ -484,33 +485,34 @@ static inline void mesh_texture_space(BL::Mesh& b_mesh,
loc = loc*size - make_float3(0.5f, 0.5f, 0.5f);
}
-/* object used for motion blur */
-static inline bool object_use_motion(BL::Object& b_parent, BL::Object& b_ob)
+/* Object motion steps, returns 0 if no motion blur needed. */
+static inline uint object_motion_steps(BL::Object& b_parent, BL::Object& b_ob)
{
+ /* Get motion enabled and steps from object itself. */
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) {
+ if(!use_motion) {
+ return 0;
+ }
+
+ uint steps = max(1, get_int(cobject, "motion_steps"));
+
+ /* Also check parent object, so motion blur and steps can be
+ * controlled by dupligroup duplicator for linked groups. */
+ if(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;
-}
-/* object motion steps */
-static inline uint object_motion_steps(BL::Object& b_ob)
-{
- PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
- uint steps = get_int(cobject, "motion_steps");
+ if(!use_motion) {
+ return 0;
+ }
+
+ steps = max(steps, get_int(parent_cobject, "motion_steps"));
+ }
- /* use uneven number of steps so we get one keyframe at the current frame,
- * and ue 2^(steps - 1) so objects with more/fewer steps still have samples
- * at the same times, to avoid sampling at many different times */
+ /* Use uneven number of steps so we get one keyframe at the current frame,
+ * and use 2^(steps - 1) so objects with more/fewer steps still have samples
+ * at the same times, to avoid sampling at many different times. */
return (2 << (steps - 1)) + 1;
}