Gildor's Forums

Author Topic: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)  (Read 15970 times)
Richtoveen
Newbie
*
Posts: 14


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #30 on: May 23, 2022, 05:56 »

Animations with Compression don't really open does anyone have a fix?
Logged
akkk44
Newbie
*
Posts: 1


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #31 on: May 23, 2022, 07:52 »

Greetings, it seems that even though I commend the return false line in the source, the asset manager still refuse to open in 4.26. The script also gives me some errors. Is there a solution for 4.26?
Logged
Richtoveen
Newbie
*
Posts: 14


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #32 on: May 24, 2022, 00:30 »

Greetings, it seems that even though I commend the return false line in the source, the asset manager still refuse to open in 4.26. The script also gives me some errors. Is there a solution for 4.26?
As of 4.24 its AssetEditorSubsystem which you have to change the line..

Logged
Richtoveen
Newbie
*
Posts: 14


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #33 on: May 24, 2022, 00:32 »

animations are not working right now this is the stack that crashes does anyone have any fix? https://imgur.com/a/csO0cTf
Logged
Vincent Donald
Newbie
*
Posts: 4


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #34 on: October 04, 2022, 20:21 »

Hello mage200, It works for me with old 4.22 BnS and V4 Paks. UModel is still needed to find/save .uassets and export textures/sound.
Only works with UE4.22 and UE4.23 though  Sad
 

do you have any tutorial? i have try with this decook function with V4 but don't have any idea how to start to import animation into a specific skeleton
Logged
Dreadfred
Sponsor
Jr. Member
*
Posts: 46


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #35 on: October 11, 2022, 01:29 »

Hello Vincent,
I should have linked the hair idle animation to 03 hair mesh, other characters might differ. If you want to make character playable or place in level/world you will need to setup a blueprint, here's a link to a good basic tutorial Its in ue5 but would work in 4.26 and above (Uses enhanced input) ]https://dev.epicgames.com/community/learning/courses/kry/build-a-third-person-character-from-scratch/mDv/build-a-third-person-character-from-scratch-introduction]
you should be able to put it all together using set master pose component (V4) or Copy pose from mesh (games like blade and soul).
« Last Edit: November 09, 2022, 22:54 by Dreadfred » Logged
Switterbeet-xo
Newbie
*
Posts: 3


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #36 on: October 26, 2022, 22:54 »

Hey, i tried this with UE 4.25 Plus and i get Assertion failed: file Array.h Line 674 Array index out of bounds: 49 from an array of size 49 when i click on the model in Ueditor and try to load it in the viewport. You got any clue how to fix? Also my Array.h does end on Line 322, one Boots model did work tho, it seems like some files are working but most not
Logged
artifex0
Newbie
*
Posts: 1


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #37 on: January 29, 2023, 04:32 »

I was able to get this sort of working in UE 4.26.2.

In addition to the instructions in the video, I commented out the return false under if (Package->bIsCookedForEditor) in Engine\Source\Editor\UnrealEd\Private\Subsystems\AssetEditorSubsystem.cpp and compiled.

Since I don't really know C++, I didn't understand most of the code in the custom class- but I described the various errors I experienced to ChatGPT, and it produced the following modifications:

AssetDecooker.h:
Code:

// Youtube → Notorious R

#pragma once

#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "UObject/NoExportTypes.h"
#include "Materials/Material.h"
#include "AssetDecooker.generated.h"

UCLASS()
class BLANKSANDBOX_API UAssetDecooker : public UObject
{
GENERATED_BODY()

public:
UFUNCTION(BlueprintCallable, Category = "Asset Tools", meta = (DisplayName = "Decook Assets"))
static void DecookAssets(TArray<UObject*> Objects);
};



AssetDecooker.cpp line 101:
Code:
if (lodData.SkinWeightVertexBuffer.GetNumVertices() > 0)
{
FSkinWeightInfo info = lodData.SkinWeightVertexBuffer.GetVertexSkinWeights(idx);
FMemory::Memcpy(vtx.InfluenceBones, info.InfluenceBones, sizeof(info.InfluenceBones));
FMemory::Memcpy(vtx.InfluenceWeights, info.InfluenceWeights, sizeof(info.InfluenceWeights));
}

AssetDecooker.cpp line 114:
Code:
if (range.Length > 0)
{
TArray<int32> indices2;
indices2.Reserve(range.Length);
for (uint32 l = 0; l < range.Length; ++l)
indices2.Add(renderSection.DuplicatedVerticesBuffer.DupVertData[range.Index + l]);

section.OverlappingVertices.Add(k, indices2);
}

AssetDecooker.cpp line 219:
Code:
if (UAnimSequence* typedAsset2 = Cast<UAnimSequence>(asset))
dstPackage = DecookAnimSequence(typedAsset2);
else if (USkeletalMesh* typedAsset3 = Cast<USkeletalMesh>(asset))
dstPackage = DecookSkeletalMesh(typedAsset3);
else if (UPhysicsAsset* typedAsset4 = Cast<UPhysicsAsset>(asset))
dstPackage = DecookPhysicsAsset(typedAsset4);

if (dstPackage != nullptr) {
FString packageName = dstPackage->GetName();
FString savePath = FPaths::ProjectContentDir() + packageName;
dstPackage->MarkPackageDirty();
UPackage::SavePackage(dstPackage, NULL, RF_Standalone, *savePath, GError, nullptr, false, true, SAVE_NoError);
savePackages.Add(dstPackage);
}

This code doesn't actually save the uncooked model in the correct directory, and you'll need to manually add the .uasset extension to the files it produces- probably easy fixes, but I'm dead tired of trying to get this to work, so I'll leave that for someone else to correct.  Note also that you'll need to replace "BLANKSANDBOX" in AssetDecooker.h with the name of your project.

I was able to successfully uncook a skeletalmesh with this code and export a .fbx.  This was a model with more than four skin weights per vertex, so neither umodel nor FModel were able to export it correctly (they discard the smallest weights when there are more than four, which led to serious clipping problems in this case). The model exported with this method, however, did have all of the correct skin weights.  Thanks, Soulax!
« Last Edit: January 29, 2023, 04:37 by artifex0 » Logged
spiritovod
Global Moderator
Hero Member
*****
Posts: 2168


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #38 on: January 30, 2023, 19:21 »

@artifex0: Thanks for this addition, it looks promising. Could you please also provide some cooked meshes with clipping issues, if possible with some close up screenshots of the issue? I'm curious what's the actual difference between original and renormalized weights for such meshes (umodel is doing it in case of weights issues), but it's hard to reproduce without actual samples.
Logged
Aoe
Newbie
*
Posts: 1


View Profile
Re: [TUTORIAL] How to "Uncook" assets (with some limitations for the moment)
« Reply #39 on: November 29, 2023, 20:52 »

So how can I uncook assets in 4.26.2 and same question for 5.3.2

https://dev.epicgames.com/community/snippets/QE0/unreal-engine-cooked-asset-uncooked-asset-editor-script

Pasted this but it is not working, are some values missing when you paste it or is it some setting they missed that I don't have active?

Actually followed the french guys video and managed to build the engine but in 4.26.2 the 4.22 attempt failed.

I am surprised it is so hard to find guides for this.

When I try to use uncook script action in unmodded engine i get: Assertion failed: Owner->IsMeshDescriptionValid(0) [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp] [Line: 2569] Bad MeshDescription on /Game/Inventory/B1
« Last Edit: November 30, 2023, 02:30 by Aoe » Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS