public override void OnInspectorGUI()
    {
        // Draw the default
        base.OnInspectorGUI();

        // Place the button at the bottom
        ObjectCollection myScript = (ObjectCollection)target;

        if (GUILayout.Button("Update Collection"))
        {
            myScript.UpdateCollection();
        }

        ObjectCollectionNodes myNodeScript = (ObjectCollectionNodes)target;

        if (GUILayout.Button("Update Collection"))
        {
            myNodeScript.UpdateCollection();
        }
    }
Пример #2
0
    public void displayNodes()
    {
        deleteOldNodes();

        //Debug.Log("currentSite: "+  currentSite);
        //Debug.Log("start: "+  start);

        start = (currentSite - 1) * ElementsToDisplayInToolbox;
        if (currentSite * ElementsToDisplayInToolbox > NodeList.Count)
        {
            finish = NodeList.Count;
        }
        else
        {
            finish = currentSite * ElementsToDisplayInToolbox;
        }

        //Debug.Log("finish: " + finish);

        for (int i = start; i < finish; i++)
        {
            //Debug.Log("i und Nodename:" + i + " / " + NodeList[i].Name);

            if (NodeList[i].Name == "emptyNode")
            {
                GameObject empty = new GameObject();
                empty.name = "emptyNode";

                NodeList[i].NodeGameObject     = empty;
                NodeList[i].transform          = empty.transform;
                NodeList[i].displayedInToolbox = true;
                NodeList[i].transform.parent   = toolboxNodes.transform;
            }

            else if (NodeList[i].Name == "/camera/rgb/image_raw/compressed")
            {
                GameObject prefab = GameObject.Find("ButtonCameraHolographic");
                GameObject clone  = Instantiate(prefab, this.transform);
                clone.name = NodeList[i].Name;
                clone.GetComponentInChildren <TextMesh>().text = NodeList[i].Name;
                //Debug.Log("Transform der Node: " + clone.transform.ToString());

                NodeList[i].NodeGameObject     = clone;
                NodeList[i].transform          = clone.transform;
                NodeList[i].displayedInToolbox = true;
                NodeList[i].transform.parent   = toolboxNodes.transform;



                //NodesToDisplay.Add(NodeList[i]);
                NodeList[i].transform.parent = toolboxNodes.transform;
                //Debug.Log("--Neue Nodeliste: " + toolboxNodes.NodeList.Count);
            }

            else
            {
                GameObject prefab = GameObject.Find("ButtonHolographic");
                GameObject clone  = Instantiate(prefab, this.transform);
                clone.name = NodeList[i].Name;
                clone.GetComponentInChildren <TextMesh>().text = NodeList[i].Name;
                //Debug.Log("Transform der Node: " + clone.transform.ToString());

                NodeList[i].NodeGameObject     = clone;
                NodeList[i].transform          = clone.transform;
                NodeList[i].displayedInToolbox = true;
                NodeList[i].transform.parent   = toolboxNodes.transform;



                //NodesToDisplay.Add(NodeList[i]);
                NodeList[i].transform.parent = toolboxNodes.transform;
                //Debug.Log("--Neue Nodeliste: " + toolboxNodes.NodeList.Count);
            }
        }
        //Debug.Log("--Toolbox Kinder: " + toolboxNodes.transform.childCount);
        toolboxNodes.UpdateCollection();
    }