@@ -188,6 +188,10 @@ protected bool IsInSameHierarchy(Transform t1, Transform t2){
188
188
return ( IsAncestor ( t1 , t2 ) || IsAncestor ( t2 , t1 ) ) ;
189
189
}
190
190
191
+ protected virtual GameObject GetGameObject ( )
192
+ {
193
+ return ModelExporter . GetGameObject ( ToExport [ 0 ] ) ;
194
+ }
191
195
192
196
protected bool TransferAnimationSourceIsValid ( Transform newValue ) {
193
197
if ( ! newValue ) {
@@ -199,7 +203,7 @@ protected bool TransferAnimationSourceIsValid(Transform newValue){
199
203
return false ;
200
204
}
201
205
202
- var selectedGO = ModelExporter . GetGameObject ( ToExport [ 0 ] ) ;
206
+ var selectedGO = GetGameObject ( ) ;
203
207
204
208
// source must be ancestor to dest
205
209
if ( TransferAnimationDest && ! IsAncestor ( newValue , TransferAnimationDest ) ) {
@@ -224,7 +228,7 @@ protected bool TransferAnimationDestIsValid(Transform newValue){
224
228
return false ;
225
229
}
226
230
227
- var selectedGO = ModelExporter . GetGameObject ( ToExport [ 0 ] ) ;
231
+ var selectedGO = GetGameObject ( ) ;
228
232
229
233
// source must be ancestor to dest
230
234
if ( TransferAnimationSource && ! IsAncestor ( TransferAnimationSource , newValue ) ) {
@@ -396,15 +400,23 @@ public class ExportModelEditorWindow : ExportOptionsEditorWindow
396
400
protected override float MinWindowHeight { get { return 310 ; } } // determined by trial and error
397
401
protected override bool DisableNameSelection {
398
402
get {
399
- return IsPlayableDirector ;
403
+ return false ;
400
404
}
401
405
}
406
+
407
+ protected override GameObject GetGameObject ( )
408
+ {
409
+ return ( IsTimelineAnim )
410
+ ? AnimationOnlyExportData . GetGameObjectAndAnimationClip ( ToExport [ 0 ] ) . Key
411
+ : ModelExporter . GetGameObject ( ToExport [ 0 ] ) ;
412
+ }
413
+
402
414
protected override bool DisableTransferAnim {
403
415
get {
404
416
// don't transfer animation if we are exporting more than one hierarchy, the timeline clips from
405
417
// a playable director, or if only the model is being exported
406
418
// if we are on the timeline then export length can be more than 1
407
- return ToExport == null || ToExport . Length == 0 || ( ! IsTimelineAnim && ToExport . Length > 1 ) || IsPlayableDirector || SettingsObject . ModelAnimIncludeOption == ExportSettings . Include . Model ;
419
+ return ToExport == null || ToExport . Length == 0 || ( ! IsTimelineAnim && ToExport . Length > 1 ) || SettingsObject . ModelAnimIncludeOption == ExportSettings . Include . Model ;
408
420
}
409
421
}
410
422
@@ -441,26 +453,17 @@ protected bool SingleHierarchyExport {
441
453
}
442
454
}
443
455
444
- private bool m_isPlayableDirector = false ;
445
- protected bool IsPlayableDirector {
446
- get { return m_isPlayableDirector ; }
447
- set {
448
- m_isPlayableDirector = value ;
449
- }
450
- }
451
-
452
456
protected override ExportOptionsSettingsSerializeBase SettingsObject
453
457
{
454
458
get { return ExportSettings . instance . exportModelSettings . info ; }
455
459
}
456
460
457
461
private ExportSettings . Include m_previousInclude = ExportSettings . Include . ModelAndAnim ;
458
462
459
- public static void Init ( IEnumerable < UnityEngine . Object > toExport , string filename = "" , bool isTimelineAnim = false , bool isPlayableDirector = false )
463
+ public static void Init ( IEnumerable < UnityEngine . Object > toExport , string filename = "" , bool isTimelineAnim = false )
460
464
{
461
465
ExportModelEditorWindow window = CreateWindow < ExportModelEditorWindow > ( ) ;
462
466
window . IsTimelineAnim = isTimelineAnim ;
463
- window . IsPlayableDirector = isPlayableDirector ;
464
467
465
468
int numObjects = window . SetGameObjectsToExport ( toExport ) ;
466
469
if ( string . IsNullOrEmpty ( filename ) ) {
@@ -473,19 +476,21 @@ public static void Init (IEnumerable<UnityEngine.Object> toExport, string filena
473
476
474
477
protected int SetGameObjectsToExport ( IEnumerable < UnityEngine . Object > toExport ) {
475
478
ToExport = toExport . ToArray ( ) ;
479
+ if ( ToExport . Length == 0 ) return 0 ;
476
480
477
481
TransferAnimationSource = null ;
478
482
TransferAnimationDest = null ;
479
483
480
484
// if only one object selected, set transfer source/dest to this object
481
- if ( ToExport . Length == 1 || ( IsTimelineAnim && ToExport . Length > 0 ) ) {
482
- var go = ModelExporter . GetGameObject ( ToExport [ 0 ] ) ;
483
- if ( go ) {
485
+ if ( ToExport . Length == 1 || ( IsTimelineAnim && ToExport . Length > 0 ) )
486
+ {
487
+ GameObject go = GetGameObject ( ) ;
488
+ if ( go )
489
+ {
484
490
TransferAnimationSource = go . transform ;
485
491
TransferAnimationDest = go . transform ;
486
492
}
487
493
}
488
-
489
494
return ToExport . Length ;
490
495
}
491
496
@@ -543,20 +548,6 @@ protected override bool Export(){
543
548
return false ;
544
549
}
545
550
546
- if ( IsPlayableDirector ) {
547
- foreach ( var obj in ToExport ) {
548
- var go = ModelExporter . GetGameObject ( obj ) ;
549
- if ( ! go ) {
550
- continue ;
551
- }
552
- ModelExporter . ExportAllTimelineClips ( go , folderPath , SettingsObject ) ;
553
- }
554
- // refresh the asset database so that the file appears in the
555
- // asset folder view.
556
- AssetDatabase . Refresh ( ) ;
557
- return true ;
558
- }
559
-
560
551
if ( ModelExporter . ExportObjects ( filePath , ToExport , SettingsObject ) != null ) {
561
552
// refresh the asset database so that the file appears in the
562
553
// asset folder view.
0 commit comments