@@ -75,7 +75,7 @@ private TreeViewItem AddGameObjectToHierarchy(GameObject gameObject, GameObject
75
75
// Don't show for the root go
76
76
if ( curveBinding . path != "" )
77
77
{
78
- TreeViewItem newNode = CreateNode ( singleObjectBindings . ToArray ( ) , node ) ;
78
+ TreeViewItem newNode = CreateNode ( singleObjectBindings . ToArray ( ) , node , null ) ;
79
79
if ( newNode != null )
80
80
childNodes . Add ( newNode ) ;
81
81
singleObjectBindings . Clear ( ) ;
@@ -111,20 +111,6 @@ private TreeViewItem AddGameObjectToHierarchy(GameObject gameObject, GameObject
111
111
}
112
112
}
113
113
114
- var animator = rootGameObject . GetComponent < Animator > ( ) ;
115
- if ( animator != null )
116
- {
117
- //If the Animator has a human avatar, we need to check if the avatar's hierarchy matches that of the current GameObject. If they do not match, disable the node.
118
- if ( animator . avatarRoot != null && animator . isHuman )
119
- {
120
- if ( animator . avatarRoot . Find ( path ) == null )
121
- {
122
- node . propertyPathMismatchWithHumanAvatar = true ;
123
- }
124
- }
125
- }
126
-
127
-
128
114
if ( showEntireHierarchy )
129
115
{
130
116
// Iterate over all child GOs
@@ -137,6 +123,13 @@ private TreeViewItem AddGameObjectToHierarchy(GameObject gameObject, GameObject
137
123
}
138
124
}
139
125
126
+ // Remove Leaf nodes without properties.
127
+ if ( childNodes . Count == 0 )
128
+ {
129
+ node . parent = null ;
130
+ return null ;
131
+ }
132
+
140
133
TreeViewUtility . SetChildParentReferences ( childNodes , node ) ;
141
134
return node ;
142
135
}
@@ -191,17 +184,24 @@ private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBi
191
184
192
185
List < TreeViewItem > childNodes = new List < TreeViewItem > ( ) ;
193
186
List < EditorCurveBinding > singlePropertyBindings = new List < EditorCurveBinding > ( ) ;
187
+ SerializedObject so = null ;
194
188
195
189
for ( int i = 0 ; i < curveBindings . Length ; i ++ )
196
190
{
197
191
EditorCurveBinding curveBinding = curveBindings [ i ] ;
192
+ if ( curveBinding . isSerializeReferenceCurve )
193
+ {
194
+ var animatedObject = AnimationUtility . GetAnimatedObject ( AddCurvesPopup . s_State . activeRootGameObject , curveBinding ) ;
195
+ if ( animatedObject != null && ( so == null || so . targetObject != animatedObject ) )
196
+ so = new SerializedObject ( animatedObject ) ;
197
+ }
198
198
199
199
singlePropertyBindings . Add ( curveBinding ) ;
200
200
201
201
// We expect curveBindings to come sorted by propertyname
202
202
if ( i == curveBindings . Length - 1 || AnimationWindowUtility . GetPropertyGroupName ( curveBindings [ i + 1 ] . propertyName ) != AnimationWindowUtility . GetPropertyGroupName ( curveBinding . propertyName ) )
203
203
{
204
- TreeViewItem newNode = CreateNode ( singlePropertyBindings . ToArray ( ) , node ) ;
204
+ TreeViewItem newNode = CreateNode ( singlePropertyBindings . ToArray ( ) , node , so ) ;
205
205
if ( newNode != null )
206
206
childNodes . Add ( newNode ) ;
207
207
singlePropertyBindings . Clear ( ) ;
@@ -214,9 +214,9 @@ private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBi
214
214
return node ;
215
215
}
216
216
217
- private TreeViewItem CreateNode ( EditorCurveBinding [ ] curveBindings , TreeViewItem parentNode )
217
+ private TreeViewItem CreateNode ( EditorCurveBinding [ ] curveBindings , TreeViewItem parentNode , SerializedObject so )
218
218
{
219
- var node = new AddCurvesPopupPropertyNode ( parentNode , curveBindings ) ;
219
+ var node = new AddCurvesPopupPropertyNode ( parentNode , curveBindings , AnimationWindowUtility . GetNicePropertyDisplayName ( curveBindings [ 0 ] , so ) ) ;
220
220
221
221
// For RectTransform.position we only want .z
222
222
if ( AnimationWindowUtility . IsRectTransformPosition ( node . curveBindings [ 0 ] ) )
@@ -234,7 +234,6 @@ public void UpdateData()
234
234
235
235
internal class AddCurvesPopupGameObjectNode : TreeViewItem
236
236
{
237
- internal bool propertyPathMismatchWithHumanAvatar = false ;
238
237
public AddCurvesPopupGameObjectNode ( GameObject gameObject , TreeViewItem parent , string displayName )
239
238
: base ( gameObject . GetInstanceID ( ) , parent != null ? parent . depth + 1 : - 1 , parent , displayName )
240
239
{
@@ -253,8 +252,8 @@ internal class AddCurvesPopupPropertyNode : TreeViewItem
253
252
{
254
253
public EditorCurveBinding [ ] curveBindings ;
255
254
256
- public AddCurvesPopupPropertyNode ( TreeViewItem parent , EditorCurveBinding [ ] curveBindings )
257
- : base ( curveBindings [ 0 ] . GetHashCode ( ) , parent . depth + 1 , parent , AnimationWindowUtility . NicifyPropertyGroupName ( curveBindings [ 0 ] . type , AnimationWindowUtility . GetPropertyGroupName ( curveBindings [ 0 ] . propertyName ) ) )
255
+ public AddCurvesPopupPropertyNode ( TreeViewItem parent , EditorCurveBinding [ ] curveBindings , string displayPath )
256
+ : base ( curveBindings [ 0 ] . GetHashCode ( ) , parent . depth + 1 , parent , displayPath )
258
257
{
259
258
this . curveBindings = curveBindings ;
260
259
}
0 commit comments