Code Monkey home page Code Monkey logo

prefabricator-ue4's Introduction

prefabricator-ue4's People

Contributors

cj-coalition avatar coderespawn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prefabricator-ue4's Issues

[UE5.1] Editor crashes if Prefab is assigned as ChildActor in BP

Hi there,

I can't use a prefab within a child actor.
If I assign a prefab to a child actor the editor crashes with the following log:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000358

UnrealEditor_PrefabricatorRuntime!TConstSetBitIterator::TConstSetBitIterator() [D:\RocketSync\5.1.0-23058290+++UE5+Release-5.1\Working\Engine\Source\Runtime\Core\Public\Containers\BitArray.h:1781]
UnrealEditor_PrefabricatorRuntime!FPrefabTools::LoadStateFromPrefabAsset() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:898]
UnrealEditor_PrefabricatorRuntime!APrefabActor::LoadPrefab() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabActor.cpp:109]
UnrealEditor_PrefabricatorRuntime!UPrefabComponent::PostEditChangeProperty() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabComponent.cpp:73]
UnrealEditor_CoreUObject
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_ApplicationCore
UnrealEditor_ApplicationCore
UnrealEditor_ApplicationCore
UnrealEditor_ApplicationCore
user32
user32
UnrealEditor_ApplicationCore
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

Is there a workaround?
I'd like to use prefabs on construction as well

Best regards!

Volumes lose "Collision" after being saved to a prefab

Hello, I've found an issue with adding volumes (eg NavMeshVolumes) to prefabs after updating from the plugin version 1.4 to 1.5.2

Setup:
First test used:
Unreal Engine 4.25.1
Prefabricator Release 1.4.0

Second test used:
Unreal Engine 4.25.1
Prefabricator Release 1.5.2

Steps:

  1. Create a prefab that contains a volume
  2. Save the prefab
  3. Pull the prefab from the content browser into a scene
  4. The volume in the prefab will no longer have any "collision" (output log states this), it also seems to break on rebuilding geometry with an assertion error in the unreal engine

I'll attach videos to discord with the tests I did above

Notes - I think it might be due to a change on how prefabs are saved, I noticed during the testing above that my prefab saved using the 1.4 plugin correctly "saved" the volume collision, as it loaded into the level when I pulled it out while testing the 1.5.2 plugin (before running the second test)

I'll see if i can do some digging on this now

Prefabricator is totally broken

After creating prefabs and prefab collections, after restarting editor every prefab collection is broken. When I drag new prefabs (nested prefab collections) into the editor window the prefabs are completely empty. Existing prefabs already in the level won't randomize anymore.

Try this:

In PrefabricatorAsset.cpp, line 99:

        if (PrefabAssetPtr.IsNull()) {
            PrefabAssetPtr = Prefabs.Last().PrefabAsset;
        }
    }
    if (!PrefabAssetPtr.IsNull()) {
        return PrefabAssetPtr.LoadSynchronous();
    }
    return nullptr;


UE5 - Plugin fails to build

On initial build, the FBox cannot be constructed with just a single FVector?

\BuiltPlugins\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp(720): error C2440: '': cannot convert from 'initializer list' to 'FBox'

\BuiltPlugins\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp(720): note: No constructor could take the source type, or constructor overload resolution was ambiguous

After removing the check above, I am also seeing build errors for UActorFactory::SpawnActor marked as final?

\Plugins\Prefabricator\Source\PrefabricatorEditor\Public\Asset\PrefabricatorActorFactory.h(14): error C3248: 'UActorFactory::SpawnActor': function declared as 'final' cannot be overridden by 'UPrefabricatorActorFactory::SpawnActor'

\Unreal\Engine\Source\Editor\UnrealEd\Classes\ActorFactories\ActorFactory.h(103): note: see declaration of 'UActorFactory::SpawnActor'

Components added to child actors are not applied to prefab.

When modifying an existing prefab, adding a component and saving new changes to the prefab doesn't apply that component to the prefab asset.

Expectation: Prefabs created or modified with additional components added in level editor should save that added component along with any modifications to said component.

ctrl-B (Browse) navigates to the original mesh, not the prefab

This occurs regardless of if it's the original mesh(s) converted to a prefab, or dropping an already created prefab into the scene and using Browse to there.

Update: Bit of a misunderstanding, actually it doesn't browse to anything at all, but it does flash the Content Browser.

Beautiful plugin by the way, really appreciate you doing this.

CTRL+Z Make unreal crash

Hello,
After you use the ctrl+z shortcut the engine crash, really often and annoying.
I hope you can fix this.

Thanks.

Actors randomly renamed to StaticMeshActorXXX and similarly

