Merge branch 'master' into blender2.8

This commit is contained in:
Sybren A. Stüvel 2017-10-29 17:31:55 +01:00
commit 34859b285a
6 changed files with 25 additions and 3 deletions

View File

@ -31,10 +31,17 @@ CCL_NAMESPACE_BEGIN
#ifdef __SOBOL__
/* Skip initial numbers that for some dimensions have clear patterns that
* don't cover the entire sample space. Ideally we would have a better
* progressive pattern that doesn't suffer from this problem, because even
* with this offset some dimensions are quite poor.
*/
#define SOBOL_SKIP 64
ccl_device uint sobol_dimension(KernelGlobals *kg, int index, int dimension)
{
uint result = 0;
uint i = index;
uint i = index + SOBOL_SKIP;
for(uint j = 0; i; i >>= 1, j++) {
if(i & 1) {
result ^= kernel_tex_fetch(__sobol_directions, 32*dimension + j);

View File

@ -211,8 +211,9 @@ bool BKE_cachefile_filepath_get(
float BKE_cachefile_time_offset(CacheFile *cache_file, const float time, const float fps)
{
const float time_offset = cache_file->frame_offset / fps;
const float frame = (cache_file->override_frame ? cache_file->frame : time);
return cache_file->is_sequence ? frame : frame / fps;
return cache_file->is_sequence ? frame : frame / fps - time_offset;
}
/* TODO(kevin): replace this with some depsgraph mechanism, or something similar. */

View File

@ -4361,6 +4361,9 @@ void uiTemplateCacheFile(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
uiLayoutSetEnabled(row, RNA_boolean_get(&fileptr, "override_frame"));
uiItemR(row, &fileptr, "frame", 0, "Frame", ICON_NONE);
row = uiLayoutRow(layout, false);
uiItemR(row, &fileptr, "frame_offset", 0, "Frame Offset", ICON_NONE);
row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE);

View File

@ -75,9 +75,12 @@ typedef struct CacheFile {
float scale;
float frame; /* The frame/time to lookup in the cache file. */
float frame_offset; /* The frame offset to subtract. */
short flag; /* Animation flag. */
short draw_flag;
char padding[4];
} CacheFile;
#ifdef __cplusplus

View File

@ -147,6 +147,15 @@ static void rna_def_cachefile(BlenderRNA *brna)
" or to determine which file to use in a file sequence");
RNA_def_property_update(prop, 0, "rna_CacheFile_update");
prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "frame_offset");
RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
RNA_def_property_ui_text(prop, "Frame Offset",
"Subtracted from the current frame to use for "
"looking up the data in the cache file, or to "
"determine which file to use in a file sequence");
RNA_def_property_update(prop, 0, "rna_CacheFile_update");
/* ----------------- Axis Conversion ----------------- */
prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);

View File

@ -108,7 +108,6 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte
Scene *scene = md->scene;
const float frame = BKE_scene_frame_get(scene);
const float time = BKE_cachefile_time_offset(mcmd->cache_file, frame, FPS);
const char *err_str = NULL;
CacheFile *cache_file = mcmd->cache_file;