/// <summary> Initiate a rename on the currently selected node </summary>
 public void RenameSelectedNode()
 {
     if (Selection.objects.Length == 1 && Selection.activeObject is XNode.Node)
     {
         XNode.Node node = Selection.activeObject as XNode.Node;
         Vector2    size;
         if (nodeSizes.TryGetValue(node, out size))
         {
             RenamePopup.Show(Selection.activeObject, size.x);
         }
         else
         {
             RenamePopup.Show(Selection.activeObject);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary> Show a rename popup for an asset at mouse position. Will trigger reimport of the asset on apply.
        public static RenamePopup Show(Object target, float width = 200)
        {
            RenamePopup window = EditorWindow.GetWindow <RenamePopup>(true, "Rename " + target.name, true);

            if (current != null)
            {
                current.Close();
            }
            current         = window;
            window.target   = target;
            window.input    = target.name;
            window.minSize  = new Vector2(100, 44);
            window.position = new Rect(0, 0, width, 44);
            window.UpdatePositionToMouse();
            return(window);
        }