Mesh names can be very useful when trying to select groups of meshes within many prefabs in a level. All one needs to do is to write a substring of the mesh name and only the right ones are listed.

However, Prefabricator doesn't seem to always do it right. Prefabricator seems to correctly save the names of actors inside it when created or updated. However, it tends to break when creating randomised copies of the prefabs.

I have created a prefab containing some prefab collections (of the same type), each of them with 4 variations. Usually, the actor names appeared as they were saved. Then I created many other instances of that prefab, or reloaded old versions, and the actor names were not correct. The names were typically something like StaticMeshActor2141 when the number was automatically generated. Re-randomising the prefabs could randomly fix it or break existing correctly names actors. After several repetitions, it got so bad that the names were almost never correct.

Steps to repeat it reliably:

  1. Create a prefab that also contains a prefab collection
  2. Create several instances of the prefab (the problem seems to be getting worse after the content is generated many times), randomisation alone sometimes works too
  3. Some of the actors in the prefab will have generated names instead of the names in the original objects, such as StaticMeshActor4214

This effectively prevents using the actor names for anything meaningful without manual correction afterwards.

I am using commit 5c08a0c with UE4.24.

Prefabricator & WorldPartition

I'v ported prefabricator to UE5 preview (just some member access are replaced by getters realy, no breaking changes), but
when using prefabs with WorldPartition all works in editor, but there is no way to build package as for every prefab those errors occur:

LoadErrors: Error: /Game/ExternalActors/Game/Maps/_WORKSPACES/WORKSPACE_WP1/02/84/9C5WXNTJTW5XVGSULS1D3 : Failed import for PrefabActor /Game/Game/Maps/_WORKSPACES/WORKSPACE_WP1.WORKSPACE_WP1:PersistentLevel.ESV_AirInternational_01_15 Referenced by export StaticMeshComponent /Game/Game/Maps/_WORKSPACES/WORKSPACE_WP1.WORKSPACE_WP1:PersistentLevel.StaticMeshActor_UAID_4CCC6AF537C1CCA600_1379263771.StaticMeshComponent0

LoadErrors: Error: /Game/ExternalActors/Game/Maps/_WORKSPACES/WORKSPACE_WP1/02/84/9C5WXNTJTW5XVGSULS1D3 : Failed import for PrefabComponent /Game/Game/Maps/_WORKSPACES/WORKSPACE_WP1.WORKSPACE_WP1:PersistentLevel.ESV_AirInternational_01_15.PrefabComponent Referenced by export StaticMeshComponent /Game/Game/Maps/_WORKSPACES/WORKSPACE_WP1.WORKSPACE_WP1:PersistentLevel.StaticMeshActor_UAID_4CCC6AF537C1CCA600_1379263771.StaticMeshComponent0

any ideas what might it be ?

How to spawn a prefab from C++?

Hi,

First of all thanks for this amazing plugin!

I can't find any C++ examples of how to Spawn a prefab. From the source code I see there is a method to do it, but I can't figure out how to include it to my project? I mean what #include I need to use to get access to APrefabActor type and SpawnPrefab method?

    UPROPERTY(EditDefaultsOnly)
    APrefabActor* MyPrefab;

and then I need to call from my cpp

SpawnPrefab(const UObject* WorldContextObject, UPrefabricatorAssetInterface* MyPrefab, const FTransform& Transform, int32 Seed);

PrefabActor lost prefab asset reference when renaming prefab asset.

Hi!
First of all Awesome tool we really like it a lot. =)
Unfortunatly we stumble upon a bug, but fortunatly we got a pretty straight forward repro.

  1. Create an empty level (file new leveldefault)
  2. Drag and drop a cube static mesh in the level
  3. Select it and create prefab from selection.
  4. Rename the prefab asset
  5. Save AS your level
  6. File New level default
  7. file open level (your saved map)

->The PrefabActor is now pointing to a "None" prefab
image

Regards
Hervé

Editor crash when creating prefab from attached/hierarchical actors

I consistently get an editor crash when I try to create a Prefab from two attached actors.

grafik

This is easily reproducable on my machine by attaching two actors to each other in the world, selecting one or both and creating a Prefab from the selection.
I am on the latest Prefabricator version (1.6.2) from the marketplace for UE4.26.1.

Assertion failed: ChildRoot [File:D:/Build/++Portal+Promotion/Sync/LocalBuilds/PluginTemp/HostProject/Plugins/Prefabricator/Source/PrefabricatorEditor/Private/Utils/PrefabricatorEditorService.cpp] [Line: 36]

