public CInspectorControlInfo(Type type, CObjectProperty property, CCategoryInfo category, BaseInspectorControl control, InspectorPropertyName nameControl)
 {
     categoryInfo        = category;
     inspectorControl    = control;
     valueType           = type;
     objectProperty      = property;
     propertyNameControl = nameControl;
 }
        public void ShowInspectors(IEnumerable <CObjectBase> baseInfos)
        {
            if (m_bLocked)
            {
                return;
            }

            inspectorTypes.Clear();
            supportedProperties.Clear();

            foreach (var baseObj in baseInfos)
            {
                if (baseObj is CObjectProperty prop)
                {
                    if (GetInspectorType(prop.ValueType, out InspectorType outResult))
                    {
                        inspectorTypes.Add(outResult);
                        supportedProperties.Add(prop);
                    }
                }
                else if (baseObj is CObjectFunction func)
                {
                }
            }

            bool bValidLayout = !m_bLayoutInvalidated;

            bValidLayout &= m_controls.Count == inspectorTypes.Count;

            if (bValidLayout)
            {
                for (int i = 0, count = m_controls.Count; i < count; i++)
                {
                    Type existingType = m_controls[i].objectProperty.ValueType;

                    if (!supportedProperties[i].Category.Equals(m_controls[i].categoryInfo) || supportedProperties[i].ValueType != existingType)
                    {
                        bValidLayout = false;
                        break;
                    }
                }
            }

            if (bValidLayout)
            {
                //Reuse layout
                for (int i = 0, count = m_controls.Count; i < count; i++)
                {
                    CInspectorControlInfo info = m_controls[i];
                    info.objectProperty = supportedProperties[i];
                    info.inspectorControl.PropertyInfoChanged(info.objectProperty);
                    info.propertyNameControl.PropertyInfoChanged(info.objectProperty);
                }
            }
            else
            {
                ClearInspector();

                for (int i = 0, count = supportedProperties.Count; i < count; i++)
                {
                    CObjectProperty property = supportedProperties[i];

                    CBaseInspectorCategory categoryControl = null;
                    if (!m_categoryMap.TryGetValue(property.Category, out categoryControl))
                    {
                        if (UseSimpleCategoryDisplay)
                        {
                            categoryControl = new SimpleInspectorCategory(property.Category, this);
                        }
                        else
                        {
                            categoryControl = new ExpandableInspectorCategory(property.Category, this);
                        }

                        m_categoryMap.Add(property.Category, categoryControl);
                        m_categories.Add(categoryControl);

                        if (m_categoryLeftColumnSize.HasValue)
                        {
                            categoryControl.ResizeColumns(m_categoryLeftColumnSize.Value);
                        }
                    }

                    Type inspectorControlType = inspectorTypes[i].controlType;
                    BaseInspectorControl newPropertyInspector = (BaseInspectorControl)Activator.CreateInstance(inspectorControlType);
                    newPropertyInspector.Init(this);
                    newPropertyInspector.PropertyInfoChanged(property);

                    InspectorPropertyName newNameControl = new InspectorPropertyName(property, inspectorTypes[i].defaultValue, property.Name, newPropertyInspector);
                    CInspectorControlInfo info           = new CInspectorControlInfo(inspectorControlType, property, property.Category, newPropertyInspector, newNameControl);
                    categoryControl.AddPropertyInspector(newPropertyInspector, newNameControl);

                    m_controls.Add(info);
                }

                List <CBaseInspectorCategory> categories = new List <CBaseInspectorCategory>(m_categories);
                int Comp(CBaseInspectorCategory x, CBaseInspectorCategory y)
                {
                    return(x.Priority - y.Priority);
                }

                categories.Sort(Comp);
                CategoryPanel.Children.Clear();

                foreach (var element in categories)
                {
                    CategoryPanel.Children.Add(element);
                }
            }

            m_currentlyDisplayedList = baseInfos;
            m_bLayoutInvalidated     = false;
        }