protected override void OnItemClick(Object selectedObject) { if (selectedObject is Material) { CSGModel activeModel = CSGModel.GetActiveCSGModel(); if (activeModel != null) { SurfaceEditor surfaceEditor = (SurfaceEditor)activeModel.GetTool(MainMode.Face); surfaceEditor.SetSelectionMaterial((Material)selectedObject); } } }