@@ -2973,6 +2973,24 @@ static void OnClipContextClick(MenuCommand command)
2973
2973
}
2974
2974
}
2975
2975
2976
+ /// <summary>
2977
+ /// Validate the menu item defined by the function OnClipContextClick.
2978
+ /// </summary>
2979
+ [ MenuItem ( TimelineClipMenuItemName , true , 31 ) ]
2980
+ static bool ValidateOnClipContextClick ( )
2981
+ {
2982
+ Object [ ] selectedObjects = Selection . objects ;
2983
+
2984
+ foreach ( Object editorClipSelected in selectedObjects )
2985
+ {
2986
+ if ( editorClipSelected . GetType ( ) . Name . Contains ( "EditorClip" ) )
2987
+ {
2988
+ return true ;
2989
+ }
2990
+ }
2991
+ return false ;
2992
+ }
2993
+
2976
2994
public static bool ExportSingleEditorClip ( Object editorClipSelected )
2977
2995
{
2978
2996
if ( editorClipSelected . GetType ( ) . Name . Contains ( "EditorClip" ) )
@@ -3052,6 +3070,31 @@ public static void OnPlayableDirectorGameObjectContextClick(MenuCommand command)
3052
3070
}
3053
3071
}
3054
3072
3073
+ /// <summary>
3074
+ /// Validate the menu item defined by the function OnPlayableDirectorGameObjectContextClick.
3075
+ /// </summary>
3076
+ [ MenuItem ( ClipMenuItemName , true , 31 ) ]
3077
+ public static bool ValidateClipContextClick ( )
3078
+ {
3079
+ Object [ ] selection = Selection . objects ;
3080
+
3081
+ if ( selection == null || selection . Length == 0 )
3082
+ {
3083
+ return false ;
3084
+ }
3085
+
3086
+ foreach ( Object obj in selection )
3087
+ {
3088
+ GameObject gameObj = obj as GameObject ;
3089
+ if ( gameObj != null && gameObj . GetComponent < PlayableDirector > ( ) != null )
3090
+ {
3091
+ return true ;
3092
+ }
3093
+ }
3094
+
3095
+ return false ;
3096
+ }
3097
+
3055
3098
public static void ExportAllTimelineClips ( GameObject objectWithPlayableDirector , string folderPath )
3056
3099
{
3057
3100
PlayableDirector pd = objectWithPlayableDirector . GetComponent < PlayableDirector > ( ) ;
@@ -3078,31 +3121,6 @@ public static void ExportAllTimelineClips(GameObject objectWithPlayableDirector,
3078
3121
}
3079
3122
}
3080
3123
}
3081
-
3082
- /// <summary>
3083
- /// Validate the menu item defined by the function above.
3084
- /// </summary>
3085
- [ MenuItem ( ClipMenuItemName , true , 31 ) ]
3086
- public static bool ValidateClipContextClick ( )
3087
- {
3088
- Object [ ] selection = Selection . objects ;
3089
-
3090
- if ( selection == null || selection . Length == 0 )
3091
- {
3092
- return false ;
3093
- }
3094
-
3095
- foreach ( Object obj in selection )
3096
- {
3097
- GameObject gameObj = obj as GameObject ;
3098
- if ( gameObj != null && gameObj . GetComponent < PlayableDirector > ( ) != null )
3099
- {
3100
- return true ;
3101
- }
3102
- }
3103
-
3104
- return false ;
3105
- }
3106
3124
3107
3125
/// <summary>
3108
3126
/// Add a menu item "Export Model..." to a GameObject's context menu.
@@ -3119,7 +3137,7 @@ static void OnContextItem (MenuCommand command)
3119
3137
}
3120
3138
3121
3139
/// <summary>
3122
- /// Validate the menu item defined by the function above .
3140
+ /// Validate the menu item defined by the function OnContextItem .
3123
3141
/// </summary>
3124
3142
[ MenuItem ( MenuItemName , true , 30 ) ]
3125
3143
public static bool OnValidateMenuItem ( )
@@ -3142,7 +3160,7 @@ static void ModelOnlyOnContextItem (MenuCommand command)
3142
3160
}
3143
3161
3144
3162
/// <summary>
3145
- /// Validate the menu item defined by the function above .
3163
+ /// Validate the menu item defined by the function ModelOnlyOnContextItem .
3146
3164
/// </summary>
3147
3165
[ MenuItem ( ModelOnlyMenuItemName , true , 30 ) ]
3148
3166
public static bool ModelOnlyOnValidateMenuItem ( )
@@ -3172,7 +3190,23 @@ static void OnAnimOnlyContextItem (MenuCommand command)
3172
3190
[ MenuItem ( AnimOnlyMenuItemName , true , 30 ) ]
3173
3191
public static bool OnValidateAnimOnlyMenuItem ( )
3174
3192
{
3175
- return true ;
3193
+ Object [ ] selection = Selection . objects ;
3194
+
3195
+ if ( selection == null || selection . Length == 0 )
3196
+ {
3197
+ return false ;
3198
+ }
3199
+
3200
+ foreach ( Object obj in selection )
3201
+ {
3202
+ GameObject gameObj = obj as GameObject ;
3203
+ if ( gameObj != null && ( gameObj . GetComponent < Animation > ( ) != null || gameObj . GetComponent < Animator > ( ) != null ) )
3204
+ {
3205
+ return true ;
3206
+ }
3207
+ }
3208
+
3209
+ return false ;
3176
3210
}
3177
3211
3178
3212
public static void DisplayNoSelectionDialog ( )
0 commit comments