diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/editors/space_sequencer/sequencer_modifier.c | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_modifier.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_modifier.c | 360 |
1 files changed, 182 insertions, 178 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c index 41ca52e0431..e00d33853a3 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.c +++ b/source/blender/editors/space_sequencer/sequencer_modifier.c @@ -17,12 +17,10 @@ * All rights reserved. */ - /** \file * \ingroup spseq */ - #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -37,7 +35,6 @@ #include "RNA_define.h" #include "RNA_enum_types.h" - /* own include */ #include "sequencer_intern.h" @@ -45,237 +42,244 @@ static bool strip_modifier_active_poll(bContext *C) { - Scene *scene = CTX_data_scene(C); - Editing *ed = BKE_sequencer_editing_get(scene, false); + Scene *scene = CTX_data_scene(C); + Editing *ed = BKE_sequencer_editing_get(scene, false); - if (ed) { - Sequence *seq = BKE_sequencer_active_get(scene); + if (ed) { + Sequence *seq = BKE_sequencer_active_get(scene); - if (seq) { - return BKE_sequence_supports_modifiers(seq); - } - } + if (seq) { + return BKE_sequence_supports_modifiers(seq); + } + } - return false; + return false; } static int strip_modifier_add_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); - Sequence *seq = BKE_sequencer_active_get(scene); - int type = RNA_enum_get(op->ptr, "type"); + Scene *scene = CTX_data_scene(C); + Sequence *seq = BKE_sequencer_active_get(scene); + int type = RNA_enum_get(op->ptr, "type"); - BKE_sequence_modifier_new(seq, NULL, type); + BKE_sequence_modifier_new(seq, NULL, type); - BKE_sequence_invalidate_cache(scene, seq); - WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + BKE_sequence_invalidate_cache(scene, seq); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot) { - PropertyRNA *prop; - - /* identifiers */ - ot->name = "Add Strip Modifier"; - ot->idname = "SEQUENCER_OT_strip_modifier_add"; - ot->description = "Add a modifier to the strip"; - - /* api callbacks */ - ot->exec = strip_modifier_add_exec; - ot->poll = strip_modifier_active_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ - prop = RNA_def_enum(ot->srna, "type", rna_enum_sequence_modifier_type_items, seqModifierType_ColorBalance, "Type", ""); - ot->prop = prop; + PropertyRNA *prop; + + /* identifiers */ + ot->name = "Add Strip Modifier"; + ot->idname = "SEQUENCER_OT_strip_modifier_add"; + ot->description = "Add a modifier to the strip"; + + /* api callbacks */ + ot->exec = strip_modifier_add_exec; + ot->poll = strip_modifier_active_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + prop = RNA_def_enum(ot->srna, + "type", + rna_enum_sequence_modifier_type_items, + seqModifierType_ColorBalance, + "Type", + ""); + ot->prop = prop; } /*********************** Remove modifier operator *************************/ static int strip_modifier_remove_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); - Sequence *seq = BKE_sequencer_active_get(scene); - char name[MAX_NAME]; - SequenceModifierData *smd; + Scene *scene = CTX_data_scene(C); + Sequence *seq = BKE_sequencer_active_get(scene); + char name[MAX_NAME]; + SequenceModifierData *smd; - RNA_string_get(op->ptr, "name", name); + RNA_string_get(op->ptr, "name", name); - smd = BKE_sequence_modifier_find_by_name(seq, name); - if (!smd) { - return OPERATOR_CANCELLED; - } + smd = BKE_sequence_modifier_find_by_name(seq, name); + if (!smd) { + return OPERATOR_CANCELLED; + } - BLI_remlink(&seq->modifiers, smd); - BKE_sequence_modifier_free(smd); + BLI_remlink(&seq->modifiers, smd); + BKE_sequence_modifier_free(smd); - BKE_sequence_invalidate_cache(scene, seq); - WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + BKE_sequence_invalidate_cache(scene, seq); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot) { - /* identifiers */ - ot->name = "Remove Strip Modifier"; - ot->idname = "SEQUENCER_OT_strip_modifier_remove"; - ot->description = "Remove a modifier from the strip"; + /* identifiers */ + ot->name = "Remove Strip Modifier"; + ot->idname = "SEQUENCER_OT_strip_modifier_remove"; + ot->description = "Remove a modifier from the strip"; - /* api callbacks */ - ot->exec = strip_modifier_remove_exec; - ot->poll = strip_modifier_active_poll; + /* api callbacks */ + ot->exec = strip_modifier_remove_exec; + ot->poll = strip_modifier_active_poll; - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* properties */ - RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove"); + /* properties */ + RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove"); } /*********************** Move operator *************************/ enum { - SEQ_MODIFIER_MOVE_UP = 0, - SEQ_MODIFIER_MOVE_DOWN, + SEQ_MODIFIER_MOVE_UP = 0, + SEQ_MODIFIER_MOVE_DOWN, }; static int strip_modifier_move_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); - Sequence *seq = BKE_sequencer_active_get(scene); - char name[MAX_NAME]; - int direction; - SequenceModifierData *smd; - - RNA_string_get(op->ptr, "name", name); - direction = RNA_enum_get(op->ptr, "direction"); - - smd = BKE_sequence_modifier_find_by_name(seq, name); - if (!smd) { - return OPERATOR_CANCELLED; - } - - if (direction == SEQ_MODIFIER_MOVE_UP) { - if (smd->prev) { - BLI_remlink(&seq->modifiers, smd); - BLI_insertlinkbefore(&seq->modifiers, smd->prev, smd); - } - } - else if (direction == SEQ_MODIFIER_MOVE_DOWN) { - if (smd->next) { - BLI_remlink(&seq->modifiers, smd); - BLI_insertlinkafter(&seq->modifiers, smd->next, smd); - } - } - - BKE_sequence_invalidate_cache(scene, seq); - WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); - - return OPERATOR_FINISHED; + Scene *scene = CTX_data_scene(C); + Sequence *seq = BKE_sequencer_active_get(scene); + char name[MAX_NAME]; + int direction; + SequenceModifierData *smd; + + RNA_string_get(op->ptr, "name", name); + direction = RNA_enum_get(op->ptr, "direction"); + + smd = BKE_sequence_modifier_find_by_name(seq, name); + if (!smd) { + return OPERATOR_CANCELLED; + } + + if (direction == SEQ_MODIFIER_MOVE_UP) { + if (smd->prev) { + BLI_remlink(&seq->modifiers, smd); + BLI_insertlinkbefore(&seq->modifiers, smd->prev, smd); + } + } + else if (direction == SEQ_MODIFIER_MOVE_DOWN) { + if (smd->next) { + BLI_remlink(&seq->modifiers, smd); + BLI_insertlinkafter(&seq->modifiers, smd->next, smd); + } + } + + BKE_sequence_invalidate_cache(scene, seq); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; } void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot) { - static const EnumPropertyItem direction_items[] = { - {SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"}, - {SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"}, - {0, NULL, 0, NULL, NULL}, - }; - - /* identifiers */ - ot->name = "Move Strip Modifier"; - ot->idname = "SEQUENCER_OT_strip_modifier_move"; - ot->description = "Move modifier up and down in the stack"; - - /* api callbacks */ - ot->exec = strip_modifier_move_exec; - ot->poll = strip_modifier_active_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ - RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove"); - RNA_def_enum(ot->srna, "direction", direction_items, SEQ_MODIFIER_MOVE_UP, "Type", ""); + static const EnumPropertyItem direction_items[] = { + {SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"}, + {SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"}, + {0, NULL, 0, NULL, NULL}, + }; + + /* identifiers */ + ot->name = "Move Strip Modifier"; + ot->idname = "SEQUENCER_OT_strip_modifier_move"; + ot->description = "Move modifier up and down in the stack"; + + /* api callbacks */ + ot->exec = strip_modifier_move_exec; + ot->poll = strip_modifier_active_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove"); + RNA_def_enum(ot->srna, "direction", direction_items, SEQ_MODIFIER_MOVE_UP, "Type", ""); } /*********************** Copy to selected operator *************************/ enum { - SEQ_MODIFIER_COPY_REPLACE = 0, - SEQ_MODIFIER_COPY_APPEND = 1, + SEQ_MODIFIER_COPY_REPLACE = 0, + SEQ_MODIFIER_COPY_APPEND = 1, }; static int strip_modifier_copy_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); - Editing *ed = scene->ed; - Sequence *seq = BKE_sequencer_active_get(scene); - Sequence *seq_iter; - const int type = RNA_enum_get(op->ptr, "type"); - - if (!seq || !seq->modifiers.first) { - return OPERATOR_CANCELLED; - } - - SEQP_BEGIN(ed, seq_iter) - { - if (seq_iter->flag & SELECT) { - if (seq_iter == seq) { - continue; - } - - if (type == SEQ_MODIFIER_COPY_REPLACE) { - if (seq_iter->modifiers.first) { - SequenceModifierData *smd_tmp, *smd = seq_iter->modifiers.first; - while (smd) { - smd_tmp = smd->next; - BLI_remlink(&seq_iter->modifiers, smd); - BKE_sequence_modifier_free(smd); - smd = smd_tmp; - } - BLI_listbase_clear(&seq_iter->modifiers); - } - } - - BKE_sequence_modifier_list_copy(seq_iter, seq); - } - } SEQ_END; - - BKE_sequence_invalidate_cache(scene, seq); - WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); - - return OPERATOR_FINISHED; + Scene *scene = CTX_data_scene(C); + Editing *ed = scene->ed; + Sequence *seq = BKE_sequencer_active_get(scene); + Sequence *seq_iter; + const int type = RNA_enum_get(op->ptr, "type"); + + if (!seq || !seq->modifiers.first) { + return OPERATOR_CANCELLED; + } + + SEQP_BEGIN (ed, seq_iter) { + if (seq_iter->flag & SELECT) { + if (seq_iter == seq) { + continue; + } + + if (type == SEQ_MODIFIER_COPY_REPLACE) { + if (seq_iter->modifiers.first) { + SequenceModifierData *smd_tmp, *smd = seq_iter->modifiers.first; + while (smd) { + smd_tmp = smd->next; + BLI_remlink(&seq_iter->modifiers, smd); + BKE_sequence_modifier_free(smd); + smd = smd_tmp; + } + BLI_listbase_clear(&seq_iter->modifiers); + } + } + + BKE_sequence_modifier_list_copy(seq_iter, seq); + } + } + SEQ_END; + + BKE_sequence_invalidate_cache(scene, seq); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; } void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot) { - static const EnumPropertyItem type_items[] = { - {SEQ_MODIFIER_COPY_REPLACE, "REPLACE", 0, "Replace", - "Replace modifiers in destination"}, - {SEQ_MODIFIER_COPY_APPEND, "APPEND", 0, "Append", - "Append active modifiers to selected strips"}, - {0, NULL, 0, NULL, NULL}, - }; - - /* identifiers */ - ot->name = "Copy to Selected Strips"; - ot->idname = "SEQUENCER_OT_strip_modifier_copy"; - ot->description = "Copy modifiers of the active strip to all selected strips"; - - /* api callbacks */ - ot->invoke = WM_menu_invoke; - ot->exec = strip_modifier_copy_exec; - ot->poll = strip_modifier_active_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ - ot->prop = RNA_def_enum(ot->srna, "type", type_items, SEQ_MODIFIER_COPY_REPLACE, "Type", ""); + static const EnumPropertyItem type_items[] = { + {SEQ_MODIFIER_COPY_REPLACE, "REPLACE", 0, "Replace", "Replace modifiers in destination"}, + {SEQ_MODIFIER_COPY_APPEND, + "APPEND", + 0, + "Append", + "Append active modifiers to selected strips"}, + {0, NULL, 0, NULL, NULL}, + }; + + /* identifiers */ + ot->name = "Copy to Selected Strips"; + ot->idname = "SEQUENCER_OT_strip_modifier_copy"; + ot->description = "Copy modifiers of the active strip to all selected strips"; + + /* api callbacks */ + ot->invoke = WM_menu_invoke; + ot->exec = strip_modifier_copy_exec; + ot->poll = strip_modifier_active_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + ot->prop = RNA_def_enum(ot->srna, "type", type_items, SEQ_MODIFIER_COPY_REPLACE, "Type", ""); } |