//-----------------------------------------------------------------------------------
        public void RenderFieldObjects(string labelText, CNFieldController fieldController, bool enabled, bool showScope, CNFieldWindow.Type windowType)
        {
            if (objects_rect_width == 1)
            {
                CRManagerEditor.RepaintIfOpen();
            }

            EditorGUI.BeginDisabledGroup(!enabled);
            Event     ev     = Event.current;
            EventType evType = ev.type;

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField(labelText, GUILayout.MaxWidth(showScope ? short_label_width : long_label_width));

            GUILayout.Label("", EditorStyles.objectField);
            Rect objectsRect = GUILayoutUtility.GetLastRect();

            if (evType == EventType.Repaint)
            {
                objects_rect_width = objectsRect.width;
            }

            fieldController.DrawFieldItems(objectsRect, tex_icon_size);

            if (evType == EventType.MouseDown && ev.button == 0 &&
                objectsRect.Contains(ev.mousePosition))
            {
                if (windowType == CNFieldWindow.Type.normal)
                {
                    CNFieldWindowSmall.ShowWindow <CNFieldWindowSmall>(labelText, fieldController, this);
                }
                else if (windowType == CNFieldWindow.Type.extended)
                {
                    CNFieldWindowBig.ShowWindow <CNFieldWindowBig>(labelText, fieldController, this);
                }
            }
            if (showScope)
            {
                GUILayout.Space(10f);
                EditorGUILayout.LabelField("Scope", GUILayout.Width(40f));
                CNField.ScopeFlag auxScope = fieldController.GetScopeType();
                EditorGUI.BeginChangeCheck();
                auxScope = (CNField.ScopeFlag)EditorGUILayout.EnumPopup(auxScope, GUILayout.Width(70f));
                if (EditorGUI.EndChangeCheck())
                {
                    fieldController.SetScopeType(auxScope);
                    cnHierarchy.RecalculateFieldsDueToUserAction();
                    EditorUtility.SetDirty(Data);
                }
            }
            ProccesEvents(ev, evType, fieldController, objectsRect);
            EditorGUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();
        }
示例#2
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);
        }