@@ -22,11 +22,28 @@ internal static class CopyPasteHelper
2222
2323 private static SerializedProperty s_lastAddedElement ;
2424 private static InputActionsEditorState s_State ;
25+ private static bool s_lastClipboardActionWasCut = false ;
2526
2627 private static bool IsComposite ( SerializedProperty property ) => property . FindPropertyRelative ( "m_Flags" ) . intValue == ( int ) InputBinding . Flags . Composite ;
2728 private static bool IsPartOfComposite ( SerializedProperty property ) => property . FindPropertyRelative ( "m_Flags" ) . intValue == ( int ) InputBinding . Flags . PartOfComposite ;
2829 private static string PropertyName ( SerializedProperty property ) => property . FindPropertyRelative ( "m_Name" ) . stringValue ;
2930
31+ #region Cut
32+
33+ public static void CutActionMap ( InputActionsEditorState state )
34+ {
35+ CopyActionMap ( state ) ;
36+ s_lastClipboardActionWasCut = true ;
37+ }
38+
39+ public static void Cut ( InputActionsEditorState state )
40+ {
41+ Copy ( state ) ;
42+ s_lastClipboardActionWasCut = true ;
43+ }
44+
45+ #endregion
46+
3047 #region Copy
3148
3249 public static void CopyActionMap ( InputActionsEditorState state )
@@ -54,6 +71,7 @@ private static void CopySelectedTreeViewItemsToClipboard(List<SerializedProperty
5471 var copyBuffer = new StringBuilder ( ) ;
5572 CopyItems ( items , copyBuffer , type , actionMap ) ;
5673 EditorGUIUtility . systemCopyBuffer = copyBuffer . ToString ( ) ;
74+ s_lastClipboardActionWasCut = false ;
5775 }
5876
5977 private static void CopyItems ( List < SerializedProperty > items , StringBuilder buffer , Type type , SerializedProperty actionMap )
@@ -152,6 +170,11 @@ public static SerializedProperty PasteActionMapsFromClipboard(InputActionsEditor
152170 s_State = state ;
153171 var actionMapArray = state . serializedObject . FindProperty ( nameof ( InputActionAsset . m_ActionMaps ) ) ;
154172 PasteData ( EditorGUIUtility . systemCopyBuffer , new [ ] { state . selectedActionMapIndex } , actionMapArray ) ;
173+
174+ // Don't want to be able to paste repeatedly after a cut - ISX-1821
175+ if ( s_lastAddedElement != null && s_lastClipboardActionWasCut )
176+ EditorGUIUtility . systemCopyBuffer = string . Empty ;
177+
155178 return s_lastAddedElement ;
156179 }
157180
@@ -164,6 +187,11 @@ public static SerializedProperty PasteActionsOrBindingsFromClipboard(InputAction
164187 PasteActionsFromClipboard ( state , addLast ) ;
165188 if ( typeOfCopiedData == typeof ( InputBinding ) )
166189 PasteBindingsFromClipboard ( state ) ;
190+
191+ // Don't want to be able to paste repeatedly after a cut - ISX-1821
192+ if ( s_lastAddedElement != null && s_lastClipboardActionWasCut )
193+ EditorGUIUtility . systemCopyBuffer = string . Empty ;
194+
167195 return s_lastAddedElement ;
168196 }
169197
0 commit comments