示例#1
0
        private IEnumerable <TreeViewItem> Filter(IEnumerable <TreeViewItem> rows)
        {
            IEnumerable <TreeViewItem> enumerable = rows;
            int num = this.m_ColumnsInternal.Length;

            for (int i = 0; i < num; i++)
            {
                if (this.IsColumnVisible(i))
                {
                    SerializedPropertyTreeView.Column c = this.Col(i);
                    int idx = i;
                    if (c.filter != null)
                    {
                        if (c.filter.Active())
                        {
                            if (c.filter.GetType().Equals(typeof(SerializedPropertyFilters.Name)))
                            {
                                SerializedPropertyFilters.Name f = (SerializedPropertyFilters.Name)c.filter;
                                enumerable = from item in enumerable
                                             where f.Filter(((SerializedPropertyTreeView.SerializedPropertyItem)item).GetData().name)
                                             select item;
                            }
                            else
                            {
                                enumerable = from item in enumerable
                                             where c.filter.Filter(((SerializedPropertyTreeView.SerializedPropertyItem)item).GetData().properties[idx])
                                             select item;
                            }
                        }
                    }
                }
            }
            return(enumerable);
        }
示例#2
0
        public void OnFilterGUI(Rect r)
        {
            EditorGUI.BeginChangeCheck();
            float width = r.width;
            float num   = 16f;

            r.width = num;
            this.m_bFilterSelection = EditorGUI.Toggle(r, this.m_bFilterSelection);
            r.x    += num;
            r.width = GUI.skin.label.CalcSize(SerializedPropertyTreeView.Styles.filterSelection).x;
            EditorGUI.LabelField(r, SerializedPropertyTreeView.Styles.filterSelection);
            r.width = Mathf.Min(width - (r.x + r.width), 300f);
            r.x     = width - r.width + 10f;
            for (int i = 0; i < base.multiColumnHeader.state.columns.Length; i++)
            {
                if (this.IsColumnVisible(i))
                {
                    SerializedPropertyTreeView.Column column = this.Col(i);
                    if (column.filter != null && column.filter.GetType().Equals(typeof(SerializedPropertyFilters.Name)))
                    {
                        column.filter.OnGUI(r);
                    }
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                base.Reload();
            }
        }
示例#3
0
        public SerializedPropertyTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader, SerializedPropertyDataStore dataStore) : base(state, multicolumnHeader)
        {
            this.m_DataStore = dataStore;
            int num = base.multiColumnHeader.state.columns.Length;

            this.m_ColumnsInternal = new SerializedPropertyTreeView.ColumnInternal[num];
            for (int i = 0; i < num; i++)
            {
                SerializedPropertyTreeView.Column column = this.Col(i);
                if (column.propertyName != null)
                {
                    this.m_ColumnsInternal[i].dependencyProps = new SerializedProperty[column.propertyName.Length];
                }
            }
            base.multiColumnHeader.sortingChanged        += new MultiColumnHeader.HeaderCallback(this.OnSortingChanged);
            base.multiColumnHeader.visibleColumnsChanged += new MultiColumnHeader.HeaderCallback(this.OnVisibleColumnChanged);
            base.showAlternatingRowBackgrounds            = true;
            base.showBorder = true;
            base.rowHeight  = 18f;
        }
 public static SerializedPropertyTreeView.Column[] CreateLightProbeColumns(out string[] propNames)
 {
     SerializedPropertyTreeView.Column[] columns = new SerializedPropertyTreeView.Column[]
     {
         new SerializedPropertyTreeView.Column
         {
             headerContent         = LightTableColumns.Styles.Name,
             headerTextAlignment   = TextAlignment.Left,
             sortedAscending       = true,
             sortingArrowAlignment = TextAlignment.Center,
             width                 = 200f,
             minWidth              = 100f,
             autoResize            = false,
             allowToggleVisibility = true,
             propertyName          = null,
             dependencyIndices     = null,
             compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareName,
             drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawName,
             filter                = new SerializedPropertyFilters.Name()
         },
         new SerializedPropertyTreeView.Column
         {
             headerContent         = LightTableColumns.Styles.On,
             headerTextAlignment   = TextAlignment.Center,
             sortedAscending       = true,
             sortingArrowAlignment = TextAlignment.Center,
             width                 = 25f,
             minWidth              = 25f,
             maxWidth              = 25f,
             autoResize            = false,
             allowToggleVisibility = true,
             propertyName          = "m_Enabled",
             dependencyIndices     = null,
             compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareCheckbox,
             drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawCheckbox
         }
     };
     return(LightTableColumns.FinalizeColumns(columns, out propNames));
 }
        public static SerializedPropertyTreeView.Column[] CreateLightColumns(out string[] propNames)
        {
            SerializedPropertyTreeView.Column[] expr_07 = new SerializedPropertyTreeView.Column[8];
            expr_07[0] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Name,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 200f,
                minWidth              = 100f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = null,
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareName,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawName,
                filter                = new SerializedPropertyFilters.Name()
            };
            expr_07[1] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.On,
                headerTextAlignment   = TextAlignment.Center,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 25f,
                minWidth              = 25f,
                maxWidth              = 25f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Enabled",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareCheckbox,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawCheckbox
            };
            expr_07[2] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Type,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 120f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Type",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            int arg_21C_1 = 3;

            SerializedPropertyTreeView.Column column = new SerializedPropertyTreeView.Column();
            column.headerContent         = LightTableColumns.Styles.Mode;
            column.headerTextAlignment   = TextAlignment.Left;
            column.sortedAscending       = true;
            column.sortingArrowAlignment = TextAlignment.Center;
            column.width                 = 70f;
            column.minWidth              = 40f;
            column.maxWidth              = 70f;
            column.autoResize            = false;
            column.allowToggleVisibility = true;
            column.propertyName          = "m_Lightmapping";
            column.dependencyIndices     = new int[]
            {
                2
            };
            column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum;
            column.drawDelegate    = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dep)
            {
                LightModeUtil.Get().DrawElement(r, prop, dep[0]);
            };
            expr_07[arg_21C_1] = column;
            expr_07[4]         = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Color,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 70f,
                minWidth              = 40f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Color",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareColor,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[5] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Intensity,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 60f,
                minWidth              = 30f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Intensity",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[6] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.IndirectMultiplier,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 110f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_BounceIntensity",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[7] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.ShadowType,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 100f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Shadows.m_Type",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            SerializedPropertyTreeView.Column[] columns = expr_07;
            return(LightTableColumns.FinalizeColumns(columns, out propNames));
        }
        public static SerializedPropertyTreeView.Column[] CreateEmissivesColumns(out string[] propNames)
        {
            SerializedPropertyTreeView.Column[] expr_07 = new SerializedPropertyTreeView.Column[4];
            int arg_9B_1 = 0;

            SerializedPropertyTreeView.Column column = new SerializedPropertyTreeView.Column();
            column.headerContent         = LightTableColumns.Styles.SelectObjects;
            column.headerTextAlignment   = TextAlignment.Left;
            column.sortedAscending       = true;
            column.sortingArrowAlignment = TextAlignment.Center;
            column.width                 = 20f;
            column.minWidth              = 20f;
            column.maxWidth              = 20f;
            column.autoResize            = false;
            column.allowToggleVisibility = true;
            column.propertyName          = "m_LightmapFlags";
            column.dependencyIndices     = null;
            column.compareDelegate       = null;
            column.drawDelegate          = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dep)
            {
                if (GUI.Button(r, LightTableColumns.Styles.SelectObjectsButton, "label"))
                {
                    SearchableEditorWindow.SearchForReferencesToInstanceID(prop.serializedObject.targetObject.GetInstanceID());
                }
            };
            expr_07[arg_9B_1] = column;
            expr_07[1]        = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Name,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 200f,
                minWidth              = 100f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = null,
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareName,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawName,
                filter                = new SerializedPropertyFilters.Name()
            };
            int arg_1A6_1 = 2;

            column = new SerializedPropertyTreeView.Column();
            column.headerContent         = LightTableColumns.Styles.GlobalIllumination;
            column.headerTextAlignment   = TextAlignment.Left;
            column.sortedAscending       = true;
            column.sortingArrowAlignment = TextAlignment.Center;
            column.width                 = 120f;
            column.minWidth              = 70f;
            column.autoResize            = false;
            column.allowToggleVisibility = true;
            column.propertyName          = "m_LightmapFlags";
            column.dependencyIndices     = null;
            column.compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareInt;
            column.drawDelegate          = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dep)
            {
                if (prop.serializedObject.targetObject.GetType().Equals(typeof(Material)))
                {
                    using (new EditorGUI.DisabledScope(!LightTableColumns.IsEditable(prop.serializedObject.targetObject)))
                    {
                        MaterialGlobalIlluminationFlags materialGlobalIlluminationFlags = ((prop.intValue & 2) == 0) ? MaterialGlobalIlluminationFlags.RealtimeEmissive : MaterialGlobalIlluminationFlags.BakedEmissive;
                        int[] optionValues = new int[]
                        {
                            1,
                            2
                        };
                        EditorGUI.BeginChangeCheck();
                        materialGlobalIlluminationFlags = (MaterialGlobalIlluminationFlags)EditorGUI.IntPopup(r, (int)materialGlobalIlluminationFlags, LightTableColumns.Styles.LightmapEmissiveStrings, optionValues);
                        if (EditorGUI.EndChangeCheck())
                        {
                            Material material = (Material)prop.serializedObject.targetObject;
                            Undo.RecordObjects(new Material[]
                            {
                                material
                            }, "Modify GI Settings of " + material.name);
                            material.globalIlluminationFlags = materialGlobalIlluminationFlags;
                            prop.serializedObject.Update();
                        }
                    }
                }
            };
            expr_07[arg_1A6_1] = column;
            int arg_26F_1 = 3;

            column = new SerializedPropertyTreeView.Column();
            column.headerContent         = LightTableColumns.Styles.Intensity;
            column.headerTextAlignment   = TextAlignment.Left;
            column.sortedAscending       = true;
            column.sortingArrowAlignment = TextAlignment.Center;
            column.width                 = 70f;
            column.minWidth              = 40f;
            column.autoResize            = false;
            column.allowToggleVisibility = true;
            column.propertyName          = "m_Shader";
            column.dependencyIndices     = null;
            column.compareDelegate       = delegate(SerializedProperty lhs, SerializedProperty rhs)
            {
                float num;
                float num2;
                float num3;
                Color.RGBToHSV(((Material)lhs.serializedObject.targetObject).GetColor("_EmissionColor"), out num, out num2, out num3);
                float num4;
                float num5;
                float value;
                Color.RGBToHSV(((Material)rhs.serializedObject.targetObject).GetColor("_EmissionColor"), out num4, out num5, out value);
                return(num3.CompareTo(value));
            };
            column.drawDelegate = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dep)
            {
                if (prop.serializedObject.targetObject.GetType().Equals(typeof(Material)))
                {
                    using (new EditorGUI.DisabledScope(!LightTableColumns.IsEditable(prop.serializedObject.targetObject)))
                    {
                        Material             material             = (Material)prop.serializedObject.targetObject;
                        Color                color                = material.GetColor("_EmissionColor");
                        ColorPickerHDRConfig colorPickerHDRConfig = LightTableColumns.s_ColorPickerHDRConfig ?? ColorPicker.defaultHDRConfig;
                        EditorGUI.BeginChangeCheck();
                        Color value = EditorGUI.ColorBrightnessField(r, GUIContent.Temp(""), color, colorPickerHDRConfig.minBrightness, colorPickerHDRConfig.maxBrightness);
                        if (EditorGUI.EndChangeCheck())
                        {
                            Undo.RecordObjects(new Material[]
                            {
                                material
                            }, "Modify Color of " + material.name);
                            material.SetColor("_EmissionColor", value);
                        }
                    }
                }
            };
            column.copyDelegate = delegate(SerializedProperty target, SerializedProperty source)
            {
                Material material  = (Material)source.serializedObject.targetObject;
                Color    color     = material.GetColor("_EmissionColor");
                Material material2 = (Material)target.serializedObject.targetObject;
                material2.SetColor("_EmissionColor", color);
            };
            expr_07[arg_26F_1] = column;
            SerializedPropertyTreeView.Column[] columns = expr_07;
            return(LightTableColumns.FinalizeColumns(columns, out propNames));
        }
        public static SerializedPropertyTreeView.Column[] CreateReflectionColumns(out string[] propNames)
        {
            SerializedPropertyTreeView.Column[] expr_07 = new SerializedPropertyTreeView.Column[8];
            expr_07[0] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Name,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 200f,
                minWidth              = 100f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = null,
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareName,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawName,
                filter                = new SerializedPropertyFilters.Name()
            };
            expr_07[1] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.On,
                headerTextAlignment   = TextAlignment.Center,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 25f,
                minWidth              = 25f,
                maxWidth              = 25f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Enabled",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareCheckbox,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawCheckbox
            };
            int arg_192_1 = 2;

            SerializedPropertyTreeView.Column column = new SerializedPropertyTreeView.Column();
            column.headerContent         = LightTableColumns.Styles.Mode;
            column.headerTextAlignment   = TextAlignment.Left;
            column.sortedAscending       = true;
            column.sortingArrowAlignment = TextAlignment.Center;
            column.width                 = 70f;
            column.minWidth              = 40f;
            column.autoResize            = false;
            column.allowToggleVisibility = true;
            column.propertyName          = "m_Mode";
            column.dependencyIndices     = null;
            column.compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareInt;
            column.drawDelegate          = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dep)
            {
                EditorGUI.IntPopup(r, prop, ReflectionProbeEditor.Styles.reflectionProbeMode, ReflectionProbeEditor.Styles.reflectionProbeModeValues, GUIContent.none);
            };
            expr_07[arg_192_1] = column;
            int arg_220_1 = 3;

            column = new SerializedPropertyTreeView.Column();
            column.headerContent         = LightTableColumns.Styles.Projection;
            column.headerTextAlignment   = TextAlignment.Left;
            column.sortedAscending       = true;
            column.sortingArrowAlignment = TextAlignment.Center;
            column.width                 = 80f;
            column.minWidth              = 40f;
            column.autoResize            = false;
            column.allowToggleVisibility = true;
            column.propertyName          = "m_BoxProjection";
            column.dependencyIndices     = null;
            column.compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareCheckbox;
            column.drawDelegate          = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dep)
            {
                int[] optionValues = new int[]
                {
                    0,
                    1
                };
                prop.boolValue = (EditorGUI.IntPopup(r, (!prop.boolValue) ? 0 : 1, LightTableColumns.Styles.ProjectionStrings, optionValues) == 1);
            };
            expr_07[arg_220_1] = column;
            expr_07[4]         = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.HDR,
                headerTextAlignment   = TextAlignment.Center,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 35f,
                minWidth              = 35f,
                maxWidth              = 35f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_HDR",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareCheckbox,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawCheckbox
            };
            expr_07[5] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.ShadowDistance,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 110f,
                minWidth              = 50f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_ShadowDistance",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[6] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.NearPlane,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 70f,
                minWidth              = 30f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_NearClip",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[7] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.FarPlane,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 70f,
                minWidth              = 30f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_FarClip",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            SerializedPropertyTreeView.Column[] columns = expr_07;
            return(LightTableColumns.FinalizeColumns(columns, out propNames));
        }
