File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Assets/Integrations/Autodesk/max/scripts Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,25 @@ macroScript UnityImport category:"Unity"
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 head " \\ /"
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
)
You can’t perform that action at this time.
0 commit comments