private void RenderConditionListElement(Rect rect, int index, bool isActive, bool isFocused) { RSConditionData condition = m_SelectionState.Rule.Conditions[index]; Rect labelRect = rect; labelRect.width -= CLONE_BUTTON_WIDTH + CLONE_BUTTON_SPACING; string labelText = condition.GetPreviewString(GetCurrentTrigger(), m_Context.Library); using (new RSGUI.ColorScope(condition.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")) { RSConditionData clone = condition.Clone(); InsertCondition(clone, index + 1); } } if (DetectContextClick(rect)) { ShowConditionElementContextMenu(condition, index); } }
static public void CopyCondition(RSConditionData inConditionData) { Clear(); s_CurrentTarget = Target.Condition; s_CurrentCondition = inConditionData.Clone(); }
static public RSConditionData PasteCondition() { if (!HasCondition()) { Debug.LogError("No condition copied"); return(null); } return(s_CurrentCondition.Clone()); }