diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-16 21:07:25 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-16 21:07:25 +0400 |
commit | b01233b07fbf06ba5139d4565c6148f65ab921e9 (patch) | |
tree | b7ffc32198307c1364f41b8f0368026a16af88ed /intern/cycles/blender/blender_util.h | |
parent | f55a9eb3d4e12e5667e16b9f4dd2c2ec88a792f6 (diff) |
Movies support for Cycles
This adds support of movie textures for Cycles rendering.
Uses the same builtin images routines as packed/generated images,
but with some extra non-rna hookups from blender_session side.
Basically, it's not so clear how to give access to video frames
via C++ RNA -- it'll require exposing ImBuf to API, doing some
threading locks and so. Ended up adding two more functions which
are actually bad level call, but don't consider it's so much bad
-- we have few bad calls already, which are actually related.
Changed a bit how builtin images names are passing to image
manager. Now it's not just an ID datablock name, but also a frame
number concatenated via '@' character, which makes itpossible to
easily know frame number to be used for movie images, without
adding extra descriptors to image manager.
Decoding of builtin name is a bit slower now, but it should be
still nothing in comparison with rendering complexity.
Also exposed image user's frame_current to python API, which
is needed to get absolute frame number of movie from node's
image user.
P.S. Generated/packed images are also using bad level call but
only does it to make things more clear here. Either all images
are using C++ RNA here or no images does. That's the most clear
for now.
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r-- | intern/cycles/blender/blender_util.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 88c98860794..f134416f2d0 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -33,6 +33,8 @@ extern "C" { void BLI_timestr(double _time, char *str); void BKE_image_user_frame_calc(void *iuser, int cfra, int fieldnr); void BKE_image_user_file_path(void *iuser, void *ima, char *path); +unsigned char *BKE_image_get_pixels_for_frame(void *image, int frame); +float *BKE_image_get_float_pixels_for_frame(void *image, int frame); } CCL_NAMESPACE_BEGIN @@ -100,6 +102,22 @@ static inline string image_user_file_path(BL::ImageUser iuser, BL::Image ima, in return string(filepath); } +static inline int image_user_frame_number(BL::ImageUser iuser, int cfra) +{ + BKE_image_user_frame_calc(iuser.ptr.data, cfra, 0); + return iuser.frame_current(); +} + +static inline unsigned char *image_get_pixels_for_frame(BL::Image image, int frame) +{ + return BKE_image_get_pixels_for_frame(image.ptr.data, frame); +} + +static inline float *image_get_float_pixels_for_frame(BL::Image image, int frame) +{ + return BKE_image_get_float_pixels_for_frame(image.ptr.data, frame); +} + /* Utilities */ static inline Transform get_transform(BL::Array<float, 16> array) |