From c6bbdc46988891efa73e1a5bcc25e59d5bfe63f3 Mon Sep 17 00:00:00 2001 From: dvdvideo1234 Date: Sat, 30 Mar 2024 19:43:24 +0200 Subject: [PATCH] Fixed: Error when processing attachment transform when no attachment origin is available --- lua/autorun/trackassembly_init.lua | 2 +- lua/trackassembly/trackasmlib.lua | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lua/autorun/trackassembly_init.lua b/lua/autorun/trackassembly_init.lua index 2fc6b8a..33e2d98 100644 --- a/lua/autorun/trackassembly_init.lua +++ b/lua/autorun/trackassembly_init.lua @@ -84,7 +84,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present ------------ CONFIGURE ASMLIB ------------ asmlib.InitBase("track","assembly") -asmlib.SetOpVar("TOOL_VERSION","8.743") +asmlib.SetOpVar("TOOL_VERSION","8.744") asmlib.SetIndexes("V" ,1,2,3) asmlib.SetIndexes("A" ,1,2,3) asmlib.SetIndexes("WV",1,2,3) diff --git a/lua/trackassembly/trackasmlib.lua b/lua/trackassembly/trackasmlib.lua index b4497eb..d23d295 100644 --- a/lua/trackassembly/trackasmlib.lua +++ b/lua/trackassembly/trackasmlib.lua @@ -2281,15 +2281,17 @@ function LocatePOA(oRec, ivPoID) LogInstance("Angle transform from model "..GetReport3(ID, sA, StringPOA(tOA.A, "A"))) end -- Transform angle is decoded from the model and stored in the cache -------------------- Point -------------------- - if(sP:sub(1,1) == sD) then -- Check whenever point is disabled - ReloadPOA(tOA.O[cvX], tOA.O[cvY], tOA.O[cvZ]) -- Override with the origin - else -- When the point is disabled take the origin otherwise try to process it - if(IsNull(sP) or IsBlank(sP)) then -- In case of empty value or null use the origin - ReloadPOA(tOA.O[cvX], tOA.O[cvY], tOA.O[cvZ]) -- Override with the origin - else -- When the point is empty use the origin otherwise decode the value - if(not DecodePOA(sP)) then LogInstance("Point mismatch "..GetReport2(ID, oRec.Slot)) end - end -- The point is already decoded and ready to be populated in the cache - end; if(not IsHere(TransferPOA(tOA.P, "V"))) then LogInstance("Point transfer fail"); return nil end + if(sP) then -- There is still comething to be processed after the registration + if(sP:sub(1,1) == sD) then -- Check whenever point is disabled + ReloadPOA(tOA.O[cvX], tOA.O[cvY], tOA.O[cvZ]) -- Override with the origin + else -- When the point is disabled take the origin otherwise try to process it + if(IsNull(sP) or IsBlank(sP)) then -- In case of empty value or null use the origin + ReloadPOA(tOA.O[cvX], tOA.O[cvY], tOA.O[cvZ]) -- Override with the origin + else -- When the point is empty use the origin otherwise decode the value + if(not DecodePOA(sP)) then LogInstance("Point mismatch "..GetReport2(ID, oRec.Slot)) end + end -- The point is already decoded and ready to be populated in the cache + end; if(not IsHere(TransferPOA(tOA.P, "V"))) then LogInstance("Point transfer fail"); return nil end + end -- Otherwise point is initialized on registration and we have nothing to do here end -- Loop and transform all the POA configuration at once. Game model slot will be taken end; return stPOA, iPoID end @@ -2340,7 +2342,7 @@ function RegisterPOA(stData, ivID, sP, sO, sA) elseif(sP:sub(1,1) == sD) then -- Point is disabled ReloadPOA(tOffs.O[cvX], tOffs.O[cvY], tOffs.O[cvZ]) else -- when the point is disabled take the origin - if(IsNull(sP) or IsBlank(sP)) then + if(IsNull(sP) or IsBlank(sP)) then -- Empty value ReloadPOA(tOffs.O[cvX], tOffs.O[cvY], tOffs.O[cvZ]) else -- When the point is empty use the origin otherwise decode the value if(not DecodePOA(sP)) then LogInstance("Point mismatch "..GetReport2(iID, stData.Slot)) end