public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty uv0Prop = property.FindPropertyRelative(nameof(SurfaceDescription.UV0)); SerializedProperty surfaceFlagsProp = property.FindPropertyRelative(nameof(SurfaceDescription.surfaceFlags)); SerializedProperty smoothingGroupProp = property.FindPropertyRelative(nameof(SurfaceDescription.smoothingGroup)); EditorGUI.BeginProperty(position, label, property); bool prevShowMixedValue = EditorGUI.showMixedValue; try { position.height = SurfaceFlagsPropertyDrawer.DefaultHeight; EditorGUI.PropertyField(position, surfaceFlagsProp, kSurfaceFlagsContents, false); position.y += position.height + kSpacing; position.height = UVMatrixPropertyDrawer.DefaultHeight; EditorGUI.PropertyField(position, uv0Prop, kUV0Contents, false); position.y += position.height + kSpacing; position.height = SmoothingGroupPropertyDrawer.GetDefaultHeight(smoothingGroupProp.propertyPath, true); EditorGUI.PropertyField(position, smoothingGroupProp, kSmoothingGroupContents, false); } catch (ExitGUIException) { } catch (Exception ex) { Debug.LogException(ex); } EditorGUI.showMixedValue = prevShowMixedValue; EditorGUI.EndProperty(); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { SerializedProperty smoothingGroupProp = property.FindPropertyRelative(nameof(SurfaceDescription.smoothingGroup)); return(UVMatrixPropertyDrawer.DefaultHeight + kSpacing + SurfaceFlagsPropertyDrawer.DefaultHeight + kSpacing + SmoothingGroupPropertyDrawer.GetDefaultHeight(smoothingGroupProp.propertyPath, true)); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { if (ChiselNodeEditorBase.InSceneSettingsContext) { return(0); } SerializedProperty smoothingGroupProp = property.FindPropertyRelative(nameof(SurfaceDescription.smoothingGroup)); return(UVMatrixPropertyDrawer.DefaultHeight + kSpacing + SurfaceFlagsPropertyDrawer.DefaultHeight + kSpacing + SmoothingGroupPropertyDrawer.GetDefaultHeight(smoothingGroupProp.propertyPath, true)); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (ChiselNodeEditorBase.InSceneSettingsContext) { EditorGUI.BeginProperty(position, label, property); EditorGUI.EndProperty(); return; } var hasLabel = ChiselGUIUtility.LabelHasContent(label); SerializedProperty uv0Prop = property.FindPropertyRelative(nameof(SurfaceDescription.UV0)); SerializedProperty surfaceFlagsProp = property.FindPropertyRelative(nameof(SurfaceDescription.surfaceFlags)); SerializedProperty smoothingGroupProp = property.FindPropertyRelative(nameof(SurfaceDescription.smoothingGroup)); EditorGUI.BeginProperty(position, label, property); bool prevShowMixedValue = EditorGUI.showMixedValue; try { property.serializedObject.Update(); EditorGUI.BeginChangeCheck(); { position.height = SurfaceFlagsPropertyDrawer.DefaultHeight; EditorGUI.PropertyField(position, surfaceFlagsProp, !hasLabel ? GUIContent.none : kSurfaceFlagsContents, false); position.y += position.height + kSpacing; position.height = UVMatrixPropertyDrawer.DefaultHeight; EditorGUI.PropertyField(position, uv0Prop, !hasLabel ? GUIContent.none : kUV0Contents, false); position.y += position.height + kSpacing; position.height = SmoothingGroupPropertyDrawer.GetDefaultHeight(smoothingGroupProp.propertyPath, true); EditorGUI.PropertyField(position, smoothingGroupProp, !hasLabel ? GUIContent.none : kSmoothingGroupContents, false); } if (EditorGUI.EndChangeCheck()) { property.serializedObject.ApplyModifiedProperties(); } } catch (ExitGUIException) { } catch (Exception ex) { Debug.LogException(ex); } EditorGUI.showMixedValue = prevShowMixedValue; EditorGUI.EndProperty(); }