示例#8
0
 private void CellGUI(Rect cellRect, SerializedPropertyTreeView.SerializedPropertyItem item, int columnIndex, ref TreeView.RowGUIArgs args)
 {
     Profiler.BeginSample("SerializedPropertyTreeView.CellGUI");
     base.CenterRectUsingSingleLineHeight(ref cellRect);
     SerializedPropertyDataStore.Data  data   = item.GetData();
     SerializedPropertyTreeView.Column column = (SerializedPropertyTreeView.Column)base.multiColumnHeader.GetColumn(columnIndex);
     if (column.drawDelegate == SerializedPropertyTreeView.DefaultDelegates.s_DrawName)
     {
         Profiler.BeginSample("SerializedPropertyTreeView.OnItemGUI.LabelField");
         TreeView.DefaultGUI.Label(cellRect, data.name, base.IsSelected(args.item.id), false);
         Profiler.EndSample();
     }
     else if (column.drawDelegate != null)
     {
         SerializedProperty[] properties = data.properties;
         int num = (column.dependencyIndices == null) ? 0 : column.dependencyIndices.Length;
         for (int i = 0; i < num; i++)
         {
             this.m_ColumnsInternal[columnIndex].dependencyProps[i] = properties[column.dependencyIndices[i]];
         }
         if (args.item.id == base.state.lastClickedID && base.HasFocus() && columnIndex == base.multiColumnHeader.state.visibleColumns[(base.multiColumnHeader.state.visibleColumns[0] != 0) ? 0 : 1])
         {
             GUI.SetNextControlName(SerializedPropertyTreeView.Styles.focusHelper);
         }
         SerializedProperty serializedProperty = data.properties[columnIndex];
         EditorGUI.BeginChangeCheck();
         Profiler.BeginSample("SerializedPropertyTreeView.OnItemGUI.drawDelegate");
         column.drawDelegate(cellRect, serializedProperty, this.m_ColumnsInternal[columnIndex].dependencyProps);
         Profiler.EndSample();
         if (EditorGUI.EndChangeCheck())
         {
             this.m_ChangedId = ((column.filter == null || !column.filter.Active()) ? this.m_ChangedId : GUIUtility.keyboardControl);
             data.Store();
             IList <int> selection = base.GetSelection();
             if (selection.Contains(data.objectId))
             {
                 IList <TreeViewItem> list = base.FindRows(selection);
                 Undo.RecordObjects((from r in list
                                     select((SerializedPropertyTreeView.SerializedPropertyItem)r).GetData().serializedObject.targetObject).ToArray <UnityEngine.Object>(), "Modify Multiple Properties");
                 foreach (TreeViewItem current in list)
                 {
                     if (current.id != args.item.id)
                     {
                         SerializedPropertyDataStore.Data data2 = ((SerializedPropertyTreeView.SerializedPropertyItem)current).GetData();
                         if (SerializedPropertyTreeView.IsEditable(data2.serializedObject.targetObject))
                         {
                             if (column.copyDelegate != null)
                             {
                                 column.copyDelegate(data2.properties[columnIndex], serializedProperty);
                             }
                             else
                             {
                                 SerializedPropertyTreeView.DefaultDelegates.s_CopyDefault(data2.properties[columnIndex], serializedProperty);
                             }
                             data2.Store();
                         }
                     }
                 }
             }
         }
         Profiler.EndSample();
     }
 }
