Skip to content

Commit dcabbc1

Browse files
author
JS Fauteux
committed
Merge branch 'develop' into feature/profiler_override
2 parents 4b772fc + 3186255 commit dcabbc1

77 files changed

Lines changed: 6260 additions & 1048 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ We accept changes and improvements to our documentation. Just submit a Pull Requ
4242

4343
## <a name="cla"></a> Contributor License Agreements
4444

45-
When you open a pull request, you will be asked to acknolwedge our Contributor License Agreement. We allow both individual contributions and contributions made on behalf of companies. We use an open source tool called CLA assistant. If you have any questions on our CLA, please submit an issue
45+
When you open a pull request, you will be asked to enter into Unity's License Agreement which is based on The Apache Software Foundation's contribution agreement. We allow both individual contributions and contributions made on behalf of companies. We use an open source tool called CLA assistant. If you have any questions on our CLA, please submit an issue
4646

4747
## <a name="submit-pr"></a> Pull Request Submission Guidelines
4848

com.unity.multiplayer.mlapi/Editor/NetworkedAnimatorEditor.cs

Lines changed: 39 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,92 +9,70 @@ namespace UnityEditor
99
[CanEditMultipleObjects]
1010
public class NetworkAnimatorEditor : Editor
1111
{
12-
// TODO @mfatihmar (Unity): Re-implement this after `NetworkedAnimator` re-implementation
13-
/*
14-
private NetworkedAnimator networkedAnimatorTarget;
12+
private NetworkedAnimator m_Target;
13+
1514
[NonSerialized]
16-
private bool initialized;
15+
private bool m_Initialized;
1716

18-
private SerializedProperty animatorProperty;
19-
private GUIContent animatorLabel;
17+
private SerializedProperty m_AnimatorProperty;
18+
private GUIContent m_AnimatorLabel;
2019

21-
void Init()
20+
private void Initialize()
2221
{
23-
if (initialized)
24-
return;
25-
26-
initialized = true;
27-
networkedAnimatorTarget = target as NetworkedAnimator;
22+
if (m_Initialized) return;
2823

29-
animatorProperty = serializedObject.FindProperty("_animator");
30-
animatorLabel = new GUIContent("Animator", "The Animator component to synchronize.");
31-
}
24+
m_Initialized = true;
25+
m_Target = target as NetworkedAnimator;
3226

33-
public override void OnInspectorGUI()
34-
{
35-
Init();
36-
serializedObject.Update();
37-
DrawControls();
38-
serializedObject.ApplyModifiedProperties();
27+
m_AnimatorProperty = serializedObject.FindProperty("m_Animator");
28+
m_AnimatorLabel = new GUIContent("Animator", "The Animator component to synchronize.");
3929
}
4030

41-
void DrawControls()
31+
private void DrawControls()
4232
{
4333
EditorGUI.BeginChangeCheck();
44-
EditorGUILayout.PropertyField(animatorProperty, animatorLabel);
34+
EditorGUILayout.PropertyField(m_AnimatorProperty, m_AnimatorLabel);
35+
if (EditorGUI.EndChangeCheck()) m_Target.ResetTrackedParams();
4536

46-
if (EditorGUI.EndChangeCheck())
47-
networkedAnimatorTarget.ResetParameterOptions();
37+
var animator = m_Target.animator;
38+
if (ReferenceEquals(animator, null)) return;
4839

49-
if (networkedAnimatorTarget.animator == null)
50-
return;
40+
var animatorController = animator.runtimeAnimatorController as AnimatorController;
41+
if (ReferenceEquals(animatorController, null)) return;
5142

52-
var controller = networkedAnimatorTarget.animator.runtimeAnimatorController as AnimatorController;
53-
if (controller != null)
43+
EditorGUI.indentLevel += 1;
44+
var showWarning = false;
5445
{
55-
var showWarning = false;
56-
EditorGUI.indentLevel += 1;
57-
int i = 0;
58-
59-
foreach (var p in controller.parameters)
46+
int paramIndex = 0;
47+
foreach (var animParam in animatorController.parameters)
6048
{
61-
if (i >= 32)
49+
if (paramIndex >= 32)
6250
{
6351
showWarning = true;
6452
break;
6553
}
6654

67-
bool oldSend = networkedAnimatorTarget.GetParameterAutoSend(i);
68-
bool send = EditorGUILayout.Toggle(p.name, oldSend);
69-
if (send != oldSend)
55+
bool wasTracking = m_Target.GetParamTracking(paramIndex);
56+
bool isTracking = EditorGUILayout.Toggle(animParam.name, wasTracking);
57+
if (isTracking != wasTracking)
7058
{
71-
networkedAnimatorTarget.SetParameterAutoSend(i, send);
59+
m_Target.SetParamTracking(paramIndex, isTracking);
7260
EditorUtility.SetDirty(target);
7361
}
74-
i += 1;
75-
}
7662

77-
if (showWarning)
78-
EditorGUILayout.HelpBox("NetworkAnimator can only select between the first 32 parameters in a mecanim controller", MessageType.Warning);
79-
80-
EditorGUI.indentLevel -= 1;
63+
paramIndex++;
64+
}
8165
}
66+
if (showWarning) EditorGUILayout.HelpBox("NetworkAnimator can only select between the first 32 parameters in a mecanim controller", MessageType.Warning);
67+
EditorGUI.indentLevel -= 1;
68+
}
8269

83-
if (Application.isPlaying)
84-
{
85-
EditorGUILayout.Separator();
86-
if (networkedAnimatorTarget.param0 != "")
87-
EditorGUILayout.LabelField("Param 0", networkedAnimatorTarget.param0);
88-
if (networkedAnimatorTarget.param1 != "")
89-
EditorGUILayout.LabelField("Param 1", networkedAnimatorTarget.param1);
90-
if (networkedAnimatorTarget.param2 != "")
91-
EditorGUILayout.LabelField("Param 2", networkedAnimatorTarget.param2);
92-
if (networkedAnimatorTarget.param3 != "")
93-
EditorGUILayout.LabelField("Param 3", networkedAnimatorTarget.param3);
94-
if (networkedAnimatorTarget.param4 != "")
95-
EditorGUILayout.LabelField("Param 4", networkedAnimatorTarget.param4);
96-
}
70+
public override void OnInspectorGUI()
71+
{
72+
Initialize();
73+
serializedObject.Update();
74+
DrawControls();
75+
serializedObject.ApplyModifiedProperties();
9776
}
98-
*/
9977
}
100-
}
78+
}

0 commit comments

Comments
 (0)