UE4Editor_Core
UE4Editor_Core
UE4Editor_PrefabricatorEditor!FPrefabricatorEditorService::ParentActors() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorEditor\Private\Utils\PrefabricatorEditorService.cpp:36]
UE4Editor_PrefabricatorRuntime!FPrefabTools::ParentActors() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:54]
UE4Editor_PrefabricatorRuntime!FPrefabTools::LoadStateFromPrefabAsset() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:844]
UE4Editor_PrefabricatorRuntime!APrefabActor::LoadPrefab() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabActor.cpp:109]
UE4Editor_PrefabricatorEditor!FPrefabricatorAssetThumbnailScene::SetPrefabAsset() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorEditor\Private\Asset\Thumbnail\PrefabricatorAssetThumbnailScene.cpp:41]
UE4Editor_PrefabricatorEditor!FPrefabEditorTools::CapturePrefabAssetThumbnail() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorEditor\Private\Utils\PrefabEditorTools.cpp:109]
UE4Editor_PrefabricatorRuntime!FPrefabTools::SaveStateToPrefabAsset() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:298]
UE4Editor_PrefabricatorRuntime!FPrefabTools::CreatePrefabFromActors() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:190]
UE4Editor_PrefabricatorRuntime!FPrefabTools::CreatePrefab() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:115]
UE4Editor_PrefabricatorEditor!TBaseStaticDelegateInstance<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\RocketSync\4.26.0-14830424+++UE4+Release-4.26\Working\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:731]
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
.
.
.

Making a prefab from lights goes to world origin

Steps to reproduce:

  • make a light or lights
  • select the light(s)
  • create a prefab (from selection)

-> prefab is located at 0,0,0

Also, if a prefab contains lights, those don't affect the prefabs pivot point.

"Randomize" button on a collection will only randomize between loaded assets

If you have a collection, that contains a couple of prefabs, and this collection has been placed into a level, then the "Randomize" button on the instantiated collection will sometimes not randomize between all its prefabs. Rather, it seems that it will only randomize between the prefabs that are currently loaded.

Repro steps:

  • Start UE4
  • Create a blank project
  • Install Prefabricator
  • Create 3 prefabs (for example, one with a cube, one with a cylinder, and one with a sphere mesh)
  • Create a collection that contains all 3 prefabs
  • Place prefab 1 into the level
  • Place prefab 2 into the level
  • Shut down UE4
  • Start UE4
  • Open project
  • Place the collection into the level
  • Click "Randomize" repeatedly on the collection
  • Observe how the "Randomize" action will only switch between prefabs 1 & 2
  • Place prefab 3 into the level
  • Click "Randomize" repeatedly on the collection
  • Observe how the "Randomize" action will now switch between prefabs 1, 2 & 3
  • Remove prefab 3 from the level
  • Click "Randomize" repeatedly on the collection
  • Observe how the "Randomize" action will still switch between prefabs 1, 2 & 3
  • Save & exit UE4
  • Start UE4
  • Open project
  • Click "Randomize" repeatedly on the collection
  • Observe how the "Randomize" action will again only switch between prefabs 1 & 2

I haven't looked deeply into the code, but I suspect that the randomization mechanism will skip prefabs that are not currently loaded. The appropriate behavior is to force loading of the asset that is chosen by the randomization. (Or: first force loading of all assets referenced by the collection, then randomize between the assets that are loaded.)

Nav Mesh Modifiers Issue

Nav mesh modifiers do not take effect when they are part of a prefab. The volume becomes invisible

Prefabrictor does not respect IWYU

IWYU (Include What You Use)
Currently working through include uses by turning off PCH usage in Unreal.
A nontrivial amount of issues are being encountered by Prefabricator headers not including dependencies.
I don't mind fixing these but I'm concerned about future integration issues.

Issue with cross reference actor support

I am having issue with the cross actor reference support. Specifically child actors are treated as cross reference actors which isn't the case right? At the very least isn't CrossReference a bad choice of name for this concept if it refers to a prefab's own child actors?