示例#9
0
        public LightingExplorerTableColumn(DataType type, GUIContent headerContent, string propertyName = null, int width = 100, OnGUIDelegate onGUIDelegate = null, ComparePropertiesDelegate compareDelegate = null, CopyPropertiesDelegate copyDelegate = null, int[] dependencyIndices = null)
        {
            m_Column = new SerializedPropertyTreeView.Column();

            m_Column.headerContent     = headerContent;
            m_Column.width             = width;
            m_Column.minWidth          = width / 2;
            m_Column.propertyName      = propertyName;
            m_Column.dependencyIndices = dependencyIndices;

            m_Column.sortedAscending       = true;
            m_Column.sortingArrowAlignment = TextAlignment.Center;
            m_Column.autoResize            = false;
            m_Column.allowToggleVisibility = true;
            m_Column.headerTextAlignment   = type == DataType.Checkbox ? TextAlignment.Center : TextAlignment.Left;

            switch (type)
            {
            case DataType.Name:
                m_Column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.CompareName;
                m_Column.drawDelegate    = SerializedPropertyTreeView.DefaultDelegates.DrawName;
                m_Column.filter          = new SerializedPropertyFilters.Name();
                break;

            case DataType.Checkbox:
                m_Column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.CompareCheckbox;
                m_Column.drawDelegate    = SerializedPropertyTreeView.DefaultDelegates.DrawCheckbox;
                break;

            case DataType.Enum:
                m_Column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.CompareEnum;
                m_Column.drawDelegate    = SerializedPropertyTreeView.DefaultDelegates.DrawDefault;
                break;

            case DataType.Int:
                m_Column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.CompareInt;
                m_Column.drawDelegate    = SerializedPropertyTreeView.DefaultDelegates.DrawDefault;
                break;

            case DataType.Float:
                m_Column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.CompareFloat;
                m_Column.drawDelegate    = SerializedPropertyTreeView.DefaultDelegates.DrawDefault;
                break;

            case DataType.Color:
                m_Column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.CompareColor;
                m_Column.drawDelegate    = SerializedPropertyTreeView.DefaultDelegates.DrawDefault;
                break;

            default:
                break;
            }

            if (onGUIDelegate != null)
            {
                // when allowing the user to draw checkboxes, we will make sure that the rect is in the center
                if (type == DataType.Checkbox)
                {
                    m_Column.drawDelegate = (r, prop, dep) => {
                        float off = System.Math.Max(0.0f, ((r.width / 2) - 8));
                        r.x     += off;
                        r.width -= off;
                        onGUIDelegate(r, prop, dep);
                    };
                }
                else
                {
                    m_Column.drawDelegate = new SerializedPropertyTreeView.Column.DrawEntry(onGUIDelegate);
                }
            }

            if (compareDelegate != null)
            {
                m_Column.compareDelegate = new SerializedPropertyTreeView.Column.CompareEntry(compareDelegate);
            }

            if (copyDelegate != null)
            {
                m_Column.copyDelegate = new SerializedPropertyTreeView.Column.CopyDelegate(copyDelegate);
            }
        }
