// load keyframes from a brlan file
u32 Animator::LoadAnimators(const RLAN_Header *header, Layout& layout )
{

	gprintf( "don't call this  %s %u\n", __FILE__, __LINE__ );
	u32 frame_count = 0;

	if (header->magic != MAGIC_ANIMATION || header->endian != 0xFEFF || header->version != 0x0008)
		return 0;	// bad header

	// first section
	const u8 *position = ((const u8 *) header) + header->offset;

	for(u32 i = 0; i < header->section_count; ++i)
	{
		section_t *section = (section_t *) position;
		position += section->size;

		if (section->magic == MAGIC_PANE_ANIMATION_INFO)
		{
			const PAI1_Header *pai = (const PAI1_Header *) section;
			u16 animator_count = pai->animator_count;
			frame_count += pai->frame_count;

			// read animation file names
			/*const u32 *nameOffsets = (const u32 *)(pai + 1);
			for(u32 i = 0; i < pai->file_count; i++)
			{
				const char* name = (((const char *) nameOffsets) + nameOffsets[i]);
				layout.AddPalette(name );
			}*/

			const u32 *offsets = (const u32 *) (((const u8 *)section) + pai->entry_offset);
			// read each animator
			for(u32 n = 0; n < animator_count; n++)
			{
				const AnimatorHeader *animHdr = (const AnimatorHeader *) (((const u8 *)section) + offsets[n]);
				std::string anim_name(animHdr->name, 0, 20);

				Animator* animator = animHdr->is_material ?
						(Animator*) layout.FindMaterial(anim_name) :
						(Animator*) layout.FindPane(anim_name);

				if (animator)
					animator->LoadKeyFrames((const u8 *) animHdr, animHdr->tag_count, sizeof(AnimatorHeader) );
			}
		}
		else
		{
			gprintf("Unknown: %c%c%c%c\n", position[0], position[1], position[2], position[3]);
		}
	}

	return frame_count;
}