EverNewJoy / VictoryPlugin

Rama's Victory BP Plugin
MIT License
867 stars 256 forks source link

Get BP Class from Asset Registry #38

Closed EvoPulseGaming closed 7 years ago

EvoPulseGaming commented 7 years ago

Asset Registry allows you to create an array of any assets found in a certain folder, which can be further filtered, and then "for each looped" for the input. The output is the BP Class each file. Using correct casting, you can get class defaults, spawn ect.

This allows you to dynamically add content to your game without creating a File-to-Class lookup table. When used with Asset Registry, there are no hard coded references except for the folder path themselves, which rarely change. Its much easier to change 1 folder reference vs 10, 50 or 100+ references to all the blueprints inside of the folder.

Asset Registry allows recursive folder searching, so nested folders can be searched optionally!

EverNewJoy commented 7 years ago

Hi there! Thank you for the contribution! :)

Can you post a few pictures of your intended use case that I can include when I give it to the community?

:)

Rama

PS: you could drag into a git post here or send me links either way, just want to commnicate to everyone how to use it the way you are envisioning

EvoPulseGaming commented 7 years ago

1 2 3 4

EvoPulseGaming commented 7 years ago

I'd like to make this into a less complex add-on, however, my time is extremely limited. I would have to spend countless hours to code it correctly, as this already took me about 20 hours to research and implement. (Just figuring out the Asset Registry, and how to get it to even find anything was insane, as there are no examples that explain this)

A proper implementation, would hide all the asset registry initialization, the for each loop, and the manual append of "_C"

This : 5 Should look like : 6

EverNewJoy commented 7 years ago

In your comment: "ARRAY ELEMENT OBJECT PATH -> Append "_C" -> as your input to this"

There's no need to make the user do this if you feel it is necessary, you can just do if(!Path.EndsWith("_C")) { Path += "_C"; }

I hope there are no exceptions to this, at moment I can't think of any cause you wouldn't have an asset file for a pure C++ class.

I tried to use UE4's new Asset Id system (I've been using LoadStaticClass since the UE4 beta), and I couldn't figure any way to obtain class asset ids programmatically, had to set in defaults for each and every one, so it looks to me like LoadStaticClass from string path is still the best way to go

Your BP usage of Asset Registry is really great and will help a lot of people who want to make DLC content.

:)

Rama

PS: so once you make the _C change and any other refinements you think of in the next day or 2 we'll be ready to roll with this, I am deep in a project thing at this particular moment.

EvoPulseGaming commented 7 years ago

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1345041-let-s-talk-about-the-4-17-asset-manager-and-asset-management-in-general

This explains a lot, apparently only Maps by default have a Get Asset ID function, you are required to implement said function yourself for anything you wish to use it for. (Like you said, you basically had to manually set defaults)

I'll be attempting to create this "dream" function... Your DLC comment sparked my interest, as its less of a one-off use case and now a "everyone" use case. Please hold on this for a few days as I attempt to polish this up!

EverNewJoy commented 7 years ago

" Please hold on this for a few days as I attempt to polish this up!"

Okay! Very nice to hear from you!

Good luck with your exciting research!

🌈

Rama