|
1 | 1 | -- MacroScripts that will perform actions
|
2 |
| -macroScript UnityImport category:"Unity" iconName:"UnityIcons/import" |
| 2 | +macroScript UnityImport category:"Unity" |
3 | 3 | (
|
4 | 4 | origObjects = #()
|
5 | 5 |
|
@@ -41,11 +41,29 @@ macroScript UnityImport category:"Unity" iconName:"UnityIcons/import"
|
41 | 41 |
|
42 | 42 | unityFbxFilePathAttr = getFilenamePath fbxFileName
|
43 | 43 | unityFbxFileNameAttr = filenameFromPath fbxFileName
|
44 |
| - |
| 44 | + |
| 45 | + -- Change Unity project if fbx is from a different Unity project. |
| 46 | + -- Get the project based on the folder structure (i.e. folder above Assets) |
| 47 | + local head = unityFbxFilePathAttr |
| 48 | + head = trimRight t "\\/" |
| 49 | + -- Check that we are not at the root directory. |
| 50 | + while head != "" and not (pathConfig.isRootPath head) do( |
| 51 | + if (pathConfig.stripPathToLeaf head) == "Assets" do ( |
| 52 | + -- this is a valid Unity project, so set it |
| 53 | + unityProject = pathConfig.removePathLeaf head |
| 54 | + maxIniFile = (GetMAXIniFile()) |
| 55 | + setINISetting maxIniFile "Unity" "UnityProject" unityProject |
| 56 | + |
| 57 | + -- in order to break out of loop without calling break (because "break" is slow) |
| 58 | + head = "" |
| 59 | + ) |
| 60 | + head = pathConfig.removePathLeaf head |
| 61 | + ) |
| 62 | + |
45 | 63 | callbacks.removeScripts #postImport id:#unityPlugin
|
46 | 64 | )
|
47 | 65 | )
|
48 |
| -macroScript UnityExport category:"Unity" iconName:"UnityIcons/export" |
| 66 | +macroScript UnityExport category:"Unity" |
49 | 67 | (
|
50 | 68 | fn loadUnityFbxExportSettings = (
|
51 | 69 | fbxExportSettings = getINISetting (GetMAXIniFile()) "Unity" "UnityFbxExportSettings"
|
|
0 commit comments