Merge branch 'master' into sculpt-dev
This commit is contained in:
commit
671ef8f0e9
|
@ -453,6 +453,11 @@ class SEQUENCER_MT_select_handle(Menu):
|
|||
layout.operator("sequencer.select_handles", text="Left").side = 'LEFT'
|
||||
layout.operator("sequencer.select_handles", text="Right").side = 'RIGHT'
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("sequencer.select_handles", text="Both Neighbors").side = 'BOTH_NEIGHBORS'
|
||||
layout.operator("sequencer.select_handles", text="Left Neighbor").side = 'LEFT_NEIGHBOR'
|
||||
layout.operator("sequencer.select_handles", text="Right Neighbor").side = 'RIGHT_NEIGHBOR'
|
||||
|
||||
class SEQUENCER_MT_select_channel(Menu):
|
||||
bl_label = "Select Channel"
|
||||
|
@ -1891,8 +1896,6 @@ class SEQUENCER_PT_cache_settings(SequencerButtonsPanel, Panel):
|
|||
col.prop(ed, "use_cache_preprocessed", text="Pre-Processed")
|
||||
col.prop(ed, "use_cache_composite", text="Composite")
|
||||
col.prop(ed, "use_cache_final", text="Final")
|
||||
col.separator()
|
||||
col.prop(ed, "recycle_max_cost")
|
||||
|
||||
|
||||
class SEQUENCER_PT_proxy_settings(SequencerButtonsPanel, Panel):
|
||||
|
|
|
@ -86,26 +86,9 @@ static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *
|
|||
{
|
||||
uiBlock *block = uiLayoutGetBlock(layout);
|
||||
Image *image = image_p;
|
||||
|
||||
int slot_id;
|
||||
|
||||
uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
IFACE_("Slot"),
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X * 5,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
uiItemS(layout);
|
||||
|
||||
slot_id = BLI_listbase_count(&image->renderslots) - 1;
|
||||
for (RenderSlot *slot = image->renderslots.last; slot; slot = slot->prev) {
|
||||
LISTBASE_FOREACH_INDEX (RenderSlot *, slot, &image->renderslots, slot_id) {
|
||||
char str[64];
|
||||
if (slot->name[0] != '\0') {
|
||||
BLI_strncpy(str, slot->name, sizeof(str));
|
||||
|
@ -127,8 +110,23 @@ static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *
|
|||
0,
|
||||
-1,
|
||||
"");
|
||||
slot_id--;
|
||||
}
|
||||
|
||||
uiItemS(layout);
|
||||
uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
IFACE_("Slot"),
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X * 5,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
}
|
||||
|
||||
static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_p)
|
||||
|
@ -175,14 +173,9 @@ static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void
|
|||
Image *image = rnd_data->image;
|
||||
ImageUser *iuser = rnd_data->iuser;
|
||||
Scene *scene = iuser->scene;
|
||||
RenderResult *rr;
|
||||
RenderLayer *rl;
|
||||
RenderLayer rl_fake = {NULL};
|
||||
const char *fake_name;
|
||||
int nr;
|
||||
|
||||
/* may have been freed since drawing */
|
||||
rr = BKE_image_acquire_renderresult(scene, image);
|
||||
/* May have been freed since drawing. */
|
||||
RenderResult *rr = BKE_image_acquire_renderresult(scene, image);
|
||||
if (UNLIKELY(rr == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
@ -190,32 +183,26 @@ static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void
|
|||
UI_block_layout_set_current(block, layout);
|
||||
uiLayoutColumn(layout, false);
|
||||
|
||||
uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
IFACE_("Layer"),
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X * 5,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
uiItemS(layout);
|
||||
|
||||
nr = BLI_listbase_count(&rr->layers) - 1;
|
||||
fake_name = ui_imageuser_layer_fake_name(rr);
|
||||
|
||||
const char *fake_name = ui_imageuser_layer_fake_name(rr);
|
||||
if (fake_name) {
|
||||
BLI_strncpy(rl_fake.name, fake_name, sizeof(rl_fake.name));
|
||||
nr += 1;
|
||||
uiDefButS(block,
|
||||
UI_BTYPE_BUT_MENU,
|
||||
B_NOP,
|
||||
fake_name,
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X * 5,
|
||||
UI_UNIT_X,
|
||||
&iuser->layer,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
-1,
|
||||
"");
|
||||
}
|
||||
|
||||
for (rl = rr->layers.last; rl; rl = rl->prev, nr--) {
|
||||
final:
|
||||
int nr = fake_name ? 1 : 0;
|
||||
for (RenderLayer *rl = rr->layers.first; rl; rl = rl->next, nr++) {
|
||||
uiDefButS(block,
|
||||
UI_BTYPE_BUT_MENU,
|
||||
B_NOP,
|
||||
|
@ -232,13 +219,21 @@ static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void
|
|||
"");
|
||||
}
|
||||
|
||||
if (fake_name) {
|
||||
fake_name = NULL;
|
||||
rl = &rl_fake;
|
||||
goto final;
|
||||
}
|
||||
|
||||
BLI_assert(nr == -1);
|
||||
uiItemS(layout);
|
||||
uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
IFACE_("Layer"),
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X * 5,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
|
||||
BKE_image_release_renderresult(scene, image);
|
||||
}
|
||||
|
@ -268,23 +263,6 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void *
|
|||
UI_block_layout_set_current(block, layout);
|
||||
uiLayoutColumn(layout, false);
|
||||
|
||||
uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
IFACE_("Pass"),
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X * 5,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
nr = (rl == NULL) ? 1 : 0;
|
||||
|
||||
ListBase added_passes;
|
||||
|
@ -315,6 +293,22 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void *
|
|||
"");
|
||||
}
|
||||
|
||||
uiItemS(layout);
|
||||
uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
IFACE_("Pass"),
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X * 5,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
|
||||
BLI_freelistN(&added_passes);
|
||||
|
||||
BKE_image_release_renderresult(scene, image);
|
||||
|
|
|
@ -2111,8 +2111,10 @@ static bool draw_cache_view_init_fn(void *userdata, size_t item_count)
|
|||
}
|
||||
|
||||
/* Called as a callback */
|
||||
static bool draw_cache_view_iter_fn(
|
||||
void *userdata, struct Sequence *seq, int timeline_frame, int cache_type, float UNUSED(cost))
|
||||
static bool draw_cache_view_iter_fn(void *userdata,
|
||||
struct Sequence *seq,
|
||||
int timeline_frame,
|
||||
int cache_type)
|
||||
{
|
||||
CacheDrawData *drawdata = userdata;
|
||||
struct View2D *v2d = drawdata->v2d;
|
||||
|
|
|
@ -902,6 +902,25 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
|
|||
/** \name Select Handles Operator
|
||||
* \{ */
|
||||
|
||||
enum {
|
||||
SEQ_SELECT_HANDLES_SIDE_LEFT,
|
||||
SEQ_SELECT_HANDLES_SIDE_RIGHT,
|
||||
SEQ_SELECT_HANDLES_SIDE_BOTH,
|
||||
SEQ_SELECT_HANDLES_SIDE_LEFT_NEIGHBOR,
|
||||
SEQ_SELECT_HANDLES_SIDE_RIGHT_NEIGHBOR,
|
||||
SEQ_SELECT_HANDLES_SIDE_BOTH_NEIGHBORS,
|
||||
};
|
||||
|
||||
static const EnumPropertyItem prop_select_handles_side_types[] = {
|
||||
{SEQ_SELECT_HANDLES_SIDE_LEFT, "LEFT", 0, "Left", ""},
|
||||
{SEQ_SELECT_HANDLES_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
|
||||
{SEQ_SELECT_HANDLES_SIDE_BOTH, "BOTH", 0, "Both", ""},
|
||||
{SEQ_SELECT_HANDLES_SIDE_LEFT_NEIGHBOR, "LEFT_NEIGHBOR", 0, "Left Neighbor", ""},
|
||||
{SEQ_SELECT_HANDLES_SIDE_RIGHT_NEIGHBOR, "RIGHT_NEIGHBOR", 0, "Right Neighbor", ""},
|
||||
{SEQ_SELECT_HANDLES_SIDE_BOTH_NEIGHBORS, "BOTH_NEIGHBORS", 0, "Both Neighbors", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
@ -911,18 +930,56 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
|
|||
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
if (seq->flag & SELECT) {
|
||||
Sequence *l_neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, -1);
|
||||
Sequence *r_neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, -1);
|
||||
|
||||
switch (sel_side) {
|
||||
case SEQ_SIDE_LEFT:
|
||||
case SEQ_SELECT_HANDLES_SIDE_LEFT:
|
||||
seq->flag &= ~SEQ_RIGHTSEL;
|
||||
seq->flag |= SEQ_LEFTSEL;
|
||||
break;
|
||||
case SEQ_SIDE_RIGHT:
|
||||
case SEQ_SELECT_HANDLES_SIDE_RIGHT:
|
||||
seq->flag &= ~SEQ_LEFTSEL;
|
||||
seq->flag |= SEQ_RIGHTSEL;
|
||||
break;
|
||||
case SEQ_SIDE_BOTH:
|
||||
case SEQ_SELECT_HANDLES_SIDE_BOTH:
|
||||
seq->flag |= SEQ_LEFTSEL | SEQ_RIGHTSEL;
|
||||
break;
|
||||
case SEQ_SELECT_HANDLES_SIDE_LEFT_NEIGHBOR:
|
||||
if (l_neighbor) {
|
||||
if (!(l_neighbor->flag & SELECT)) {
|
||||
l_neighbor->flag |= SEQ_RIGHTSEL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SEQ_SELECT_HANDLES_SIDE_RIGHT_NEIGHBOR:
|
||||
if (r_neighbor) {
|
||||
if (!(r_neighbor->flag & SELECT)) {
|
||||
r_neighbor->flag |= SEQ_LEFTSEL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SEQ_SELECT_HANDLES_SIDE_BOTH_NEIGHBORS:
|
||||
if (l_neighbor) {
|
||||
if (!(l_neighbor->flag & SELECT)) {
|
||||
l_neighbor->flag |= SEQ_RIGHTSEL;
|
||||
}
|
||||
}
|
||||
if (r_neighbor) {
|
||||
if (!(r_neighbor->flag & SELECT)) {
|
||||
r_neighbor->flag |= SEQ_LEFTSEL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Select strips */
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
if ((seq->flag & SEQ_LEFTSEL) || (seq->flag & SEQ_RIGHTSEL)) {
|
||||
if (!(seq->flag & SELECT)) {
|
||||
seq->flag |= SELECT;
|
||||
recurs_sel_seq(seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -951,8 +1008,8 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot)
|
|||
/* Properties. */
|
||||
RNA_def_enum(ot->srna,
|
||||
"side",
|
||||
prop_side_types,
|
||||
SEQ_SIDE_BOTH,
|
||||
prop_select_handles_side_types,
|
||||
SEQ_SELECT_HANDLES_SIDE_BOTH,
|
||||
"Side",
|
||||
"The side of the handle that is selected");
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ typedef struct Editing {
|
|||
struct SeqCache *cache;
|
||||
|
||||
/* Cache control */
|
||||
float recycle_max_cost;
|
||||
float recycle_max_cost; /* UNUSED only for versioning. */
|
||||
int cache_flag;
|
||||
|
||||
struct PrefetchJob *prefetch_job;
|
||||
|
|
|
@ -2101,13 +2101,6 @@ static void rna_def_editor(BlenderRNA *brna)
|
|||
"Prefetch Frames",
|
||||
"Render frames ahead of current frame in the background for faster playback");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "recycle_max_cost", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, SEQ_CACHE_COST_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.0f, SEQ_CACHE_COST_MAX, 0.1f, 1);
|
||||
RNA_def_property_float_sdna(prop, NULL, "recycle_max_cost");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Recycle Up to Cost", "Only frames with cost lower than this value will be recycled");
|
||||
}
|
||||
|
||||
static void rna_def_filter_video(StructRNA *srna)
|
||||
|
|
|
@ -60,14 +60,11 @@ void SEQ_relations_check_uuids_unique_and_report(const struct Scene *scene);
|
|||
void SEQ_relations_session_uuid_generate(struct Sequence *sequence);
|
||||
|
||||
void SEQ_cache_cleanup(struct Scene *scene);
|
||||
void SEQ_cache_iterate(struct Scene *scene,
|
||||
void *userdata,
|
||||
bool callback_init(void *userdata, size_t item_count),
|
||||
bool callback_iter(void *userdata,
|
||||
struct Sequence *seq,
|
||||
int timeline_frame,
|
||||
int cache_type,
|
||||
float cost));
|
||||
void SEQ_cache_iterate(
|
||||
struct Scene *scene,
|
||||
void *userdata,
|
||||
bool callback_init(void *userdata, size_t item_count),
|
||||
bool callback_iter(void *userdata, struct Sequence *seq, int timeline_frame, int cache_type));
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -147,7 +147,6 @@ typedef struct SeqCache {
|
|||
struct BLI_mempool *keys_pool;
|
||||
struct BLI_mempool *items_pool;
|
||||
struct SeqCacheKey *last_key;
|
||||
size_t memory_used;
|
||||
SeqDiskCache *disk_cache;
|
||||
} SeqCache;
|
||||
|
||||
|
@ -796,10 +795,8 @@ static void seq_cache_keyfree(void *val)
|
|||
static void seq_cache_valfree(void *val)
|
||||
{
|
||||
SeqCacheItem *item = (SeqCacheItem *)val;
|
||||
SeqCache *cache = item->cache_owner;
|
||||
|
||||
if (item->ibuf) {
|
||||
cache->memory_used -= IMB_get_size_in_memory(item->ibuf);
|
||||
IMB_freeImBuf(item->ibuf);
|
||||
}
|
||||
|
||||
|
@ -816,7 +813,6 @@ static void seq_cache_put_ex(SeqCache *cache, SeqCacheKey *key, ImBuf *ibuf)
|
|||
if (BLI_ghash_reinsert(cache->hash, key, item, seq_cache_keyfree, seq_cache_valfree)) {
|
||||
IMB_refImBuf(ibuf);
|
||||
cache->last_key = key;
|
||||
cache->memory_used += IMB_get_size_in_memory(ibuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -942,7 +938,6 @@ static SeqCacheKey *seq_cache_get_item_for_removal(Scene *scene)
|
|||
GHashIterator gh_iter;
|
||||
BLI_ghashIterator_init(&gh_iter, cache->hash);
|
||||
int total_count = 0;
|
||||
int cheap_count = 0;
|
||||
|
||||
while (!BLI_ghashIterator_done(&gh_iter)) {
|
||||
key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
|
@ -963,25 +958,22 @@ static SeqCacheKey *seq_cache_get_item_for_removal(Scene *scene)
|
|||
|
||||
total_count++;
|
||||
|
||||
if (key->cost <= scene->ed->recycle_max_cost) {
|
||||
cheap_count++;
|
||||
if (lkey) {
|
||||
if (key->timeline_frame < lkey->timeline_frame) {
|
||||
lkey = key;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (lkey) {
|
||||
if (key->timeline_frame < lkey->timeline_frame) {
|
||||
lkey = key;
|
||||
}
|
||||
if (rkey) {
|
||||
if (key->timeline_frame > rkey->timeline_frame) {
|
||||
rkey = key;
|
||||
}
|
||||
}
|
||||
else {
|
||||
}
|
||||
else {
|
||||
lkey = key;
|
||||
}
|
||||
if (rkey) {
|
||||
if (key->timeline_frame > rkey->timeline_frame) {
|
||||
rkey = key;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rkey = key;
|
||||
}
|
||||
}
|
||||
|
||||
finalkey = seq_cache_choose_key(scene, lkey, rkey);
|
||||
|
@ -994,7 +986,6 @@ static SeqCacheKey *seq_cache_get_item_for_removal(Scene *scene)
|
|||
*/
|
||||
bool seq_cache_recycle_item(Scene *scene)
|
||||
{
|
||||
size_t memory_total = seq_cache_get_mem_total();
|
||||
SeqCache *cache = seq_cache_get_from_scene(scene);
|
||||
if (!cache) {
|
||||
return false;
|
||||
|
@ -1002,7 +993,7 @@ bool seq_cache_recycle_item(Scene *scene)
|
|||
|
||||
seq_cache_lock(scene);
|
||||
|
||||
while (cache->memory_used > memory_total) {
|
||||
while (seq_cache_is_full()) {
|
||||
SeqCacheKey *finalkey = seq_cache_get_item_for_removal(scene);
|
||||
|
||||
if (finalkey) {
|
||||
|
@ -1286,10 +1277,10 @@ struct ImBuf *seq_cache_get(const SeqRenderData *context,
|
|||
BLI_mutex_unlock(&cache->disk_cache->read_write_mutex);
|
||||
if (ibuf) {
|
||||
if (key.type == SEQ_CACHE_STORE_FINAL_OUT) {
|
||||
seq_cache_put_if_possible(context, seq, timeline_frame, type, ibuf, 0.0f, true);
|
||||
seq_cache_put_if_possible(context, seq, timeline_frame, type, ibuf, true);
|
||||
}
|
||||
else {
|
||||
seq_cache_put(context, seq, timeline_frame, type, ibuf, 0.0f, true);
|
||||
seq_cache_put(context, seq, timeline_frame, type, ibuf, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1302,7 +1293,6 @@ bool seq_cache_put_if_possible(const SeqRenderData *context,
|
|||
float timeline_frame,
|
||||
int type,
|
||||
ImBuf *ibuf,
|
||||
float cost,
|
||||
bool skip_disk_cache)
|
||||
{
|
||||
Scene *scene = context->scene;
|
||||
|
@ -1318,7 +1308,7 @@ bool seq_cache_put_if_possible(const SeqRenderData *context,
|
|||
}
|
||||
|
||||
if (seq_cache_recycle_item(scene)) {
|
||||
seq_cache_put(context, seq, timeline_frame, type, ibuf, cost, skip_disk_cache);
|
||||
seq_cache_put(context, seq, timeline_frame, type, ibuf, skip_disk_cache);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1332,7 +1322,6 @@ void seq_cache_put(const SeqRenderData *context,
|
|||
float timeline_frame,
|
||||
int type,
|
||||
ImBuf *i,
|
||||
float cost,
|
||||
bool skip_disk_cache)
|
||||
{
|
||||
if (i == NULL || context->skip_cache || context->is_proxy_render || !seq) {
|
||||
|
@ -1375,10 +1364,6 @@ void seq_cache_put(const SeqRenderData *context,
|
|||
flag = scene->ed->cache_flag;
|
||||
}
|
||||
|
||||
if (cost > SEQ_CACHE_COST_MAX) {
|
||||
cost = SEQ_CACHE_COST_MAX;
|
||||
}
|
||||
|
||||
SeqCacheKey *key;
|
||||
key = BLI_mempool_alloc(cache->keys_pool);
|
||||
key->cache_owner = cache;
|
||||
|
@ -1387,7 +1372,6 @@ void seq_cache_put(const SeqRenderData *context,
|
|||
key->frame_index = seq_cache_timeline_frame_to_frame_index(seq, timeline_frame, type);
|
||||
key->timeline_frame = timeline_frame;
|
||||
key->type = type;
|
||||
key->cost = cost;
|
||||
key->link_prev = NULL;
|
||||
key->link_next = NULL;
|
||||
key->is_temp_cache = true;
|
||||
|
@ -1435,14 +1419,11 @@ void seq_cache_put(const SeqRenderData *context,
|
|||
}
|
||||
}
|
||||
|
||||
void SEQ_cache_iterate(struct Scene *scene,
|
||||
void *userdata,
|
||||
bool callback_init(void *userdata, size_t item_count),
|
||||
bool callback_iter(void *userdata,
|
||||
struct Sequence *seq,
|
||||
int timeline_frame,
|
||||
int cache_type,
|
||||
float cost))
|
||||
void SEQ_cache_iterate(
|
||||
struct Scene *scene,
|
||||
void *userdata,
|
||||
bool callback_init(void *userdata, size_t item_count),
|
||||
bool callback_iter(void *userdata, struct Sequence *seq, int timeline_frame, int cache_type))
|
||||
{
|
||||
SeqCache *cache = seq_cache_get_from_scene(scene);
|
||||
if (!cache) {
|
||||
|
@ -1459,20 +1440,14 @@ void SEQ_cache_iterate(struct Scene *scene,
|
|||
SeqCacheKey *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
BLI_ghashIterator_step(&gh_iter);
|
||||
|
||||
interrupt = callback_iter(userdata, key->seq, key->timeline_frame, key->type, key->cost);
|
||||
interrupt = callback_iter(userdata, key->seq, key->timeline_frame, key->type);
|
||||
}
|
||||
|
||||
cache->last_key = NULL;
|
||||
seq_cache_unlock(scene);
|
||||
}
|
||||
|
||||
bool seq_cache_is_full(Scene *scene)
|
||||
bool seq_cache_is_full(void)
|
||||
{
|
||||
size_t memory_total = seq_cache_get_mem_total();
|
||||
SeqCache *cache = seq_cache_get_from_scene(scene);
|
||||
if (!cache) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return memory_total < cache->memory_used;
|
||||
return seq_cache_get_mem_total() < MEM_get_memory_in_use();
|
||||
}
|
||||
|
|
|
@ -47,14 +47,12 @@ void seq_cache_put(const struct SeqRenderData *context,
|
|||
float timeline_frame,
|
||||
int type,
|
||||
struct ImBuf *i,
|
||||
float cost,
|
||||
bool skip_disk_cache);
|
||||
bool seq_cache_put_if_possible(const struct SeqRenderData *context,
|
||||
struct Sequence *seq,
|
||||
float timeline_frame,
|
||||
int type,
|
||||
struct ImBuf *nval,
|
||||
float cost,
|
||||
bool skip_disk_cache);
|
||||
bool seq_cache_recycle_item(struct Scene *scene);
|
||||
void seq_cache_free_temp_cache(struct Scene *scene, short id, int timeline_frame);
|
||||
|
@ -65,7 +63,7 @@ void seq_cache_cleanup_sequence(struct Scene *scene,
|
|||
struct Sequence *seq_changed,
|
||||
int invalidate_types,
|
||||
bool force_seq_changed_range);
|
||||
bool seq_cache_is_full(struct Scene *scene);
|
||||
bool seq_cache_is_full(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ static bool seq_prefetch_is_cache_full(Scene *scene)
|
|||
{
|
||||
PrefetchJob *pfjob = seq_prefetch_job_get(scene);
|
||||
|
||||
if (!seq_cache_is_full(pfjob->scene)) {
|
||||
if (!seq_cache_is_full()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ static PrefetchJob *seq_prefetch_start_ex(const SeqRenderData *context, float cf
|
|||
}
|
||||
|
||||
/* Start or resume prefetching*/
|
||||
void seq_prefetch_start(const SeqRenderData *context, float timeline_frame, float cost)
|
||||
void seq_prefetch_start(const SeqRenderData *context, float timeline_frame)
|
||||
{
|
||||
Scene *scene = context->scene;
|
||||
Editing *ed = scene->ed;
|
||||
|
@ -540,13 +540,12 @@ void seq_prefetch_start(const SeqRenderData *context, float timeline_frame, floa
|
|||
bool running = seq_prefetch_job_is_running(scene);
|
||||
seq_prefetch_resume(scene);
|
||||
/* conditions to start:
|
||||
* prefetch enabled, prefetch not running, not scrubbing,
|
||||
* not playing and rendering-expensive footage, cache storage enabled, has strips to render,
|
||||
* not rendering, not doing modal transform - important, see D7820.
|
||||
* prefetch enabled, prefetch not running, not scrubbing, not playing,
|
||||
* cache storage enabled, has strips to render, not rendering, not doing modal transform -
|
||||
* important, see D7820.
|
||||
*/
|
||||
if ((ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) && !running && !scrubbing &&
|
||||
!(playing && cost > 0.9) && ed->cache_flag & SEQ_CACHE_ALL_TYPES && has_strips &&
|
||||
!G.is_rendering && !G.moving) {
|
||||
if ((ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) && !running && !scrubbing && !playing &&
|
||||
ed->cache_flag & SEQ_CACHE_ALL_TYPES && has_strips && !G.is_rendering && !G.moving) {
|
||||
|
||||
seq_prefetch_start_ex(context, timeline_frame);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ struct Sequence;
|
|||
}
|
||||
#endif
|
||||
|
||||
void seq_prefetch_start(const struct SeqRenderData *context, float timeline_frame, float cost);
|
||||
void seq_prefetch_start(const struct SeqRenderData *context, float timeline_frame);
|
||||
void seq_prefetch_free(struct Scene *scene);
|
||||
bool seq_prefetch_job_is_running(struct Scene *scene);
|
||||
void seq_prefetch_get_time_range(struct Scene *scene, int *start, int *end);
|
||||
|
|
|
@ -403,24 +403,6 @@ int seq_get_shown_sequences(ListBase *seqbasep,
|
|||
return cnt;
|
||||
}
|
||||
|
||||
/* Estimate time spent by the program rendering the strip */
|
||||
static clock_t seq_estimate_render_cost_begin(void)
|
||||
{
|
||||
return clock();
|
||||
}
|
||||
|
||||
static float seq_estimate_render_cost_end(Scene *scene, clock_t begin)
|
||||
{
|
||||
clock_t end = clock();
|
||||
float time_spent = (float)(end - begin);
|
||||
float time_max = (1.0f / scene->r.frs_sec) * CLOCKS_PER_SEC;
|
||||
|
||||
if (time_max != 0) {
|
||||
return time_spent / time_max;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -738,7 +720,6 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context,
|
|||
Sequence *seq,
|
||||
ImBuf *ibuf,
|
||||
float timeline_frame,
|
||||
clock_t begin,
|
||||
bool use_preprocess,
|
||||
const bool is_proxy_image)
|
||||
{
|
||||
|
@ -748,20 +729,15 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context,
|
|||
}
|
||||
|
||||
if (use_preprocess) {
|
||||
float cost = seq_estimate_render_cost_end(context->scene, begin);
|
||||
|
||||
/* Proxies are not stored in cache. */
|
||||
if (!is_proxy_image) {
|
||||
seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf, cost, false);
|
||||
seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf, false);
|
||||
}
|
||||
|
||||
/* Reset timer so we can get partial render time. */
|
||||
begin = seq_estimate_render_cost_begin();
|
||||
ibuf = input_preprocess(context, seq, timeline_frame, ibuf);
|
||||
}
|
||||
|
||||
float cost = seq_estimate_render_cost_end(context->scene, begin);
|
||||
seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf, cost, false);
|
||||
seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf, false);
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
|
@ -1073,7 +1049,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context,
|
|||
|
||||
if (view_id != context->view_id) {
|
||||
ibufs_arr[view_id] = seq_render_preprocess_ibuf(
|
||||
&localcontext, seq, ibufs_arr[view_id], timeline_frame, clock(), true, false);
|
||||
&localcontext, seq, ibufs_arr[view_id], timeline_frame, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1223,7 +1199,7 @@ static ImBuf *seq_render_movie_strip(const SeqRenderData *context,
|
|||
|
||||
if (view_id != context->view_id) {
|
||||
ibuf_arr[view_id] = seq_render_preprocess_ibuf(
|
||||
&localcontext, seq, ibuf_arr[view_id], timeline_frame, clock(), true, false);
|
||||
&localcontext, seq, ibuf_arr[view_id], timeline_frame, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1630,7 +1606,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context,
|
|||
|
||||
if (view_id != context->view_id) {
|
||||
seq_cache_put(
|
||||
&localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], 0, false);
|
||||
&localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], false);
|
||||
}
|
||||
|
||||
RE_ReleaseResultImage(re);
|
||||
|
@ -1805,8 +1781,6 @@ ImBuf *seq_render_strip(const SeqRenderData *context,
|
|||
bool use_preprocess = false;
|
||||
bool is_proxy_image = false;
|
||||
|
||||
clock_t begin = seq_estimate_render_cost_begin();
|
||||
|
||||
ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, false);
|
||||
if (ibuf != NULL) {
|
||||
return ibuf;
|
||||
|
@ -1824,7 +1798,7 @@ ImBuf *seq_render_strip(const SeqRenderData *context,
|
|||
if (ibuf) {
|
||||
use_preprocess = seq_input_have_to_preprocess(context, seq, timeline_frame);
|
||||
ibuf = seq_render_preprocess_ibuf(
|
||||
context, seq, ibuf, timeline_frame, begin, use_preprocess, is_proxy_image);
|
||||
context, seq, ibuf, timeline_frame, use_preprocess, is_proxy_image);
|
||||
}
|
||||
|
||||
if (ibuf == NULL) {
|
||||
|
@ -1910,7 +1884,6 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context,
|
|||
int count;
|
||||
int i;
|
||||
ImBuf *out = NULL;
|
||||
clock_t begin;
|
||||
|
||||
count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr);
|
||||
|
||||
|
@ -1946,16 +1919,13 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context,
|
|||
break;
|
||||
case EARLY_DO_EFFECT:
|
||||
if (i == 0) {
|
||||
begin = seq_estimate_render_cost_begin();
|
||||
|
||||
ImBuf *ibuf1 = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
|
||||
ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame);
|
||||
|
||||
out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2);
|
||||
|
||||
float cost = seq_estimate_render_cost_end(context->scene, begin);
|
||||
seq_cache_put(
|
||||
context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, cost, false);
|
||||
context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, false);
|
||||
|
||||
IMB_freeImBuf(ibuf1);
|
||||
IMB_freeImBuf(ibuf2);
|
||||
|
@ -1969,7 +1939,6 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context,
|
|||
|
||||
i++;
|
||||
for (; i < count; i++) {
|
||||
begin = seq_estimate_render_cost_begin();
|
||||
Sequence *seq = seq_arr[i];
|
||||
|
||||
if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) {
|
||||
|
@ -1982,9 +1951,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context,
|
|||
IMB_freeImBuf(ibuf2);
|
||||
}
|
||||
|
||||
float cost = seq_estimate_render_cost_end(context->scene, begin);
|
||||
seq_cache_put(
|
||||
context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, cost, false);
|
||||
seq_cache_put(context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, false);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
@ -2029,36 +1996,22 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame,
|
|||
|
||||
seq_cache_free_temp_cache(context->scene, context->task_id, timeline_frame);
|
||||
|
||||
clock_t begin = seq_estimate_render_cost_begin();
|
||||
float cost = 0;
|
||||
|
||||
if (count && !out) {
|
||||
BLI_mutex_lock(&seq_render_mutex);
|
||||
out = seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chanshown);
|
||||
cost = seq_estimate_render_cost_end(context->scene, begin);
|
||||
|
||||
if (context->is_prefetch_render) {
|
||||
seq_cache_put(context,
|
||||
seq_arr[count - 1],
|
||||
timeline_frame,
|
||||
SEQ_CACHE_STORE_FINAL_OUT,
|
||||
out,
|
||||
cost,
|
||||
false);
|
||||
seq_cache_put(
|
||||
context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out, false);
|
||||
}
|
||||
else {
|
||||
seq_cache_put_if_possible(context,
|
||||
seq_arr[count - 1],
|
||||
timeline_frame,
|
||||
SEQ_CACHE_STORE_FINAL_OUT,
|
||||
out,
|
||||
cost,
|
||||
false);
|
||||
seq_cache_put_if_possible(
|
||||
context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out, false);
|
||||
}
|
||||
BLI_mutex_unlock(&seq_render_mutex);
|
||||
}
|
||||
|
||||
seq_prefetch_start(context, timeline_frame, cost);
|
||||
seq_prefetch_start(context, timeline_frame);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -249,7 +249,6 @@ Editing *SEQ_editing_ensure(Scene *scene)
|
|||
ed->cache_flag = SEQ_CACHE_STORE_FINAL_OUT;
|
||||
ed->cache_flag |= SEQ_CACHE_VIEW_FINAL_OUT;
|
||||
ed->cache_flag |= SEQ_CACHE_VIEW_ENABLE;
|
||||
ed->recycle_max_cost = 10.0f;
|
||||
}
|
||||
|
||||
return scene->ed;
|
||||
|
|
Loading…
Reference in New Issue