示例#10
0
        public static SerializedPropertyTreeView.Column[] CreateLightColumns(out string[] propNames)
        {
            SerializedPropertyTreeView.Column[] expr_07 = new SerializedPropertyTreeView.Column[8];
            expr_07[0] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Name,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 200f,
                minWidth              = 100f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = null,
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareName,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawName,
                filter                = new SerializedPropertyFilters.Name()
            };
            expr_07[1] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.On,
                headerTextAlignment   = TextAlignment.Center,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 25f,
                minWidth              = 25f,
                maxWidth              = 25f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Enabled",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareCheckbox,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawCheckbox
            };
            expr_07[2] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Type,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 120f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Type",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            int arg_21C_1 = 3;

            SerializedPropertyTreeView.Column column = new SerializedPropertyTreeView.Column();
            column.headerContent         = LightTableColumns.Styles.Mode;
            column.headerTextAlignment   = TextAlignment.Left;
            column.sortedAscending       = true;
            column.sortingArrowAlignment = TextAlignment.Center;
            column.width                 = 70f;
            column.minWidth              = 40f;
            column.maxWidth              = 70f;
            column.autoResize            = false;
            column.allowToggleVisibility = true;
            column.propertyName          = "m_Lightmapping";
            column.dependencyIndices     = new int[]
            {
                2
            };
            column.compareDelegate = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum;
            column.drawDelegate    = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dep)
            {
                bool disabled = dep.Length > 1 && dep[0].enumValueIndex == 3;
                using (new EditorGUI.DisabledScope(disabled))
                {
                    EditorGUI.BeginChangeCheck();
                    int intValue = EditorGUI.IntPopup(r, prop.intValue, LightTableColumns.Styles.LightmapBakeTypeTitles, LightTableColumns.Styles.LightmapBakeTypeValues);
                    if (EditorGUI.EndChangeCheck())
                    {
                        prop.intValue = intValue;
                    }
                }
            };
            expr_07[arg_21C_1] = column;
            expr_07[4]         = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Color,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 70f,
                minWidth              = 40f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Color",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareColor,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[5] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.Intensity,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 60f,
                minWidth              = 30f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Intensity",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[6] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.IndirectMultiplier,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 110f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_BounceIntensity",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareFloat,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            expr_07[7] = new SerializedPropertyTreeView.Column
            {
                headerContent         = LightTableColumns.Styles.ShadowType,
                headerTextAlignment   = TextAlignment.Left,
                sortedAscending       = true,
                sortingArrowAlignment = TextAlignment.Center,
                width                 = 100f,
                minWidth              = 60f,
                autoResize            = false,
                allowToggleVisibility = true,
                propertyName          = "m_Shadows.m_Type",
                dependencyIndices     = null,
                compareDelegate       = SerializedPropertyTreeView.DefaultDelegates.s_CompareEnum,
                drawDelegate          = SerializedPropertyTreeView.DefaultDelegates.s_DrawDefault
            };
            SerializedPropertyTreeView.Column[] columns = expr_07;
            return(LightTableColumns.FinalizeColumns(columns, out propNames));
        }