@@ -2964,6 +2964,24 @@ static void OnClipContextClick(MenuCommand command)
2964
2964
}
2965
2965
}
2966
2966
2967
+ /// <summary>
2968
+ /// Validate the menu item defined by the function OnClipContextClick.
2969
+ /// </summary>
2970
+ [ MenuItem ( TimelineClipMenuItemName , true , 31 ) ]
2971
+ static bool ValidateOnClipContextClick ( )
2972
+ {
2973
+ Object [ ] selectedObjects = Selection . objects ;
2974
+
2975
+ foreach ( Object editorClipSelected in selectedObjects )
2976
+ {
2977
+ if ( editorClipSelected . GetType ( ) . Name . Contains ( "EditorClip" ) )
2978
+ {
2979
+ return true ;
2980
+ }
2981
+ }
2982
+ return false ;
2983
+ }
2984
+
2967
2985
public static bool ExportSingleEditorClip ( Object editorClipSelected )
2968
2986
{
2969
2987
if ( editorClipSelected . GetType ( ) . Name . Contains ( "EditorClip" ) )
@@ -3043,6 +3061,31 @@ public static void OnPlayableDirectorGameObjectContextClick(MenuCommand command)
3043
3061
}
3044
3062
}
3045
3063
3064
+ /// <summary>
3065
+ /// Validate the menu item defined by the function OnPlayableDirectorGameObjectContextClick.
3066
+ /// </summary>
3067
+ [ MenuItem ( ClipMenuItemName , true , 31 ) ]
3068
+ public static bool ValidateClipContextClick ( )
3069
+ {
3070
+ Object [ ] selection = Selection . objects ;
3071
+
3072
+ if ( selection == null || selection . Length == 0 )
3073
+ {
3074
+ return false ;
3075
+ }
3076
+
3077
+ foreach ( Object obj in selection )
3078
+ {
3079
+ GameObject gameObj = obj as GameObject ;
3080
+ if ( gameObj != null && gameObj . GetComponent < PlayableDirector > ( ) != null )
3081
+ {
3082
+ return true ;
3083
+ }
3084
+ }
3085
+
3086
+ return false ;
3087
+ }
3088
+
3046
3089
public static void ExportAllTimelineClips ( GameObject objectWithPlayableDirector , string folderPath )
3047
3090
{
3048
3091
PlayableDirector pd = objectWithPlayableDirector . GetComponent < PlayableDirector > ( ) ;
@@ -3069,31 +3112,6 @@ public static void ExportAllTimelineClips(GameObject objectWithPlayableDirector,
3069
3112
}
3070
3113
}
3071
3114
}
3072
-
3073
- /// <summary>
3074
- /// Validate the menu item defined by the function above.
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
3115
3098
3116
/// <summary>
3099
3117
/// Add a menu item "Export Model..." to a GameObject's context menu.
@@ -3110,7 +3128,7 @@ static void OnContextItem (MenuCommand command)
3110
3128
}
3111
3129
3112
3130
/// <summary>
3113
- /// Validate the menu item defined by the function above .
3131
+ /// Validate the menu item defined by the function OnContextItem .
3114
3132
/// </summary>
3115
3133
[ MenuItem ( MenuItemName , true , 30 ) ]
3116
3134
public static bool OnValidateMenuItem ( )
@@ -3133,7 +3151,7 @@ static void ModelOnlyOnContextItem (MenuCommand command)
3133
3151
}
3134
3152
3135
3153
/// <summary>
3136
- /// Validate the menu item defined by the function above .
3154
+ /// Validate the menu item defined by the function ModelOnlyOnContextItem .
3137
3155
/// </summary>
3138
3156
[ MenuItem ( ModelOnlyMenuItemName , true , 30 ) ]
3139
3157
public static bool ModelOnlyOnValidateMenuItem ( )
@@ -3163,7 +3181,23 @@ static void OnAnimOnlyContextItem (MenuCommand command)
3163
3181
[ MenuItem ( AnimOnlyMenuItemName , true , 30 ) ]
3164
3182
public static bool OnValidateAnimOnlyMenuItem ( )
3165
3183
{
3166
- return true ;
3184
+ Object [ ] selection = Selection . objects ;
3185
+
3186
+ if ( selection == null || selection . Length == 0 )
3187
+ {
3188
+ return false ;
3189
+ }
3190
+
3191
+ foreach ( Object obj in selection )
3192
+ {
3193
+ GameObject gameObj = obj as GameObject ;
3194
+ if ( gameObj != null && ( gameObj . GetComponent < Animation > ( ) != null || gameObj . GetComponent < Animator > ( ) != null ) )
3195
+ {
3196
+ return true ;
3197
+ }
3198
+ }
3199
+
3200
+ return false ;
3167
3201
}
3168
3202
3169
3203
public static void DisplayNoSelectionDialog ( )
0 commit comments