Skip to content

Commit 0adf3db

Browse files
committed
add imported objects to selection set
1 parent 3f174ff commit 0adf3db

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

Assets/FbxExporters/Integrations/Autodesk/max/scripts/unityOneClickPlugin.ms

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
-- MacroScripts that will perform actions
22
macroScript Import category:"Unity"
33
(
4-
-- Make sure the FbxImporter plugin is loaded
5-
pluginManager.loadClass FbxImporter
6-
fbxFileName = getOpenFileName caption:"Import FBX from Unity" filename:"C:/" types:"FBX (*.fbx)|*.fbx|"
7-
if fbxFileName != undefined then
8-
(
9-
importFile fbxFileName using:FBXIMP
10-
)
4+
origObjects = #()
5+
6+
global afterImport
7+
fn afterImport = (
8+
unityFbxExportSet = #()
9+
currSet = selectionSets["UnityFbxExportSet"]
10+
if not isdeleted currSet and currSet != undefined then (
11+
unityFbxExportSet = unityFbxExportSet + currSet
12+
)
13+
for obj in objects do(
14+
if findItem origObjects obj == 0 then(
15+
-- add to selection set
16+
append unityFbxExportSet obj
17+
)
18+
)
19+
selectionSets["UnityFbxExportSet"] = unityFbxExportSet
20+
);
21+
22+
-- Make sure the FbxImporter plugin is loaded
23+
pluginManager.loadClass FbxImporter
24+
fbxFileName = getOpenFileName caption:"Import FBX from Unity" filename:"C:/Users/Viktoria/Desktop/" types:"FBX (*.fbx)|*.fbx|"
25+
if fbxFileName != undefined then
26+
(
27+
-- Get all objects in scene before importAction
28+
origObjects = objects as array
29+
print (origObjects as string)
30+
callbacks.addScript #postImport ("afterImport()") id:#unityPlugin
31+
32+
importFile fbxFileName using:FBXIMP
33+
34+
callbacks.removeScripts #postImport id:#unityPlugin
35+
)
1136
)
1237
macroScript Preview category:"Unity"
1338
(

0 commit comments

Comments
 (0)