public void LoadAndInitializeIcons(Type type)
        {
            string nodeNameLower = type.Name.ToLower();


            iconActive = SF_Resources.LoadNodeIcon(nodeNameLower);             // Main icon


            if (iconActive == null)
            {
                //Debug.Log("No icon found for: " + nodeNameLower);
            }
            else
            {
                // See if additional ones exist, if it found the first

                List <Texture2D> iconList = new List <Texture2D>();
                iconList.Add(iconActive);

                Texture2D tmp;
                for (int i = 2; i < 16; i++)                                  // max 16, to prevent while-loop locking
                {
                    tmp = SF_Resources.LoadNodeIcon(nodeNameLower + "_" + i); // Search for more
                    if (tmp == null)
                    {
                        break;
                    }
                    iconList.Add(tmp);
                }

                if (iconList.Count > 1)
                {
                    icons = iconList.ToArray();
                }

                //while( tmp =
            }
        }
        public void LoadDataTexture(string path)
        {
            Texture2D nodeIcon = SF_Resources.LoadNodeIcon(path);

            SF_Blit.Render(texture, "ReadPackedData", nodeIcon);
        }
        public SF_EditorNodeData CheckHotkeyInput(bool mouseOverSomeNode)
        {
            bool mouseInNodeView = SF_Editor.instance.nodeView.MouseInsideNodeView(false);


            if (Event.current.type == EventType.Repaint)
            {
                smoothHotkeySelectorIndex = Mathf.Lerp(smoothHotkeySelectorIndex, hotkeySelectorIndex, 0.5f);
            }

            bool useScroll = SF_Settings.quickPickScrollWheel;

            if (holding && Event.current.type == EventType.ScrollWheel && HotkeyFriends.Count > 0 && mouseInNodeView)
            {
                if (useScroll)
                {
                    hotkeySelectorIndex += (int)Mathf.Sign(Event.current.delta.y);
                    hotkeySelectorIndex  = Mathf.Clamp(hotkeySelectorIndex, 0, HotkeyFriends.Count - 1);
                }


                // hotkeySelectorIndex = ( hotkeySelectorIndex + HotkeyFriends.Count ) % HotkeyFriends.Count; // Wrap
                Event.current.Use();
            }

            if (key == KeyCode.None)
            {
                return(null);
            }

            if (Event.current.keyCode == key)
            {
                if (Event.current.type == EventType.KeyDown && !SF_GUI.HoldingControl() && holding == false && mouseInNodeView)
                {
                    hotkeySelectorIndex       = defaultHotkeySelectorIndex;
                    smoothHotkeySelectorIndex = defaultHotkeySelectorIndex;

                    quickpickerStartPosition = Event.current.mousePosition;

                    holding = true;
                }
                if (Event.current.rawType == EventType.KeyUp)
                {
                    holding = false;
                }
            }



            if (holding && !mouseOverSomeNode)
            {
                float width   = 166f; // nodeName.Length*8 + 10;
                Rect  dispPos = new Rect(0, 0, width, 36);

                Vector2 centerPos = useScroll ? Event.current.mousePosition : quickpickerStartPosition;

                dispPos.center = centerPos;
                dispPos.y     -= dispPos.height * 0.3333f;

                //
                //GUI.Box(dispPos, nodeName, GUI.skin.button);
                //



                // Draw hotkey node picker
                //if(Event.current.type == EventType.keyDown){
                //Debug.Log(Event.current.keyCode);
                Rect nRect = dispPos; //new Rect(0,0,128,32);
                nRect.center = centerPos - Vector2.up * nRect.height * 0.3333f;
                //nRect = nRect.MovedRight();
                if (useScroll)
                {
                    nRect.y -= nRect.height * smoothHotkeySelectorIndex;
                }
                else
                {
                    nRect.y -= nRect.height * defaultHotkeySelectorIndex;
                }
                //if(Event.current.keyCode != KeyCode.None){

                Color prevCol = GUI.color;



                int i = 0;
                foreach (SF_EditorNodeData node in HotkeyFriends)
                {
                    //float dist = Mathf.Abs(smoothHotkeySelectorIndex - i);
                    //float alpha = Mathf.Clamp(1f-Mathf.Clamp01(dist*0.25f), 0.2f, 0.8f);


                    float offset = 0f;//(dist*dist)/3f;



                    //if(i == hotkeySelectorIndex){
                    //alpha = 1;
                    //offset -= 8f;
                    //GUI.Box(nRect, node.nodeName, PopupButtonStyle);
                    //}
                    Rect newNRect = nRect;
                    newNRect.x += offset;


                    if (!useScroll && newNRect.Contains(Event.current.mousePosition))
                    {
                        hotkeySelectorIndex = i;
                    }

                    bool selected = (i == hotkeySelectorIndex);

                    if (selected)
                    {
                        GUI.color = new Color(1f, 1f, 1f, 1f);
                    }
                    else
                    {
                        GUI.color = new Color(0.6f, 0.6f, 0.6f, 0.5f);
                    }

                    if (node.isProperty)
                    {
                        GUI.color *= SF_Node.colorExposed;
                    }

                    Texture2D icon = SF_Resources.LoadNodeIcon(node.type.Split('.')[1].ToLower());

                    if (icon != null)
                    {
                        newNRect.width -= newNRect.height;
                    }

                    //if(useScroll){
                    GUI.Box(newNRect, node.nodeName, PopupButtonStyle);
                    //} else {
                    //if(GUI.Button(newNRect, node.nodeName, PopupButtonStyle)){
                    //hotkeySelectorIndex = i;
                    //}
                    //}



                    if (icon != null)
                    {
                        Rect iconRect = newNRect;
                        iconRect       = iconRect.MovedRight();
                        iconRect.width = iconRect.height;
                        GUI.color      = selected ? Color.white : new Color(1f, 1f, 1f, 0.4f);
                        GUI.DrawTexture(iconRect, icon);
                    }



                    nRect = nRect.MovedDown();

                    i++;
                }
                GUI.color = prevCol;



                //}
                if (Event.current.type == EventType.KeyDown /* && Event.current.type == EventType.layout*/ /*&& GUI.GetNameOfFocusedControl() == "defocus"*/)
                {
                    Event.current.Use();
                }
                //}

                //}

                //GUI.Label(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 256,32),"currentindex = " + hotkeySelectorIndex);
            }



            bool clicked = Event.current.type == EventType.MouseDown;

            if (holding && clicked)
            {
                return(HotkeyFriends[hotkeySelectorIndex]);
            }
            else
            {
                return(null);
            }
        }