void FPrefabTools::SaveStateToPrefabAsset(APrefabActor* PrefabActor)
{
	if (!PrefabActor) {
		UE_LOG(LogPrefabTools, Error, TEXT("Invalid prefab actor reference"));
		return;
	}

	UPrefabricatorAsset* PrefabAsset = PrefabAsset = Cast<UPrefabricatorAsset>(PrefabActor->PrefabComponent->PrefabAssetInterface.LoadSynchronous());
	if (!PrefabAsset) {
		//UE_LOG(LogPrefabTools, Error, TEXT("Prefab asset is not assigned correctly"));
		return;
	}

	PrefabAsset->PrefabMobility = PrefabActor->GetRootComponent()->Mobility;

	PrefabAsset->ActorData.Reset();

	TArray<AActor*> Children;
	GetActorChildren(PrefabActor, Children);

	// Make sure the children do not have duplicate asset user data template ids
	{
		TSet<FGuid> VisitedItemId;
		for (AActor* ChildActor : Children) {
			if (ChildActor && ChildActor->GetRootComponent()) {
				UPrefabricatorAssetUserData* ChildUserData = ChildActor->GetRootComponent()->GetAssetUserData<UPrefabricatorAssetUserData>();
				if (ChildUserData) {
					if (VisitedItemId.Contains(ChildUserData->ItemID)) {
						ChildUserData->ItemID = FGuid::NewGuid();
						ChildUserData->Modify();
					}
					VisitedItemId.Add(ChildUserData->ItemID);
				}
			}
		}
	}

	struct FSaveContext {
		AActor* ChildActor;
		int32 ItemIndex;
	};

	FPrefabActorLookup ActorCrossReferences;
	TArray<FSaveContext> ItemsToSave;
	for (AActor* ChildActor : Children) {
		if (ChildActor && ChildActor->GetRootComponent()) {
			UPrefabricatorAssetUserData* ChildUserData = ChildActor->GetRootComponent()->GetAssetUserData<UPrefabricatorAssetUserData>();
			FGuid ItemID;
			if (ChildUserData && ChildUserData->PrefabActor == PrefabActor) {
				ItemID = ChildUserData->ItemID;
			}
			else {
				ItemID = FGuid::NewGuid();
			}
			AssignAssetUserData(ChildActor, ItemID, PrefabActor);
			int32 NewItemIndex = PrefabAsset->ActorData.AddDefaulted();
			FPrefabricatorActorData& ActorData = PrefabAsset->ActorData[NewItemIndex];
			ActorData.PrefabItemID = ItemID;
			ActorCrossReferences.Register(ChildActor, ItemID);

			FSaveContext SaveInfo;
			SaveInfo.ChildActor = ChildActor;
			SaveInfo.ItemIndex = NewItemIndex;
			ItemsToSave.Add(SaveInfo);
		}
	}

	for (const FSaveContext& SaveInfo : ItemsToSave) {
		AActor* ChildActor = SaveInfo.ChildActor;
		if (ChildActor && ChildActor->GetRootComponent()) {
			FPrefabricatorActorData& ActorData = PrefabAsset->ActorData[SaveInfo.ItemIndex];
			SaveActorState(ChildActor, PrefabActor, ActorCrossReferences, ActorData);
		}
	}
	PrefabAsset->Version = (uint32)EPrefabricatorAssetVersion::LatestVersion;

	PrefabActor->PrefabComponent->UpdateBounds();

	// Regenerate a new update id for the prefab asset
	PrefabAsset->LastUpdateID = FGuid::NewGuid();
	PrefabActor->LastUpdateID = PrefabAsset->LastUpdateID;
	PrefabAsset->Modify();

	TSharedPtr<IPrefabricatorService> Service = FPrefabricatorService::Get();
	if (Service.IsValid()) {
		Service->CaptureThumb(PrefabAsset);
	}
}

I noticed someone had the same issue in the past.
https://discord.com/channels/233207002463993857/530052996734779397/713112405722398730

LoadPrefab is not called correctly while SpawnActor

  1. drag a prefab to editor viewport
  2. UPrefabricatorActorFactory::SpawnActor called
  3. APrefabActor::PostActorCreated()->FPrefabTools::LoadStateFromPrefabAsset

but at this time, PrefabActor->GetPrefabAsset() == nullptr, so ActorState is not loaded

Prefabs not spawned in packaged game

Hi there,

we developed something in the editor using the plugin and it worked fine. The prefabs are spawned at runtime. Unfortunatelly they are not spawned (or are not visible) when packaging for windows 64 bit platform.
Do we have to do something or is this a bug?

Some prefabs reference levels which crashes map check on 4.26

I created a lot of prefabs with 4.25. If i place one of these prefabs in a level and build anything 4.26 crashes during map check. I could repair most prefabs by placing them and hit "Save Prefab to Asset" to resave them. Reference to level is gone then. Though a few prefabs keep the reference.

Meshes disappear when creating Prefab

I thought i would add this here so it does not get forgotten:

After selecting all the meshes to make into a prefab the prefab generates fine in the scene but the prefab that is created in the asset folder when dragged back into the scene as some meshes missing

Prefab1
Prefab2

[UE5] Prefab Component not working

Hi there,

when I'm using the prefab component within a BP the Prefabasset is not shown.
I have attachted the prefab component to a scene component.
The "P" Sprite and the green boundaries are shown correctly, only the prefab asset itself is not displayed.

Any hints what could be the problem here?
I'm using UE 5.0.3-20979098

new version for 4.27?

Hello. Recent release announcement says about 5.1 - 5.3, but what about 4.27 (or lower)? Thank You/ (UE5 is not main thing for many yet)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.