private void RenderActionListElement(Rect rect, int index, bool isActive, bool isFocused) { RSActionData action = m_SelectionState.Rule.Actions[index]; Rect labelRect = rect; labelRect.width -= CLONE_BUTTON_WIDTH + CLONE_BUTTON_SPACING; string labelText = action.GetPreviewString(GetCurrentTrigger(), m_Context.Library); using (new RSGUI.ColorScope(action.Enabled ? Color.white : Color.gray)) { EditorGUI.LabelField(labelRect, labelText); } Rect cloneRect = rect; cloneRect.width = CLONE_BUTTON_WIDTH; cloneRect.height -= 4; cloneRect.x = labelRect.xMax + CLONE_BUTTON_SPACING; using (new EditorGUI.DisabledScope(EditorApplication.isPlaying)) { if (GUI.Button(cloneRect, "Clone")) { RSActionData clone = action.Clone(); InsertAction(clone, index + 1); } } if (DetectContextClick(rect)) { ShowActionElementContextMenu(action, index); } }
static public void CopyAction(RSActionData inActionData) { Clear(); s_CurrentTarget = Target.Action; s_CurrentAction = inActionData.Clone(); }
static public RSActionData PasteAction() { if (!HasAction()) { Debug.LogError("No action copied"); return(null); } return(s_CurrentAction.Clone()); }