Skip to content

Commit 621526b

Browse files
committed
Update singer & parameter
1 parent 3021f84 commit 621526b

6 files changed

Lines changed: 92 additions & 22 deletions

File tree

src/plugins/coreplugin/qml/propertyeditors/VirtualSingerPropertyEditor.qml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import SVSCraft.UIComponents
1111

1212
import DiffScope.UIShell
1313
import DiffScope.Core
14+
import DiffScope.DspxModel.SelectionModel as DspxSelectionModel
1415

1516
PropertyEditorGroupBox {
1617
id: groupBox
@@ -21,8 +22,23 @@ PropertyEditorGroupBox {
2122
required property QtObject propertyMapper
2223

2324
readonly property QtObject selectionModel: windowHandle?.projectDocumentContext.document.selectionModel ?? null
24-
readonly property bool multipleClips: (selectionModel?.selectedCount ?? 0) > 1
25-
readonly property QtObject singingClip: selectionModel?.clipSelectionModel.selectedItems[0] ?? null
25+
readonly property bool multipleClips: selectionModel?.selectionType
26+
=== DspxSelectionModel.SelectionModel.ST_Clip
27+
&& (selectionModel?.selectedCount ?? 0) > 1
28+
readonly property QtObject singingClip: {
29+
switch (selectionModel?.selectionType) {
30+
case DspxSelectionModel.SelectionModel.ST_Clip:
31+
return selectionModel.clipSelectionModel.selectedItems[0] ?? null
32+
case DspxSelectionModel.SelectionModel.ST_Note:
33+
return selectionModel.noteSelectionModel.noteSequenceWithSelectedItems?.singingClip ?? null
34+
case DspxSelectionModel.SelectionModel.ST_AnchorNode: {
35+
const sequence = selectionModel.anchorNodeSelectionModel.anchorNodeSequenceWithSelectedItems
36+
return sequence?.parameter?.parameterMap?.singingClip ?? null
37+
}
38+
default:
39+
return null
40+
}
41+
}
2642
readonly property bool hasSources: !multipleClips && Boolean(singingClip?.sources)
2743
readonly property bool architectureMissing: hasSources
2844
&& Boolean(clipSingerIdProvider.architectureId)
@@ -71,7 +87,13 @@ PropertyEditorGroupBox {
7187
}
7288

7389
function selectedSingingClips() {
74-
const selectedItems = selectionModel?.clipSelectionModel.selectedItems ?? []
90+
if (!selectionModel)
91+
return []
92+
93+
if (selectionModel.selectionType !== DspxSelectionModel.SelectionModel.ST_Clip)
94+
return singingClip ? [singingClip] : []
95+
96+
const selectedItems = selectionModel.clipSelectionModel.selectedItems
7597
const clips = []
7698
for (let index = 0; index < selectedItems.length; ++index)
7799
clips.push(selectedItems[index])

src/plugins/visualeditor/core/PianoRollPanelInterface.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,21 @@ namespace VisualEditor {
183183
return sflow::ParameterEditorInteractionController::None;
184184
}
185185
}();
186+
const auto alternateInteraction = [interaction] {
187+
switch (interaction) {
188+
case sflow::ParameterEditorInteractionController::Pencil:
189+
return sflow::ParameterEditorInteractionController::Eraser;
190+
case sflow::ParameterEditorInteractionController::Eraser:
191+
return sflow::ParameterEditorInteractionController::Pencil;
192+
case sflow::ParameterEditorInteractionController::Pointer:
193+
case sflow::ParameterEditorInteractionController::Pen:
194+
return sflow::ParameterEditorInteractionController::ConvertAnchor;
195+
case sflow::ParameterEditorInteractionController::AnchorRubberBandSelect:
196+
return sflow::ParameterEditorInteractionController::AnchorTimeRangeSelect;
197+
default:
198+
return interaction;
199+
}
200+
}();
186201
switch (interaction) {
187202
case sflow::ParameterEditorInteractionController::Pencil:
188203
case sflow::ParameterEditorInteractionController::Eraser:
@@ -196,6 +211,8 @@ namespace VisualEditor {
196211
->pitchBinding()->focusFreeLayer();
197212
pitchController->setPrimaryItemInteraction(interaction);
198213
pitchController->setPrimarySceneInteraction(interaction);
214+
pitchController->setSecondaryItemInteraction(alternateInteraction);
215+
pitchController->setSecondarySceneInteraction(alternateInteraction);
199216
break;
200217
case sflow::ParameterEditorInteractionController::Pointer:
201218
case sflow::ParameterEditorInteractionController::AnchorRubberBandSelect:
@@ -204,11 +221,15 @@ namespace VisualEditor {
204221
pitchController->setPrimaryItemInteraction(interaction);
205222
pitchController->setPrimarySceneInteraction(interaction);
206223
pitchController->setPrimarySelectInteraction(interaction);
224+
pitchController->setSecondaryItemInteraction(alternateInteraction);
225+
pitchController->setSecondarySceneInteraction(alternateInteraction);
226+
pitchController->setSecondarySelectInteraction(alternateInteraction);
207227
break;
208228
case sflow::ParameterEditorInteractionController::ConvertAnchor:
209229
ProjectViewModelContext::of(windowHandle)->parameterEditorContext()
210230
->pitchBinding()->focusAnchorLayer();
211231
pitchController->setPrimaryItemInteraction(interaction);
232+
pitchController->setSecondaryItemInteraction(alternateInteraction);
212233
break;
213234
default:
214235
break;

src/plugins/visualeditor/qml/additionaltracks/ParameterTrack.qml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,22 @@ QtObject {
7878
controller.secondarySelectInteraction = ParameterEditorInteractionController.None
7979
}
8080

81+
function alternateTool(tool: int): int {
82+
switch (tool) {
83+
case ParameterEditorInteractionController.Pencil:
84+
return ParameterEditorInteractionController.Eraser
85+
case ParameterEditorInteractionController.Eraser:
86+
return ParameterEditorInteractionController.Pencil
87+
case ParameterEditorInteractionController.Pointer:
88+
case ParameterEditorInteractionController.Pen:
89+
return ParameterEditorInteractionController.ConvertAnchor
90+
case ParameterEditorInteractionController.AnchorRubberBandSelect:
91+
return ParameterEditorInteractionController.AnchorTimeRangeSelect
92+
default:
93+
return tool
94+
}
95+
}
96+
8197
function setTool(tool: int) {
8298
currentTool = tool
8399
resetController(editingBinding?.interactionController)
@@ -87,6 +103,7 @@ QtObject {
87103
: editingBinding?.interactionController
88104
if (!controller)
89105
return
106+
const alternate = alternateTool(tool)
90107
switch (tool) {
91108
case ParameterEditorInteractionController.Pencil:
92109
case ParameterEditorInteractionController.Eraser:
@@ -107,6 +124,8 @@ QtObject {
107124
}
108125
controller.primaryItemInteraction = tool
109126
controller.primarySceneInteraction = tool
127+
controller.secondaryItemInteraction = alternate
128+
controller.secondarySceneInteraction = alternate
110129
break
111130
case ParameterEditorInteractionController.Pointer:
112131
case ParameterEditorInteractionController.AnchorRubberBandSelect:
@@ -117,13 +136,17 @@ QtObject {
117136
controller.primaryItemInteraction = tool
118137
controller.primarySceneInteraction = tool
119138
controller.primarySelectInteraction = tool
139+
controller.secondaryItemInteraction = alternate
140+
controller.secondarySceneInteraction = alternate
141+
controller.secondarySelectInteraction = alternate
120142
break
121143
case ParameterEditorInteractionController.ConvertAnchor:
122144
if (transformEditing)
123145
editingBinding.focusTransformAnchorLayer()
124146
else
125147
editingBinding.focusAnchorLayer()
126148
controller.primaryItemInteraction = tool
149+
controller.secondaryItemInteraction = alternate
127150
break
128151
}
129152
}
@@ -167,6 +190,9 @@ QtObject {
167190
required property int index
168191
width: combo.width
169192
height: combo.implicitHeight
193+
padding: 2
194+
leftPadding: 8
195+
rightPadding: 8
170196
highlighted: combo.highlightedIndex === index
171197
hoverEnabled: combo.hoverEnabled
172198
text: displayName
@@ -256,7 +282,9 @@ QtObject {
256282
ToolButton {
257283
implicitHeight: 22
258284
padding: 3
285+
icon.source: "image://fluent-system-icons/adr"
259286
text: qsTr("Transform")
287+
ThemedItem.controlType: SVS.CT_Accent
260288
checkable: true
261289
checked: control.transformEditing
262290
enabled: control.editingBinding?.available ?? false
@@ -273,11 +301,11 @@ QtObject {
273301
model: [
274302
{ text: qsTr("Pencil"), icon: "edit", tool: ParameterEditorInteractionController.Pencil },
275303
{ text: qsTr("Eraser"), icon: "eraser", tool: ParameterEditorInteractionController.Eraser },
276-
{ text: qsTr("Range"), icon: "rectangle_landscape_dash", tool: ParameterEditorInteractionController.FreeRangeSelect },
304+
{ text: qsTr("Range Select"), icon: "cursor_text", tool: ParameterEditorInteractionController.FreeRangeSelect },
277305
{ text: qsTr("Pointer"), icon: "cursor", tool: ParameterEditorInteractionController.Pointer },
278306
{ text: qsTr("Pen"), icon: "calligraphy_pen", tool: ParameterEditorInteractionController.Pen },
279-
{ text: qsTr("Convert"), icon: "", tool: ParameterEditorInteractionController.ConvertAnchor },
280-
{ text: qsTr("Anchors"), icon: "", tool: ParameterEditorInteractionController.AnchorRubberBandSelect }
307+
{ text: qsTr("Convert"), icon: "arrow_bidirectional_left_right", tool: ParameterEditorInteractionController.ConvertAnchor },
308+
{ text: qsTr("Anchors Select"), icon: "rectangle_landscape_dash", tool: ParameterEditorInteractionController.AnchorRubberBandSelect }
281309
]
282310
delegate: ToolButton {
283311
required property var modelData

src/plugins/visualeditor/res/org.diffscope.visualeditor_actions.xml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@
4343
<action id="org.diffscope.visualeditor.arrangementPanel.handTool" icon="hand_left" />
4444
<action id="org.diffscope.visualeditor.mixerPanel.pointerTool" icon="cursor" />
4545
<action id="org.diffscope.visualeditor.mixerPanel.handTool" icon="hand_left" />
46-
<action id="org.diffscope.visualeditor.pianoRollPanel.pointerTool" icon="cursor" />
47-
<action id="org.diffscope.visualeditor.pianoRollPanel.pencilTool" icon="edit" />
48-
<action id="org.diffscope.visualeditor.pianoRollPanel.scissorTool" icon="cut" />
49-
<action id="org.diffscope.visualeditor.pianoRollPanel.selectTool" icon="rectangle_landscape_dash" />
46+
<action id="org.diffscope.visualeditor.pianoRollPanel.pointerTool" icon="cursor" shortcut="F5" />
47+
<action id="org.diffscope.visualeditor.pianoRollPanel.pencilTool" icon="edit" shortcut="F6" />
48+
<action id="org.diffscope.visualeditor.pianoRollPanel.scissorTool" icon="cut" shortcut="F7" />
49+
<action id="org.diffscope.visualeditor.pianoRollPanel.selectTool" icon="rectangle_landscape_dash" shortcut="F8" />
5050
<action id="org.diffscope.visualeditor.pianoRollPanel.handTool" icon="hand_left" />
51-
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPencilTool" icon="pitch_pencil" />
52-
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchEraserTool" icon="pitch_erase" />
53-
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchRangeSelectTool" />
54-
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPointerTool" icon="pitch_cursor" />
55-
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPenTool" />
56-
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchConvertTool" />
57-
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchAnchorSelectTool" />
51+
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPencilTool" icon="pitch_pencil" shortcut="1" />
52+
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchEraserTool" icon="pitch_erase" shortcut="2" />
53+
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchRangeSelectTool" icon="pitch_cursor_text" shortcut="3" />
54+
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPointerTool" icon="pitch_cursor" shortcut="4" />
55+
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPenTool" icon="calligraphy_pen" shortcut="5" />
56+
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchConvertTool" icon="arrow_bidirectional_left_right" shortcut="6" />
57+
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchAnchorSelectTool" icon="pitch_rectangle_landscape_dash" shortcut="7" />
5858
<action id="org.diffscope.visualeditor.pianoRollPanel.additionalTracks" icon="more_vertical" diffscope:componentType="menu" />
5959
<action id="org.diffscope.visualeditor.pianoRollPanel.bottomAdditionalTracks" text="Bottom Panels" icon="layout_row_two_focus_bottom" diffscope:componentType="menu" />
6060
<action id="org.diffscope.visualeditor.arrangementPanel.snap" diffscope:componentType="widget" />
@@ -86,7 +86,7 @@
8686
<action id="org.diffscope.visualeditor.pianoRollPanel.additionalTracks.keySignature" catalog="org.diffscope.visualeditor.pianoRollPanel.additionalTrackWidgets" icon="" diffscope:componentType="custom" />
8787
<action id="org.diffscope.visualeditor.pianoRollPanel.additionalTracks.clip" catalog="org.diffscope.visualeditor.pianoRollPanel.additionalTrackWidgets" icon="" diffscope:componentType="custom" />
8888
<action id="org.diffscope.visualeditor.pianoRollPanel.additionalTracks.phoneme" catalog="org.diffscope.visualeditor.pianoRollPanel.bottomAdditionalTrackWidgets" icon="" diffscope:componentType="custom" />
89-
<action id="org.diffscope.visualeditor.pianoRollPanel.additionalTracks.parameter" catalog="org.diffscope.visualeditor.pianoRollPanel.bottomAdditionalTrackWidgets" icon="" diffscope:componentType="custom" />
89+
<action id="org.diffscope.visualeditor.pianoRollPanel.additionalTracks.parameter" catalog="org.diffscope.visualeditor.pianoRollPanel.bottomAdditionalTrackWidgets" icon="parameter_view" diffscope:componentType="custom" />
9090

9191
</items>
9292

@@ -143,15 +143,14 @@
143143
<action id="org.diffscope.visualeditor.pianoRollPanel.pencilTool" />
144144
<action id="org.diffscope.visualeditor.pianoRollPanel.scissorTool" />
145145
<action id="org.diffscope.visualeditor.pianoRollPanel.selectTool" />
146-
<action id="org.diffscope.visualeditor.pianoRollPanel.handTool" />
147-
<separator />
148146
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPencilTool" />
149147
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchEraserTool" />
150148
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchRangeSelectTool" />
151149
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPointerTool" />
152150
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchPenTool" />
153151
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchConvertTool" />
154152
<action id="org.diffscope.visualeditor.pianoRollPanel.pitchAnchorSelectTool" />
153+
<action id="org.diffscope.visualeditor.pianoRollPanel.handTool" />
155154
</group>
156155
<group id="org.diffscope.visualeditor.pianoRollPanelToolBar.snapActions">
157156
<action id="org.diffscope.visualeditor.pianoRollPanel.snap" />

0 commit comments

Comments
 (0)