Skip to content

Commit da84a0b

Browse files
pandaGaumeDrigax
andauthored
get maya version (#958)
Co-authored-by: Nicholas Barlow <whoisdrigax@gmail.com>
1 parent 1e89b09 commit da84a0b

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

Maya/Exporter/BabylonExporter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ public void Export(ExportParameters exportParameters)
161161
}
162162
}
163163

164+
Tools.GetProductVersion(out string product, out string version);
165+
164166
// Producer
165167
babylonScene.producer = new BabylonProducer
166168
{
167-
name = "Maya",
168-
version = "2018",
169+
name = product,
170+
version = version,
169171
exporter_version = exporterVersion,
170172
file = outputFileName
171173
};

Maya/Tools/Tools.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,26 @@ public static void UpdateCheckBox(CheckBox checkBox, MPxNode node, string proper
189189
}
190190
}
191191

192+
public static void GetProductVersion(out string product, out string version)
193+
{
194+
// The easy going solution is to relay on c# API MGlobal.mayaVersion, however, with miss the minor of the version
195+
// and still have to set the name by hand.
196+
string[] versionParts = null;
197+
try
198+
{
199+
versionParts = MGlobal.executeCommandStringResult("about -iv").Split();
200+
}
201+
catch
202+
{
203+
// we anticipate possible error.
204+
}
205+
versionParts = versionParts ?? new string[] { "Maya", MGlobal.mayaVersion ?? string.Empty };
206+
var l = versionParts.Length - 1;
207+
208+
product = String.Join(" ", versionParts, 0, l);
209+
version = versionParts[l];
210+
}
211+
192212
// -------------------------
193213
// --------- Math ----------
194214
// -------------------------

0 commit comments

Comments
 (0)