Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions [editor]/edf/edf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ function edfGetElementPosition(element)
end
end

--Returns an element's rotation, or its rotX/Y/Z element data, or false
--Returns an element's rotation, or its rotX/Y/Z element data, or 0,0,0
function edfGetElementRotation(element)
local etype = getElementType(element)
local rx, ry, rz
Expand All @@ -871,15 +871,12 @@ function edfGetElementRotation(element)
else
rx = tonumber(getElementData(element,"rotX"))
ry = tonumber(getElementData(element,"rotY"))
rz = tonumber(getElementData(element,"rotZ"))
-- old race maps use rotation="360" instead of rotX/Y/Z
rz = tonumber(getElementData(element,"rotZ")) or tonumber(getElementData(element,"rotation"))
end
end

if rx and ry and rz then
return rx, ry, rz
else
return false
end
return rx or 0, ry or 0, rz or 0
end

--Returns an element's scale, or its scale element data, or false
Expand Down
9 changes: 3 additions & 6 deletions [editor]/edf/edf_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,12 @@ function edfGetElementRotation(element)
else
rx = tonumber(getElementData(element,"rotX"))
ry = tonumber(getElementData(element,"rotY"))
rz = tonumber(getElementData(element,"rotZ"))
-- old race maps use rotation="360" instead of rotX/Y/Z
rz = tonumber(getElementData(element,"rotZ")) or tonumber(getElementData(element,"rotation"))
end
end

if rx and ry and rz then
return rx, ry, rz
else
return false
end
return rx or 0, ry or 0, rz or 0
end

--Returns an element's scale, or its scale element data, or 1
Expand Down
4 changes: 4 additions & 0 deletions [editor]/editor_main/server/saveloadtest_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,10 @@ function createElementAttributesForSaving(xmlNode, element)
xmlNodeSetAttribute(elementNode, "posZ", toAttribute(round(dataValue[3], 5)))
posSetX, posSetY, posSetZ = true, true, true
elseif ( dataName == "rotation" ) then
-- old race maps rotation isn't a table, so we need to convert it to a table
if type(dataValue) ~= "table" then
dataValue = { 0, 0, tonumber(dataValue) or 0 }
end
if dataValue[4] == "ZYX" then
local skipConversion = getElementType(element) == "vehicle"
if not skipConversion then
Expand Down