Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_sequencer/sequencer_edit.c
| Context not available. | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static bool sequencer_rebuild_proxy_poll(bContext *C) | |||||
ISS: Both poll functions are identical.
Use one function for both operators, I would name it… | |||||
| { | |||||
Not Done Inline ActionsPoll functions should never perform searches on all selected items. Just use the active as is done elsewhere. campbellbarton: Poll functions should never perform searches on all selected items. Just use the active as is… | |||||
Not Done Inline ActionsBut the operator is applied to all selected items, not just the active one. Is there a faster way to iterate over selected items ? mathers: But the operator is applied to all selected items, not just the active one. Is there a faster… | |||||
Not Done Inline ActionsI would understand concern of accessing selection from python as a python object, as it has to be built. Most users will hit a and rebuild proxies button, but they can't because it's not visible. Sorry, I really can not help myself here... Can we have managed list of selected sequences, that will be updated when user updates the selection so we don't have to iterate over all elements? Will this be OK then? ISS: I would understand concern of accessing selection from python as a python object, as it has to… | |||||
| Scene *scene = CTX_data_scene(C); | |||||
| Editing *ed = BKE_sequencer_editing_get(scene, false); | |||||
| Sequence *seq; | |||||
| if (ed) { | |||||
| SEQP_BEGIN(ed, seq) | |||||
| { | |||||
| if ((seq->flag & SELECT)) { | |||||
| if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_META)) { | |||||
| return 1; | |||||
| } | |||||
| } | |||||
| } SEQ_END; | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot) | void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| Context not available. | |||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->invoke = sequencer_rebuild_proxy_invoke; | ot->invoke = sequencer_rebuild_proxy_invoke; | ||||
| ot->exec = sequencer_rebuild_proxy_exec; | ot->exec = sequencer_rebuild_proxy_exec; | ||||
| ot->poll = sequencer_rebuild_proxy_poll; | |||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER; | ot->flag = OPTYPE_REGISTER; | ||||
| Context not available. | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static bool sequencer_enable_proxies_poll(bContext *C) | |||||
| { | |||||
| Scene *scene = CTX_data_scene(C); | |||||
| Editing *ed = BKE_sequencer_editing_get(scene, false); | |||||
| Sequence *seq; | |||||
| if (ed) { | |||||
| SEQP_BEGIN(ed, seq) | |||||
| { | |||||
| if ((seq->flag & SELECT)) { | |||||
| if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_META)) { | |||||
| return 1; | |||||
| } | |||||
| } | |||||
| } SEQ_END; | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| void SEQUENCER_OT_enable_proxies(wmOperatorType *ot) | void SEQUENCER_OT_enable_proxies(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Set Selected Strip Proxies"; | ot->name = "Set Selected Strip Proxies"; | ||||
| ot->idname = "SEQUENCER_OT_enable_proxies"; | ot->idname = "SEQUENCER_OT_enable_proxies"; | ||||
| ot->description = "Enable selected proxies on all selected Movie strips"; | ot->description = "Enable selected proxies on all selected Movie, Image and Meta strips"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->invoke = sequencer_enable_proxies_invoke; | ot->invoke = sequencer_enable_proxies_invoke; | ||||
| ot->exec = sequencer_enable_proxies_exec; | ot->exec = sequencer_enable_proxies_exec; | ||||
| ot->poll = sequencer_enable_proxies_poll; | |||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER; | ot->flag = OPTYPE_REGISTER; | ||||
| Context not available. | |||||
Both poll functions are identical.
Use one function for both operators, I would name it sequencer_selection_proxy_supported_poll