Download

Extract *.umap file

I want to extract all information from an *.umap file.

What I have is the following:



UPackage *Package = Cast<UPackage>(LoadPackage(NULL, TEXT("/Game/Maps/StarterMap.umap"), LOAD_None));
if (!Package)
{
	fprintf(fptr, "Error loading package
");
}
else
{
	TArray<UObject *> LoadedObjects;
	for (TObjectIterator<UObject> It; It; ++It)
	{
		if (It->GetOuter() == Package)
		{
			LoadedObjects.Add(*It);
		}
	}
	fprintf(fptr, "Successfully loaded package: %d
", LoadedObjects.Num());

	for (int32 i = 0; i < LoadedObjects.Num(); ++i)
	{
		const UObject *obj = LoadedObjects*;
		const FString name = obj->GetName();
		for (int32 j = 0; j < name.GetCharArray().Num() - 1; ++j)
		{
			fprintf(fptr, "%c", name.GetCharArray()[j]);
		}
		fprintf(fptr, "
");
	}
}


What I get from the code above is the following:



Successfully loaded package: 23
*** BlueprintGeneratedClass
*** World
*** BlueprintGeneratedClass
*** MetaData
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** LightMapTexture2D
*** Model
*** Polys
*** ShadowMapTexture2D
*** ShadowMapTexture2D
*** ShadowMapTexture2D
*** ShadowMapTexture2D
*** ShadowMapTexture2D


My problem is now that I have no idea how to get the geometry/transformations from the information above. I tried to getClass()->getName() to see if there is a UStaticMesh for example. Any help on how I can access the geometry?

It’s a hierarchy. The World you see in your list above contains Level objects, which in turn contain Actor objects, some of which may be StaticMeshActor or Blueprint instances that in turn contain a StaticMeshComponent. However, none of them will contain UStaticMesh objects since those are assets stored in a .uasset, rather than a .umap (the components may reference an asset, but won’t contain it; the one exception being lightmap textures which are kind of like assets but return false for IsAsset because they are embedded)

What’s your goal? There may be better ways to find or work with all actors in a level, either interactively or at runtime, and there are certainly better ways to just find all content referenced by a set of objects (one of the reference collector archivers for example).

Cheers,
Michael Noland

I am writing a custom renderer and therefore I would like to access the geometry/transformations/lights etc.

I thought the best way would be to extract all the data from an *.umap file and feed it to my renderer. Do you know a better way to achieve this goal or is it possible directly render into the editor’s viewport?

Thanks for your answer/help.

Well since you have obtained UE4 you have full source code access and hence you can modify the renderer or create a new one without hacking.

You also do brute force searches using things like GetObjectsWithOuter or TObjectIterator + a filter for GetTypedOuter == world, but that’s not particularly fast.

Worlds contain a scene (see FSceneInterface), and actors register their components with that scene, so it is probably a better starting point for enumerating over components present in the scene. You could query the list or replace the renderer at that level, or you could replace it deeper at the render-thread interface, but I’m wondering why you are replacing the renderer? If it’s a learning experience or a research testbed, then that’s great, but if you’re trying to accomplish something else you might instead want to hook into the existing renderer or add custom scene proxies or some other approach.

Cheers,
Michael Noland

First: My deepest and most sincerest apologies if this kind of talk upsets or offends you
in any way, but I’ve reached the limits of what I can figure out on my own.

I’m trying to get the attention of a certain company that I wish to apply to, and part of my game plan is to present a project to them that uses their very own assets.

I’ve managed to extract all of the objects from the BG that I wish to use but they are all individual and have o,o,o for their coordinates.

I’m looking for which file has the transforms for each piece of geo referenced, so that rebuilding the BG won’t be such a daunting task.

I tried putting the original game’s BG folder into a new project’s Content folder but the uasset files are invisible to the Content Browser. I also tried every remedy I could find on how to make uasset files visible(proper version number, putting content folder in Sample/StarterContent folder, etc). I’m guessing they are protected and it’s impossible from inside Unreal Engine.

So any clues on which file types I need to pay attention to or what might be the best method
of getting the transform info would be greatly appreciated. Please keep in mind that I am new to this as you explain( If you decide to).
I’m asking here because this topic is the most relevant that I could find.

Best

If u manage to complete your “project”, u will most likely get the attention of the company who own the original assets, but not the way u want.
Unless u have permission to use the content, u will get yourself into trouble with this (copyright violation).

What u want should be possible and u will most likely find the solution within the UE4 source, but i don’t think anyone will give the a ready answer to help u with illegal activities :slight_smile:

Totally understandable, hence my opening apology. But it’s a risk I’m willing to take. Many thanks for the direction/insight, I’ll see what I can figure out. :slight_smile: