Skip to content

Commit 322afbc

Browse files
committed
Merge branch 'master' into UNI-32798-1.3.0b1-forum-release
2 parents 83d77dc + 0e3fa66 commit 322afbc

File tree

2 files changed

+45
-13
lines changed

2 files changed

+45
-13
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,8 @@ public AnimationOnlyExportData(
23422342

23432343
public void ComputeObjectsInAnimationClips(
23442344
AnimationClip[] animClips,
2345-
GameObject animationRootObject
2345+
GameObject animationRootObject,
2346+
bool exportSkinnedMeshAnim = true
23462347
){
23472348
foreach (var animClip in animClips) {
23482349
if (this.animationClips.ContainsKey(animClip)) {
@@ -2363,6 +2364,10 @@ GameObject animationRootObject
23632364
continue;
23642365
}
23652366

2367+
if (!exportSkinnedMeshAnim && unityGo.GetComponent<SkinnedMeshRenderer>()) {
2368+
continue;
2369+
}
2370+
23662371
if (lightProps.Contains (uniCurveBinding.propertyName)) {
23672372
this.exportComponent.Add (unityGo, typeof(Light));
23682373
} else if (cameraProps.Contains (uniCurveBinding.propertyName)) {
@@ -2720,7 +2725,7 @@ protected Dictionary<GameObject, AnimationOnlyExportData> GetTimelineAnimationEx
27202725
var exportComponent = new Dictionary<GameObject, System.Type>();
27212726

27222727
var exportData = new AnimationOnlyExportData(animationClips, goToExport, exportComponent);
2723-
exportData.ComputeObjectsInAnimationClips(animationClipsList.ToArray(), rootObject);
2728+
exportData.ComputeObjectsInAnimationClips(animationClipsList.ToArray(), rootObject, ExportOptions.AnimateSkinnedMesh);
27242729

27252730
Dictionary<GameObject, AnimationOnlyExportData> data = new Dictionary<GameObject, AnimationOnlyExportData>();
27262731
data.Add(rootObject, exportData);
@@ -2758,7 +2763,7 @@ protected Dictionary<GameObject, AnimationOnlyExportData> GetAnimationExportData
27582763
}
27592764

27602765
var animClips = AnimationUtility.GetAnimationClips(anim.gameObject);
2761-
exportData.ComputeObjectsInAnimationClips(animClips, anim.gameObject);
2766+
exportData.ComputeObjectsInAnimationClips(animClips, anim.gameObject, ExportOptions.AnimateSkinnedMesh);
27622767
}
27632768

27642769
int depthFromRootAnimator = int.MaxValue;
@@ -2777,7 +2782,7 @@ protected Dictionary<GameObject, AnimationOnlyExportData> GetAnimationExportData
27772782
var controller = anim.runtimeAnimatorController;
27782783
if (controller)
27792784
{
2780-
exportData.ComputeObjectsInAnimationClips(controller.animationClips, anim.gameObject);
2785+
exportData.ComputeObjectsInAnimationClips(controller.animationClips, anim.gameObject, ExportOptions.AnimateSkinnedMesh);
27812786
}
27822787
}
27832788

Assets/Integrations/Autodesk/maya/scripts/unityCommands.mel

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
global string $UnityExportSets[];
21
global string $UnityFbxFilePathAttr = "unityFbxModelFilePath";
32
global string $UnityFbxFileNameAttr = "unityFbxModelFileName";
43
global string $UnityFbxAnimFilePathAttr = "unityFbxAnimFilePath";
@@ -136,7 +135,6 @@ proc string checkNamespaceNeedsUpdate(string $unitySet, string $unityFbxNamespac
136135

137136
proc importFile(string $filePathStr){
138137
// get the global variables
139-
global string $UnityExportSets[];
140138
global string $UnityFbxFilePathAttr;
141139
global string $UnityFbxFileNameAttr;
142140
global string $UnityFbxAnimFilePathAttr;
@@ -278,10 +276,6 @@ proc importFile(string $filePathStr){
278276
}
279277
// lock set so it doesn't get deleted when empty
280278
lockNode -lock true $unityExportSet;
281-
282-
if(!stringArrayContains($unityExportSet, $UnityExportSets)){
283-
$UnityExportSets[size($UnityExportSets)] = $unityExportSet;
284-
}
285279
}
286280
}
287281

@@ -418,9 +412,41 @@ proc exportSet(string $unitySet, int $exportAnim){
418412
}
419413
}
420414

415+
proc int isUnityExportSet(string $mayaSet){
416+
global string $UnityFbxFilePathAttr;
417+
global string $UnityFbxFileNameAttr;
418+
419+
if(!endsWith($mayaSet, "_UnityExportSet")){
420+
return false;
421+
}
422+
423+
if(!`attributeExists $UnityFbxFilePathAttr $mayaSet`){
424+
return false;
425+
}
426+
427+
if(!`attributeExists $UnityFbxFileNameAttr $mayaSet`){
428+
return false;
429+
}
430+
return true;
431+
}
432+
433+
proc string[] getUnityExportSets(){
434+
//if the selection set ends w "_UnityExportSet" and it has at least the custom attributes UnityFbxModelFilePath & UnityFbxModelFileName then it's one of ours.
435+
string $unityExportSets[];
436+
437+
string $mayaSets[] = `listSets -allSets`;
438+
439+
int $i = 0;
440+
for($k=0; $k<size($mayaSets); ++$k){
441+
if(isUnityExportSet($mayaSets[$k])){
442+
$unityExportSets[$i] = $mayaSets[$k];
443+
$i++;
444+
}
445+
}
446+
return $unityExportSets;
447+
}
448+
421449
proc unityExport(int $exportType){
422-
// get the global variables
423-
global string $UnityExportSets[];
424450

425451
if(!loadUnityDependencies()){
426452
return;
@@ -454,7 +480,8 @@ proc unityExport(int $exportType){
454480

455481
$i = 0;
456482
string $setsToExport[];
457-
for($exportSet in $UnityExportSets){
483+
string $unityExportSets[] = getUnityExportSets();
484+
for($exportSet in $unityExportSets){
458485
if(!setExists($exportSet)){
459486
continue;
460487
}

0 commit comments

Comments
 (0)