-
Notifications
You must be signed in to change notification settings - Fork 326
FIX: Allow Copy/Paste between windows (ISX-1823). #1844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
4d21dbf
4e41f29
9cda4d8
108c268
5b5e663
384cb74
b7617fe
2e64bb2
7ae236a
a5e7de0
9a9cf85
78904a7
1b56964
3179bf0
0774a65
5c4aa27
2bad8bb
d1d99a9
519abd9
80b2705
6227e7e
0abdaef
81f78f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,6 +204,10 @@ private static void PasteActionsFromClipboard(InputActionsEditorState state, boo | |
var index = state.selectedActionIndex; | ||
if (addLast) | ||
index = actionArray.arraySize - 1; | ||
|
||
if (index < 0) | ||
index = 0; | ||
graham-huws marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
PasteData(EditorGUIUtility.systemCopyBuffer, new[] {index}, actionArray); | ||
} | ||
|
||
|
@@ -288,13 +292,14 @@ private static void PasteAction(SerializedProperty arrayProperty, string jsonToI | |
private static int PasteBindingOrComposite(SerializedProperty arrayProperty, string json, int index, string actionName, bool createCompositeParts = true) | ||
{ | ||
var pastePartOfComposite = IsPartOfComposite(json); | ||
if (index > 0) | ||
if (index > 0 && arrayProperty.arraySize > 0 && index - 1 < arrayProperty.arraySize) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am confused about an index that must be greater than zero and at least two elements from the end of the anway? Would recommend adding an inline comment if this is correct but some kind of special case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This somewhat doubled up from merging develop - should be clearer now :) |
||
{ | ||
var currentProperty = arrayProperty.GetArrayElementAtIndex(index - 1); | ||
var currentIsComposite = IsComposite(currentProperty) || IsPartOfComposite(currentProperty); | ||
if (pastePartOfComposite && !currentIsComposite) //prevent pasting part of composite into non-composite | ||
return index; | ||
} | ||
|
||
index = pastePartOfComposite || s_State.selectionType == SelectionType.Action ? index : Selectors.GetSelectedBindingIndexAfterCompositeBindings(s_State) + 1; | ||
if (json.Contains(k_BindingData)) //copied data is composite with bindings - only true for directly copied composites, not for composites from copied actions | ||
return PasteCompositeFromJson(arrayProperty, json, index, actionName); | ||
|
@@ -351,7 +356,7 @@ private static bool IsPartOfComposite(string json) | |
private static SerializedProperty AddElement(SerializedProperty arrayProperty, string name, int index = -1) | ||
{ | ||
var uniqueName = InputActionSerializationHelpers.FindUniqueName(arrayProperty, name); | ||
if (index < 0) | ||
if (index < 0 || index > arrayProperty.arraySize) | ||
graham-huws marked this conversation as resolved.
Show resolved
Hide resolved
|
||
index = arrayProperty.arraySize; | ||
|
||
arrayProperty.InsertArrayElementAtIndex(index); | ||
|
Uh oh!
There was an error while loading. Please reload this page.