Fix T79872: VSE - splitting strip shows the channel number when unused

This operator is dependent on mouse position (if the Use Cursor Position
option is used). The Channel property is irrelevant/unused in this case.
So it is not optimal displaying this property when calling this from the
menu (or even using the shortcut with default settings).

Now use a custom UI in the Adjust Last Operation panel in this case.
The properties are now drawn in relation to another then (Channel
underneath Use Cursor Position) next to some other minor layout
improvements.

Thx @HooglyBoogly for feedback (also providing UI code)

Maniphest Tasks: T79872

Differential Revision: https://developer.blender.org/D8625
This commit is contained in:
Philipp Oeser 2020-08-19 13:36:55 +02:00
parent 833bc70399
commit e74ba9e09e
Notes: blender-bot 2023-02-14 09:02:40 +01:00
Referenced by issue #79872, VSE - Strip menu - Split - adjust last operator displays wrong channel number
1 changed files with 24 additions and 0 deletions

View File

@ -58,6 +58,7 @@
#include "ED_sequencer.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "DEG_depsgraph.h"
@ -2383,6 +2384,28 @@ static int sequencer_split_invoke(bContext *C, wmOperator *op, const wmEvent *ev
return sequencer_split_exec(C, op);
}
static void sequencer_split_ui(bContext *UNUSED(C), wmOperator *op)
{
uiLayout *layout = op->layout;
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
uiLayout *row = uiLayoutRow(layout, false);
uiItemR(row, &ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, &ptr, "frame", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "side", 0, NULL, ICON_NONE);
uiItemS(layout);
uiItemR(layout, &ptr, "use_cursor_position", 0, NULL, ICON_NONE);
if (RNA_boolean_get(&ptr, "use_cursor_position")) {
uiItemR(layout, &ptr, "channel", 0, NULL, ICON_NONE);
}
}
void SEQUENCER_OT_split(struct wmOperatorType *ot)
{
/* Identifiers. */
@ -2394,6 +2417,7 @@ void SEQUENCER_OT_split(struct wmOperatorType *ot)
ot->invoke = sequencer_split_invoke;
ot->exec = sequencer_split_exec;
ot->poll = sequencer_edit_poll;
ot->ui = sequencer_split_ui;
/* Flags. */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;