Move third party assets to ThirdParty folder
This commit is contained in:
48
Assets/ThirdParty/UltimateXR/Editor/Attributes/HideInNormalInspectorPropertyDrawer.cs
vendored
Normal file
48
Assets/ThirdParty/UltimateXR/Editor/Attributes/HideInNormalInspectorPropertyDrawer.cs
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="HideInNormalInspectorPropertyDrawer.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.Attributes;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UltimateXR.Editor.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom property drawer for inspector fields that use the HideInNormalInspector attribute.
|
||||
/// From https://answers.unity.com/questions/157775/hide-from-inspector-interface-but-not-from-the-deb.html
|
||||
/// </summary>
|
||||
[CustomPropertyDrawer(typeof(HideInNormalInspectorAttribute))]
|
||||
public class HideInNormalInspectorPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
#region Public Overrides PropertyDrawer
|
||||
|
||||
/// <summary>
|
||||
/// Called when the GUI wants to know the height needed to draw the property.
|
||||
/// </summary>
|
||||
/// <param name="property">SerializedProperty that needs to be drawn</param>
|
||||
/// <param name="label">Label used</param>
|
||||
/// <returns>Height in pixels</returns>
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
// Even if GetPropertyHeight() returns 0, sometimes it displays a single row of pixels.
|
||||
// We avoid this by showing an empty label.
|
||||
EditorGUI.BeginProperty(position, new GUIContent(""), property);
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/UltimateXR/Editor/Attributes/HideInNormalInspectorPropertyDrawer.cs.meta
vendored
Normal file
11
Assets/ThirdParty/UltimateXR/Editor/Attributes/HideInNormalInspectorPropertyDrawer.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47f3a00b24bb6ee4fb7afd366cc4df5a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Assets/ThirdParty/UltimateXR/Editor/Attributes/ReadOnlyPropertyDrawer.cs
vendored
Normal file
60
Assets/ThirdParty/UltimateXR/Editor/Attributes/ReadOnlyPropertyDrawer.cs
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="ReadOnlyPropertyDrawer.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.Attributes;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UltimateXR.Editor.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom property drawer for inspector fields that use the ReadOnly attribute.
|
||||
/// </summary>
|
||||
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
|
||||
public class ReadOnlyPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
#region Public Overrides PropertyDrawer
|
||||
|
||||
/// <summary>
|
||||
/// Called when the GUI wants to know the height needed to draw the property.
|
||||
/// </summary>
|
||||
/// <param name="property">SerializedProperty that needs to be drawn</param>
|
||||
/// <param name="label">Label used</param>
|
||||
/// <returns>Height in pixels</returns>
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var roAttr = (ReadOnlyAttribute)attribute;
|
||||
|
||||
return Application.isPlaying ? roAttr.HideInPlayMode ? 0 : EditorGUIUtility.singleLineHeight :
|
||||
roAttr.HideInEditMode ? 0 : EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Called when the GUI needs to draw the property.
|
||||
/// </summary>
|
||||
/// <param name="position">GUI position</param>
|
||||
/// <param name="property">Property to draw</param>
|
||||
/// <param name="label">Property label</param>
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var roAttr = (ReadOnlyAttribute)attribute;
|
||||
|
||||
if (roAttr.HideInEditMode && !Application.isPlaying)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GUI.enabled = !Application.isPlaying && roAttr.OnlyWhilePlaying;
|
||||
EditorGUI.PropertyField(position, property, label);
|
||||
GUI.enabled = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/UltimateXR/Editor/Attributes/ReadOnlyPropertyDrawer.cs.meta
vendored
Normal file
11
Assets/ThirdParty/UltimateXR/Editor/Attributes/ReadOnlyPropertyDrawer.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4555f79d196764240a3a598274214168
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user