// This is called before an action is performed
        public void PreAction(int multiselectionundogroup)
        {
            actionresult = new VisualActionResult();

            PickTargetUnlocked();

            // If the action is not performed on a selected object, clear the
            // current selection and make a temporary selection for the target.
            if ((target.picked != null) && !target.picked.Selected && (BuilderPlug.Me.VisualModeClearSelection || (selectedobjects.Count == 0)))
            {
                // Single object, no selection
                singleselection = true;
                ClearSelection();
                undocreated = false;
            }
            else
            {
                singleselection = false;

                // Check if we should make a new undo level
                // We don't want to do this if this is the same action with the same
                // selection and the action wants to group the undo levels
                if ((lastundogroup != multiselectionundogroup) || (lastundogroup == UndoGroup.None) ||
                    (multiselectionundogroup == UndoGroup.None) || selectionchanged)
                {
                    // We want to create a new undo level, but not just yet
                    lastundogroup = multiselectionundogroup;
                    undocreated   = false;
                }
                else
                {
                    // We don't want to make a new undo level (changes will be combined)
                    undocreated = true;
                }
            }
        }
 // This sets the result for an action
 public void SetActionResult(string displaystatus)
 {
     actionresult = new VisualActionResult();
     actionresult.displaystatus = displaystatus;
 }
 // This sets the result for an action
 public void SetActionResult(VisualActionResult result)
 {
     actionresult = result;
 }
 // Called before an action is performed. This does not make an undo level
 private void PreActionNoChange()
 {
     actionresult    = new VisualActionResult();
     singleselection = false;
     undocreated     = false;
 }