Skip to content

Commit

Permalink
#180 - ReadOnly attribute is now a meta attribute so that it can be c…
Browse files Browse the repository at this point in the history
…ombined with drawer attributes
  • Loading branch information
dbrizov committed Apr 24, 2021
1 parent 0c4ba80 commit ce8eaf2
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 71 deletions.
33 changes: 17 additions & 16 deletions Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 23
m_RootOrder: 22
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114650325
MonoBehaviour:
Expand Down Expand Up @@ -315,7 +315,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 12
m_RootOrder: 26
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &237121642
MonoBehaviour:
Expand Down Expand Up @@ -411,7 +411,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 22
m_RootOrder: 21
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &572382751
MonoBehaviour:
Expand Down Expand Up @@ -554,7 +554,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 20
m_RootOrder: 19
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &779670086
GameObject:
Expand Down Expand Up @@ -633,7 +633,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 15
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &892661556
MonoBehaviour:
Expand Down Expand Up @@ -681,7 +681,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 16
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &933563386
MonoBehaviour:
Expand Down Expand Up @@ -841,7 +841,6 @@ Transform:
- {fileID: 155697336}
- {fileID: 607441874}
- {fileID: 948946034}
- {fileID: 237121641}
- {fileID: 1747151588}
- {fileID: 1202167595}
- {fileID: 892661555}
Expand All @@ -856,6 +855,7 @@ Transform:
- {fileID: 1524906391}
- {fileID: 1293624596}
- {fileID: 1871127830}
- {fileID: 237121641}
- {fileID: 1641427334}
- {fileID: 1706612702}
- {fileID: 369789277}
Expand Down Expand Up @@ -966,7 +966,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 18
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1194502639
MonoBehaviour:
Expand Down Expand Up @@ -1009,7 +1009,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 14
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1202167596
MonoBehaviour:
Expand Down Expand Up @@ -1081,7 +1081,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 25
m_RootOrder: 24
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1293624597
MonoBehaviour:
Expand Down Expand Up @@ -1129,7 +1129,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 19
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1380469386
MonoBehaviour:
Expand Down Expand Up @@ -1224,6 +1224,7 @@ Light:
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1444377591
Expand Down Expand Up @@ -1318,7 +1319,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 24
m_RootOrder: 23
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1524906392
MonoBehaviour:
Expand Down Expand Up @@ -1673,7 +1674,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 13
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1747151589
MonoBehaviour:
Expand Down Expand Up @@ -1734,7 +1735,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 21
m_RootOrder: 20
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1784643786
MonoBehaviour:
Expand Down Expand Up @@ -1787,7 +1788,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 26
m_RootOrder: 25
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1871127831
MonoBehaviour:
Expand Down Expand Up @@ -1835,7 +1836,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1148579784}
m_RootOrder: 17
m_RootOrder: 16
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1989156460
MonoBehaviour:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ReadOnlyAttribute : DrawerAttribute
public class ReadOnlyAttribute : MetaAttribute
{

}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public static void CallOnValueChangedCallbacks(SerializedProperty property)

public static bool IsEnabled(SerializedProperty property)
{
ReadOnlyAttribute readOnlyAttribute = GetAttribute<ReadOnlyAttribute>(property);
if (readOnlyAttribute != null)
{
return false;
}

EnableIfAttributeBase enableIfAttribute = GetAttribute<EnableIfAttributeBase>(property);
if (enableIfAttribute == null)
{
Expand Down
2 changes: 2 additions & 0 deletions Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class ReadOnlyTest : MonoBehaviour
public class ReadOnlyNest1
{
[ReadOnly]
[AllowNesting]
public float readOnlyFloat = 3.14f;

public ReadOnlyNest2 nest2;
Expand All @@ -23,6 +24,7 @@ public class ReadOnlyNest1
public struct ReadOnlyNest2
{
[ReadOnly]
[AllowNesting]
public string readOnlyString;
}
}
10 changes: 5 additions & 5 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.collab-proxy": "1.3.9",
"com.unity.ide.visualstudio": "2.0.5",
"com.unity.test-framework": "1.1.19",
"com.unity.textmeshpro": "3.0.3",
"com.unity.timeline": "1.3.6",
"com.unity.ide.visualstudio": "2.0.7",
"com.unity.test-framework": "1.1.24",
"com.unity.textmeshpro": "3.0.4",
"com.unity.timeline": "1.5.4",
"com.unity.ugui": "1.0.0",
"com.unity.xr.legacyinputhelpers": "2.1.6",
"com.unity.xr.legacyinputhelpers": "2.1.7",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
30 changes: 20 additions & 10 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,34 @@
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.5",
"version": "1.0.6",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.5",
"version": "2.0.7",
"depth": 0,
"source": "registry",
"dependencies": {},
"dependencies": {
"com.unity.test-framework": "1.1.9"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.19",
"version": "1.1.24",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.ext.nunit": "1.0.5",
"com.unity.ext.nunit": "1.0.6",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.textmeshpro": {
"version": "3.0.3",
"version": "3.0.4",
"depth": 0,
"source": "registry",
"dependencies": {
Expand All @@ -54,10 +56,15 @@
"url": "https://packages.unity.com"
},
"com.unity.timeline": {
"version": "1.3.6",
"version": "1.5.4",
"depth": 0,
"source": "registry",
"dependencies": {},
"dependencies": {
"com.unity.modules.director": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.ugui": {
Expand All @@ -70,10 +77,13 @@
}
},
"com.unity.xr.legacyinputhelpers": {
"version": "2.1.6",
"version": "2.1.7",
"depth": 0,
"source": "registry",
"dependencies": {},
"dependencies": {
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.xr": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.modules.ai": {
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2020.2.1f1
m_EditorVersionWithRevision: 2020.2.1f1 (270dd8c3da1c)
m_EditorVersion: 2021.1.4f1
m_EditorVersionWithRevision: 2021.1.4f1 (4cd64a618c1b)

0 comments on commit ce8eaf2

Please sign in to comment.