|
1 | 1 | -- MacroScripts that will perform actions
|
2 | 2 | macroScript Import category:"Unity"
|
3 | 3 | (
|
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 | + ) |
11 | 36 | )
|
12 | 37 | macroScript Preview category:"Unity"
|
13 | 38 | (
|
|
0 commit comments