Skip to content

Commit 25785ef

Browse files
committed
merge
2 parents 3ce2291 + a40b4f3 commit 25785ef

File tree

2 files changed

+11
-30
lines changed

2 files changed

+11
-30
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 3 additions & 28 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)
158158
{
159159
// check if package installed
160160
string moduleTemplatePath = GetModuleTemplatePath(version);
@@ -165,10 +165,6 @@ public static bool InstallMaya(string version, bool verbose=true, bool commandsO
165165
return false;
166166
}
167167

168-
// TODO: detect maya2017 installation
169-
170-
// TODO: if not maya2017 installed warn user
171-
172168
// check for {USER} modules folder
173169
string modulePath = GetModulePath(version);
174170

@@ -248,43 +244,22 @@ public static bool InstallMaya(string version, bool verbose=true, bool commandsO
248244
// TODO: print message package already installed else where
249245
}
250246

251-
if (commandsOnly)
252-
throw new NotImplementedException();
253-
254-
// TODO: configure maya to auto-load plugin on next startup
255-
256247
return true;
257248
}
258249

259250
public static void InstallMaya2017()
260251
{
261252
const bool verbose = true;
262-
const bool commandsOnly = false;
263253
const string version = Integrations.MAYA_VERSION;
264254

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

267-
if (InstallMaya (version, verbose, commandsOnly)) {
257+
if (InstallMaya (version, verbose)) {
268258
if (verbose) Debug.Log (string.Format ("Completed installation of Maya {0} Integration.", version));
269259
} else {
270260
if (verbose) Debug.Log (string.Format ("Failed to install Maya {0} Integration.", version));
271261
}
272262
}
273-
274-
public static void InstallMaya2017CommandsOnly ()
275-
{
276-
const bool verbose = true;
277-
const bool commandsOnly = true;
278-
const string version = Integrations.MAYA_VERSION;
279-
280-
Debug.Log (string.Format ("Installing Maya {0} Integration (Commands Only).", version));
281-
282-
if (InstallMaya (version, verbose, commandsOnly)) {
283-
if (verbose) Debug.Log (string.Format ("Completed installation of Maya {0} Integration (Commands Only).", version));
284-
} else {
285-
if (verbose) Debug.Log (string.Format ("Failed to install Maya {0} Integration (Commands Only).", version));
286-
}
287-
}
288263
}
289264

290265
namespace Editors
@@ -296,7 +271,7 @@ class IntegrationsUI
296271
[MenuItem (MenuItemName, false, 0)]
297272
public static void OnMenuItem ()
298273
{
299-
if (Integrations.InstallMaya(Integrations.MAYA_VERSION, true, false))
274+
if (Integrations.InstallMaya(Integrations.MAYA_VERSION))
300275
{
301276
string title = string.Format("Completed installation of Maya {0} Integration.", Integrations.MAYA_VERSION);
302277
string commands = string.Format("optionVar -stringValue \"UnityProject\" \"{0}\"; loadPlugin unityOneClickPlugin; pluginInfo -edit -autoload true unityOneClickPlugin;",Integrations.GetProjectPath());

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)