// -------------------------------------------------------------------- private void FillComponentInspectors(SceneObject obj) { obj.ForEachComponent((c) => { if (!mInspectors.ContainsKey(c.GetType())) { return; } Type inspectorType = mInspectors[c.GetType()]; if (inspectorType != null) { object objectToInspect = Activator.CreateInstance(inspectorType, c); InspectorControl inspectorControl = null; if (objectToInspect is InspectorControl) { inspectorControl = (InspectorControl)Activator.CreateInstance(inspectorType, c); } Control control; if (inspectorControl == null && objectToInspect is IPropertyInspector) { control = CreatePropertyInspector((IPropertyInspector)objectToInspect); } else { control = inspectorControl; inspectorControl.InspectorChanged += OnObjectInspectorChanged; } if (control != null) { tableLayoutPanel.Controls.Add(control); } } }); }