Update: I got this working in blender 2.8.
I modified the setup animation function, to allow for a easier axis switch. z_axis -> y_axis and y_axis -> z_axis. The spring way.
Code: Select all
function setupAnimation()
local map = Spring.GetUnitPieceMap(unitID);
local switchAxis = function(axis)
if axis == z_axis then return y_axis end
if axis == y_axis then return z_axis end
return axis
end
local offsets = constructSkeleton(unitID, map.root, {0,0,0});
for a,anim in pairs(Animations) do
for i,keyframe in pairs(anim) do
local commands = keyframe.commands;
for k,command in pairs(commands) do
-- commands are described in (c)ommand,(p)iece,(a)xis,(t)arget,(s)peed format
-- the t attribute needs to be adjusted for move commands from blender's absolute values
if (command.c == "move") then
local adjusted = command.t - (offsets[command.p][command.a]);
Animations[a][i]['commands'][k].t = command.t - (offsets[command.p][command.a]);
end
Animations[a][i]['commands'][k].a = switchAxis(command.a)
end
end
end
end
After that i ran into the problem, that the move commands had the erronous offsets. In my case i removed them..
I also run into the problem, that any exported piece needed not only to be properly linked, but the also the rotation and scaling applied, otherwise the animation would be off.
This was for the original 3d editor to export this and for blender.
Hey, i finally got a animation pipeline.. the world is mine.