Blender animation export has been deployed! - Page 3

Blender animation export has been deployed!

Share and discuss visual creations and creation practices like texturing, modelling and musing on the meaning of life.

Moderators: MR.D, Moderators

User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Blender animation export has been deployed!

Post by Anarchid »

so it had less to do with the z_isup in the exported file and more to do with the exporter? Wierd shit.
More likely that the obj was already Z_UP. I guess i still have to try Y_UP export.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Blender animation export has been deployed!

Post by PicassoCT »

Never shared how i prep these exported script for journeywar s3o use:

Tutorial on using Anarchids
exchanged z - y axis
inverted rotations for y_axis

undo axischange for movement

Regexes to find those:

Code: Select all

{\['c']='turn',\['p']=([^\s]+), \['a']=y_axis, \['t']=-1\*
{\['c']='move',\['p']=([^\s]+), \['a']=y_axis, \['t']=-1\*
{\['c']='move',\['p']=\1, \['a']=y_axis, \['t']=\*
{\['c']='move',\['p']=([^\s]+), \['a']=([^\s]+), \['t']=([^\n]+), \['s']=([^\n]+)\}\,
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Blender animation export has been deployed!

Post by PicassoCT »

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.
Post Reply

Return to “Art & Modelling”