Skip to content

Commit f2e0565

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into UNI-25265-sprint25-release
2 parents c9bf7f0 + 119ae7e commit f2e0565

File tree

9 files changed

+43
-5
lines changed

9 files changed

+43
-5
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Editor
1818
{
1919
public static class ConvertToModel
2020
{
21-
const string MenuItemName1 = "GameObject/Convert To Prefab";
21+
const string MenuItemName1 = "GameObject/Convert To Linked Prefab Instance";
2222

2323
/// <summary>
2424
/// OnContextItem is called either:
@@ -389,6 +389,15 @@ private static void CopyComponentsRecursive(GameObject from, GameObject to, bool
389389
public static void CopyComponents(GameObject from, GameObject to){
390390
var originalComponents = new List<Component>(to.GetComponents<Component> ());
391391
foreach(var component in from.GetComponents<Component> ()) {
392+
// UNI-24379: we don't support SkinnedMeshRenderer right
393+
// now: we just bake the mesh into its current pose. So
394+
// don't copy the SMR over. There will already be a
395+
// MeshFilter and MeshRenderer due to the static mesh.
396+
// Remove this code when we support skinning.
397+
if (component is SkinnedMeshRenderer) {
398+
continue;
399+
}
400+
392401
var json = EditorJsonUtility.ToJson(component);
393402

394403
System.Type expectedType = component.GetType();

Assets/FbxExporters/Editor/UnitTests/ConvertToModelTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,30 @@ public void BasicTest()
188188
Assert.IsFalse(cube);
189189
}
190190
}
191+
192+
[Test]
193+
public void SkinnedMeshTest()
194+
{
195+
// UNI-24379: in the first release, the plugin only handles static
196+
// meshes, not skinned meshes. Rewrite this test when we add that
197+
// feature.
198+
199+
// Create a cube with a bogus skinned-mesh rather than a static
200+
// mesh setup.
201+
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
202+
cube.AddComponent<SkinnedMeshRenderer>();
203+
var meshFilter = cube.GetComponent<MeshFilter>();
204+
var meshRender = cube.GetComponent<MeshRenderer>();
205+
Object.DestroyImmediate(meshRender);
206+
Object.DestroyImmediate(meshFilter);
207+
208+
// Convert it. Make sure it gets deleted, to avoid a useless error about internal consistency.
209+
var cubeInstance = ConvertToModel.Convert(cube, fbxFullPath: GetRandomFbxFilePath());
210+
if (cube) { Object.DestroyImmediate(cube); }
211+
212+
// Make sure it doesn't have a skinned mesh renderer on it.
213+
// In the future we'll want to assert the opposite!
214+
Assert.That(cubeInstance.GetComponentsInChildren<SkinnedMeshRenderer>(), Is.Empty);
215+
}
191216
}
192217
}
19.6 KB
Loading
19.4 KB
Loading
23 KB
Loading
Binary file not shown.
Binary file not shown.

Assets/Integrations/Autodesk/maya/scripts/unityOneClick/commands.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class BaseCommand(OpenMayaMPx.MPxCommand, LoggerMixin):
3838
"""
3939
Base class for UnityOneClick Plugin Commands.
4040
"""
41-
kDefaultIcon = 'unity_100.png'
41+
kIconPath = ""
42+
kFamilyIcon = 'unity.png'
4243
kFamilyLabel = "The UnityOneClick plugin allows you to reliably exchange and review your work between Maya and Unity."
4344

4445
def __init__(self):
@@ -92,11 +93,11 @@ def loadUnityFbxExportSettings(self):
9293

9394
@classmethod
9495
def iconPath(cls):
95-
return ""
96+
return cls.kIconPath
9697

9798
@classmethod
9899
def familyIconPath(cls):
99-
return maya.mel.eval('$tempPath = languageResourcePath("{0}");'.format(cls.kDefaultIcon))
100+
return maya.mel.eval('$tempPath = languageResourcePath("{0}");'.format(cls.kFamilyIcon))
100101

101102
def storeAttribute(self, node, attr, attrValue, attrType="string"):
102103
if not maya.mel.eval('attributeExists "{0}" "{1}"'.format(attr, node)):
@@ -117,6 +118,7 @@ class importCmd(BaseCommand):
117118
118119
@ingroup UnityCommands
119120
"""
121+
kIconPath = "import.png"
120122
kLabel = 'Import FBX file from Unity Project and auto-configure for exporting'
121123
kShortLabel = 'Import'
122124
kCmdName = "{}Import".format(version.pluginPrefix())
@@ -145,7 +147,7 @@ def syntaxCreator(cls):
145147
@classmethod
146148
def scriptCmd(cls):
147149
return
148-
150+
149151
def beforeImport(self, retCode, file, clientData):
150152
# store path and filename
151153
self._tempPath = file.resolvedPath()
@@ -242,6 +244,7 @@ class previewCmd(BaseCommand):
242244
243245
@ingroup UnityCommands
244246
"""
247+
kIconPath = "preview.png"
245248
kLabel = 'Preview Model in Unity window'
246249
kShortLabel = 'Preview'
247250
kCmdName = "{}Preview".format(version.pluginPrefix())
@@ -343,6 +346,7 @@ class exportCmd(BaseCommand):
343346
344347
@ingroup UnityCommands
345348
"""
349+
kIconPath = "export.png"
346350
kLabel = 'Export Model to Unity'
347351
kShortLabel = 'Export'
348352
kCmdName = "{}Export".format(version.pluginPrefix())

0 commit comments

Comments
 (0)