Skip to content

Commit 0edfc10

Browse files
committed
Uni-21773 configure headless install
1 parent 1888b33 commit 0edfc10

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private static void WriteFile(string FileName, List<string> Lines )
154154
}
155155
}
156156

157-
public static bool InstallMaya(string version, bool verbose=true, bool commandsOnly=false)
157+
public static bool InstallMaya(string version, bool verbose=true, bool headless=false)
158158
{
159159
// check if package installed
160160
string moduleTemplatePath = GetModuleTemplatePath(version);
@@ -248,7 +248,7 @@ public static bool InstallMaya(string version, bool verbose=true, bool commandsO
248248
// TODO: print message package already installed else where
249249
}
250250

251-
if (commandsOnly)
251+
if (headless)
252252
throw new NotImplementedException();
253253

254254
// TODO: configure maya to auto-load plugin on next startup
@@ -259,30 +259,30 @@ public static bool InstallMaya(string version, bool verbose=true, bool commandsO
259259
public static void InstallMaya2017()
260260
{
261261
const bool verbose = true;
262-
const bool commandsOnly = false;
262+
const bool headless = false;
263263
const string version = Integrations.MAYA_VERSION;
264264

265265
Debug.Log(string.Format("Installing Maya {0} Integration", version));
266266

267-
if (InstallMaya (version, verbose, commandsOnly)) {
267+
if (InstallMaya (version, verbose, headless)) {
268268
if (verbose) Debug.Log (string.Format ("Completed installation of Maya {0} Integration.", version));
269269
} else {
270270
if (verbose) Debug.Log (string.Format ("Failed to install Maya {0} Integration.", version));
271271
}
272272
}
273273

274-
public static void InstallMaya2017CommandsOnly ()
274+
public static void InstallMaya2017Headless ()
275275
{
276276
const bool verbose = true;
277-
const bool commandsOnly = true;
277+
const bool headless = true;
278278
const string version = Integrations.MAYA_VERSION;
279279

280-
Debug.Log (string.Format ("Installing Maya {0} Integration (Commands Only).", version));
280+
Debug.Log (string.Format ("Installing Maya {0} Integration (Headless).", version));
281281

282-
if (InstallMaya (version, verbose, commandsOnly)) {
283-
if (verbose) Debug.Log (string.Format ("Completed installation of Maya {0} Integration (Commands Only).", version));
282+
if (InstallMaya (version, verbose, headless)) {
283+
if (verbose) Debug.Log (string.Format ("Completed installation of Maya {0} Integration (Headless).", version));
284284
} else {
285-
if (verbose) Debug.Log (string.Format ("Failed to install Maya {0} Integration (Commands Only).", version));
285+
if (verbose) Debug.Log (string.Format ("Failed to install Maya {0} Integration (Headless).", version));
286286
}
287287
}
288288
}

Assets/FbxExporters/README.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ else
3636
"${UNITY3D_PATH}" -projectPath "${PROJECT_PATH}" -importPackage ${PACKAGE_PATH} -quit
3737

3838
# Install Maya2017 Integration
39-
# Use "InstallMaya2017CommandsOnly" to install without UI
4039
"${UNITY3D_PATH}" -batchMode -projectPath "${PROJECT_PATH}" -executeMethod FbxExporters.Integrations.InstallMaya2017 -quit
4140

4241
# Configuring Maya2017 to auto-load integration
@@ -45,7 +44,8 @@ else
4544
if [ ! -f "${MAYA_PATH}" ]; then
4645
echo "Maya2017 not installed"
4746
else
48-
"${MAYA_PATH}" -command "loadPlugin unityOneClickPlugin; pluginInfo -edit -autoload true unityOneClickPlugin; quit;"
47+
# To configure without user interface prepend the following command: optionVar -intValue \"UnityOneClick_Headless\" 1;
48+
"${MAYA_PATH}" -command "optionVar -intValue \"UnityOneClick_Headless\" 1; loadPlugin unityOneClickPlugin; pluginInfo -edit -autoload true unityOneClickPlugin; quit;"
4949
fi
5050
fi
5151

Assets/Integrations/Autodesk/maya2017/plug-ins/unityOneClickPlugin.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
import sys
1919

2020
import maya.OpenMayaMPx as OpenMayaMPx
21+
import maya.cmds
2122

2223
from unityOneClick import (version, commands, ui, debug)
2324

2425
kPluginInfo = { 'name': version.pluginName(), 'version': version.versionName(), 'vendor': version.vendorName() }
2526
kVerbose = True
27+
kHeadlessInstall = maya.cmds.optionVar( exists='UnityOneClick_Headless' )
2628

2729
# initialize the script plug-in
2830
def initializePlugin(mobject):
@@ -32,7 +34,9 @@ def initializePlugin(mobject):
3234
sys.stdout.write('loading %s\n'%kPluginInfo['name'])
3335

3436
commands.register(pluginFn)
35-
ui.register(pluginFn)
37+
38+
if not kHeadlessInstall:
39+
ui.register(pluginFn)
3640

3741
except Exception as e:
3842
assert isinstance(sys.stderr.write, object)
@@ -46,7 +50,9 @@ def uninitializePlugin(mobject):
4650
if debug.EnableDebugMessages:
4751
sys.stdout.write('unloading %s\n'%kPluginInfo['name'])
4852

49-
ui.unregister(pluginFn)
53+
if not kHeadlessInstall:
54+
ui.unregister(pluginFn)
55+
5056
commands.unregister(pluginFn)
5157

5258
except:

0 commit comments

Comments
 (0)