Example #1
0
        //-----------------------------------------------------------------------------------
        public virtual void RenderGUI(Rect area)
        {
            if (ownerNode_ == null)
            {
                CNFieldWindowSmall.CloseIfOpen();
                EditorGUIUtility.ExitGUI();
            }

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
            DrawToolStrip();
            EditorGUILayout.EndHorizontal();

            EditorGUI.LabelField(new Rect(5f, 30f, 50f, 20f), "Objects: ");
            Rect listArea = new Rect(5, 50, area.width - 10, area.height - 55);

            selectionListBox_.RenderGUI(listArea);
        }
Example #2
0
        //-----------------------------------------------------------------------------------
        public override void RenderGUI(Rect area)
        {
            if (ownerNode_ == null)
            {
                CNFieldWindowBig.CloseIfOpen();
                EditorGUIUtility.ExitGUI();
            }

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            DrawToolStrip();

            EditorGUILayout.EndHorizontal();

            Event ev = Event.current;

            EditorGUI.LabelField(new Rect(5f, 30f, area.width, 20f), "Selected Objects:");

            Rect listAreaObjects = new Rect(5f, 50f, Mathf.Ceil((area.width - 10f) / 2f - 30f), Mathf.Ceil(area.height - botMargin));
            Rect buttonRect      = new Rect(listAreaObjects.xMax + 10f, (listAreaObjects.yMax - listAreaObjects.yMin - buttonsHeight) / 2f + 30f, 40f, 35f);

            Rect listAreaNodes = new Rect(buttonRect.xMax + 10f, listAreaObjects.yMin, (area.width - 10f) / 2f - 30f, area.height - botMargin - buttonsHeight - 10f);
            Rect buttonsArea   = new Rect(buttonRect.xMax + 10f, listAreaNodes.yMax + 2f, listAreaNodes.width, buttonsHeight);

            Rect label1Area = new Rect(buttonRect.xMin + 10f, buttonsArea.yMin + 27f, 20f, 17f);
            Rect label2Area = new Rect(buttonRect.xMin + 10f, label1Area.yMax + 13f, 20f, 17f);

            EditorGUI.BeginDisabledGroup(!Controller.AreGameObjectsAllowed());

            EditorGUI.LabelField(label1Area, "<<");
            EditorGUI.LabelField(label2Area, "<<");

            EditorGUI.EndDisabledGroup();

            ProcessEvents(ev, listAreaObjects, listAreaNodes);

            EditorGUI.BeginDisabledGroup(!nodesController_.AnyNodeSelected);
            if (GUI.Button(buttonRect, "<<"))
            {
                nodesController_.AddSelectedNodes();
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.LabelField(new Rect(buttonRect.xMax + 10f, 30f, area.width, 20f), "Selectable Nodes:");

            selectionListBox_.RenderGUI(listAreaObjects);
            nodesListBox_.RenderGUI(listAreaNodes);

            GUILayout.BeginArea(buttonsArea);

            EditorGUI.BeginChangeCheck();

            bool isShowOwnerGroupOnly = field_.ShowOwnerGroupOnly;

            GUIStyle styleToggle = new GUIStyle(EditorStyles.label);

            if (isShowOwnerGroupOnly)
            {
                styleToggle.fontStyle = FontStyle.Bold;
            }

            field_.ShowOwnerGroupOnly = EditorGUILayout.ToggleLeft("Show only owner group", isShowOwnerGroupOnly, styleToggle);
            if (EditorGUI.EndChangeCheck())
            {
                nodesController_.SetSelectableNodes();
                EditorUtility.SetDirty(ownerNode_);
            }

            EditorGUILayout.Space();

            EditorGUI.BeginDisabledGroup(!Controller.AreGameObjectsAllowed());
            if (GUILayout.Button("Name Selector"))
            {
                Controller.AddNameSelectorWindow();
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("Game Object Selection"))
            {
                Controller.AddCurrentSelection();
            }
            EditorGUI.EndDisabledGroup();

            GUILayout.EndArea();
        }