x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Custom Detail Panel; Array indexed by strings

I'd like to display an array of values, indexed by strings rather than numbers.
IE: given an array int[] = {0,0,10} and FString[] = {"Alpha","Beta","Gamma"}
Alpha [ 0]
Beta [ 0]
Gamma [10]

rather than
0 [ 0]
1 [ 0]
2 [10]

I have looked at the "tutorials" on the wiki; I use quotes because I have yet to find one that actually works. Could someone please explain how to do this in a way that doesn't assume I'm an Epic senior programmer who needs a refresher?

Product Version: UE 4.8
Tags:
more ▼

asked Aug 26 '15 at 09:37 PM in C++ Programming

avatar image

NullBlack
110 8 9 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You could possibly use TMaps, check this out and see if it helps you.

https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/TMap/index.html

more ▼

answered Aug 26 '15 at 09:51 PM

avatar image

Devero
2.3k 114 61 233

avatar image NullBlack Aug 26 '15 at 10:35 PM

Problem is it renders that in a single bar
[((Alpha, 0),(Beta, 0),(Gamma, 10))]
rather than as a array. Also, adding new keys caused it to bug out, crashing the editor twice.

If anyone knows a way to get it to render vertically like an array, the crashing can probably be ignored as adding new keys won't happen that frequently.

avatar image Shadowriver Aug 26 '15 at 11:32 PM

Get Keys array with this function: https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Containers/TMapBase/GetKeys/index.html

And the loop thru like this:

 TArray<FString> Keys;
 
 Map.GetKeys(Keys);
 
 for(FString Key : Keys) {
       UE_LOG(LogTemp, Log, FText::FromString(Key + ": " + FString::FromInt(Map[Key]));
 }

This is example on Logs, you can do anything

avatar image NullBlack Aug 26 '15 at 11:36 PM

If I wanted it in logs, I would have asked for logs. Look at the title: I want this in the detail panel.

avatar image Shadowriver Aug 27 '15 at 12:15 AM

Oh, thats quite not possible, currently reflection system does not support TMaps, only TArrays is supported from all container types. You might try to do something with this, but not sure if this will work:

https://wiki.unrealengine.com/Customizing_detail_panels

you definitly won't be able to use TMaps in blueprints or else you make nodes to operate specific TMap in C++

TMap support for reflection system and bluepruints overall was requested few times and it's considered to be implemented in future

avatar image NullBlack Aug 27 '15 at 12:37 AM

Remember how I said the "tutorials" on the wiki don't work? That one is a prime example. It's out of date, incomplete, and doesn't explain what it is doing.

avatar image Shadowriver Aug 27 '15 at 02:29 AM

Do you know how to use Slate? If not you should start with that. Im not sure if you can do anything here as TMap is non existant for reflection system

I will try to review that tutorial tommorow and some how hint what you could do

avatar image NullBlack Aug 27 '15 at 02:37 AM

No. Do you have a Slate tutorial that actually explains what the FUNC it's doing? What the functions actually do? Because I couldn't find one.

avatar image Devero Aug 27 '15 at 01:07 PM

I remembered this training stream. It could be very useful, Also Noland is a guy to follow.

https://youtu.be/zg_VstBxDi8

Good luck!

avatar image Shadowriver Aug 27 '15 at 04:20 PM

I'm afraid you might need to backward engineer it, by looksing on other code. I find out there whole module in engine dedcated to details property customization for various types

https://github.com/EpicGames/UnrealEngine/tree/e607ba4d978c08a26e8e8e629dec0884bb161770/Engine/Source/Editor/DetailCustomizations

You can preform the same thing from any other module (including yours), you just need to remeber to manually register the customization as this module does

https://github.com/EpicGames/UnrealEngine/blob/e607ba4d978c08a26e8e8e629dec0884bb161770/Engine/Source/Editor/DetailCustomizations/Private/DetailCustomizations.cpp

The key here is IDetailsCusmization https://docs.unrealengine.com/latest/INT/API/Editor/PropertyEditor/IDetailCustomization/index.html

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question