public static Foundation.CSGOperationType ChooseOperation(Foundation.CSGOperationType operation, bool mixedValues)
        {
            CSG_GUIStyleUtility.InitStyles();

            var rcsgSkin = CSG_GUIStyleUtility.Skin;

            if (rcsgSkin == null)
            {
                return(operation);
            }

            var oldColor = GUI.color;

            GUI.color = Color.white;

            GUILayout.BeginVertical();
            try
            {
                GUIContent content;
                GUIStyle   style;
                bool       have_selection = !mixedValues && GUI.enabled;
                for (int i = 0; i < CSG_GUIStyleUtility.operationTypeCount; i++)
                {
                    if (!have_selection || (int)operation != i)
                    {
                        content = rcsgSkin.operationNames[i];
                        style   = CSG_GUIStyleUtility.unselectedIconLabelStyle;
                    }
                    else
                    {
                        content = rcsgSkin.operationNamesOn[i];
                        style   = CSG_GUIStyleUtility.selectedIconLabelStyle;
                    }
                    if (content == null || style == null)
                    {
                        continue;
                    }
                    if (GUILayout.Button(content, style))
                    {
                        operation   = (Foundation.CSGOperationType)i;
                        GUI.changed = true;
                    }
                    TooltipUtility.SetToolTip(CSG_GUIStyleUtility.operationTooltip[i]);
                }
            }
            finally
            {
                GUILayout.EndVertical();
            }

            GUI.color = oldColor;
            return(operation);
        }
        public static void ModifyOperationsOnSelected(Foundation.CSGOperationType operationType)
        {
            var modified = false;

            foreach (var gameObject in Selection.gameObjects)
            {
                var obj = gameObject.GetComponent(CSGBrushType);
                if (obj)
                {
                    var brush = obj as CSGBrush;
                    if (brush.OperationType != operationType)
                    {
                        modified = true;
                        Undo.RecordObject(brush, "Modifying csg operation of brush component");
                        brush.OperationType = operationType;
                    }
                }

                obj = gameObject.GetComponent(CSGOperationType);
                if (obj)
                {
                    var operation = obj as CSGOperation;
                    if (operation.OperationType == operationType)
                    {
                        continue;
                    }

                    modified = true;
                    Undo.RecordObject(operation, "Modifying csg operation of operation component");
                    operation.PassThrough   = false;
                    operation.OperationType = operationType;
                }
            }
            if (modified)
            {
                InternalCSGModelManager.CheckForChanges();
                EditorApplication.RepaintHierarchyWindow();
            }
        }