示例#1
0
 public override void OnSceneSettingsGUI()
 {
     GUILayout.BeginVertical();
     {
         EnsureInitialized();
         if (serializedObject != null)
         {
             var prevGUIChanged = GUI.changed;
             GUI.changed = false;
             serializedObject.Update();
             var prevLabelWidth = EditorGUIUtility.labelWidth;
             try
             {
                 EditorGUIUtility.labelWidth = 115;
                 // This renders our placementToolDefinition like in the inspector, but excludes the properties named in excludeProperties
                 DrawPropertiesExcluding(serializedObject, excludeProperties);
             } catch (Exception ex)
             {
                 Debug.LogException(ex);
             }
             if (GUI.changed)
             {
                 EditorGUIUtility.labelWidth = prevLabelWidth;
                 serializedObject.ApplyModifiedProperties();
                 prevGUIChanged = true;
             }
             GUI.changed = prevGUIChanged;
         }
         ChiselCompositeGUI.ChooseGeneratorOperation(ref forceOperation);
     }
     GUILayout.EndVertical();
 }
        public void ShowInspectorHeader(SerializedProperty operationProp)
        {
            GUILayout.Space(3);
            const float kBottomPadding = 3;
            var         rect           = EditorGUILayout.GetControlRect(hasLabel: false, height: EditorGUIUtility.singleLineHeight + kBottomPadding);

            rect.yMax -= kBottomPadding;
            var buttonRect = rect;

            buttonRect.xMax -= ChiselCompositeGUI.GetOperationChoicesInternalWidth(showAuto: false);
            if (typeof(T) != typeof(ChiselBrush))
            {
                ConvertIntoBrushesButton(buttonRect, serializedObject);
                ChiselCompositeGUI.ShowOperationChoicesInternal(rect, operationProp, showLabel: false);
            }
            else
            {
                ChiselCompositeGUI.ShowOperationChoicesInternal(rect, operationProp, showLabel: true);
            }
        }
        public static void ChooseGeneratorOperation(ref CSGOperationType?operation)
        {
            if (styles == null)
            {
                styles = new Styles();
            }

            const float kBottomPadding = 3;
            var         rect           = EditorGUILayout.GetControlRect(hasLabel: true, height: EditorGUIUtility.singleLineHeight + kBottomPadding);

            rect.yMax -= kBottomPadding;
            EditorGUI.BeginChangeCheck();
            rect.yMin += 2;
            EditorGUI.PrefixLabel(rect, EditorGUIUtility.TrTextContent("Operation"));
            rect.yMin -= 2;
            var result = ChiselCompositeGUI.ShowOperationChoicesInternal(rect, operation);

            if (EditorGUI.EndChangeCheck())
            {
                operation = result;
            }
        }