From ce802faaeba925c9085486784a84385e23b2786e Mon Sep 17 00:00:00 2001 From: pudingus <39903631+pudingus@users.noreply.github.com> Date: Thu, 29 Oct 2020 14:24:29 +0100 Subject: [PATCH] Fix 3ds max 2009 --- scripts/max4ds/4ds_export.ms | 12 +++++++++--- scripts/max4ds/4ds_import.ms | 10 +++++----- scripts/max4ds/4ds_parser.ms | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/scripts/max4ds/4ds_export.ms b/scripts/max4ds/4ds_export.ms index 27a3ae2..958c5f7 100644 --- a/scripts/max4ds/4ds_export.ms +++ b/scripts/max4ds/4ds_export.ms @@ -1112,9 +1112,13 @@ rollout MafiaTools_4dsExport "" ( --module local baseMesh = copy basenode.mesh local layers = #() - + + local numChannels = + if WM3_NumberOfChannels == undefined then 100 + else WM3_NumberOfChannels mrph + local channelsPerLayer = 10 - local maxLayers = ( (WM3_NumberOfChannels mrph) / channelsPerLayer ) as integer + local maxLayers = ( (numChannels) / channelsPerLayer ) as integer local scl = scaleMatrix [unitscl,unitscl,unitscl] @@ -1461,7 +1465,9 @@ rollout MafiaTools_4dsExport "" ( --module ) fn MorpherHasData mrph = ( - local numChannels = WM3_NumberOfChannels mrph + local numChannels = + if WM3_NumberOfChannels == undefined then 100 + else WM3_NumberOfChannels mrph local found = false diff --git a/scripts/max4ds/4ds_import.ms b/scripts/max4ds/4ds_import.ms index f102ff9..a392829 100644 --- a/scripts/max4ds/4ds_import.ms +++ b/scripts/max4ds/4ds_import.ms @@ -141,11 +141,11 @@ rollout MafiaTools_4dsImport "" ( --module local tmod = Morpher() addModifier nnode tmod - -- local maxver = (maxversion())[1] - -- if maxver < 22000 then ( - -- max modify mode - -- select nnode - -- ) + local maxver = (maxversion())[1] + if maxver < 15000 then ( --2013 works without selecting, 2009 doesnt, todo: find which version exactly + max modify mode + select nnode + ) local letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" diff --git a/scripts/max4ds/4ds_parser.ms b/scripts/max4ds/4ds_parser.ms index 6fcf754..1e6f3bb 100644 --- a/scripts/max4ds/4ds_parser.ms +++ b/scripts/max4ds/4ds_parser.ms @@ -215,9 +215,9 @@ rollout MafiaTools_4dsParser "" ( --module WriteShort f m4ds.objects.count for mobj in m4ds.objects do ( WriteObject f mobj - ) + ) - WriteByte f (m4ds.allow5ds as integer) + WriteByte f (if m4ds.allow5ds then 1 else 0) ) -------------------------------------------------