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"

How to get SObjectPropertyEntryBox to simply display selected static mesh name

Within a plugin I am creating I need to select as static mesh to spawn in the viewport. I have had difficulties in getting to use the details panel customisation methods due to lack of proper documentation and incomplete tutorials that all seem to be missing some important aspect to get a basic simple details panel customisation plugin up and running. Not too bad, I can never the less use what I can to at least get an inferior plugin interface up and running, but have one annoying aspect.

As in a previous question I posted


I asked about how to get a slate widget called SObjectPropertyEntryBox to display the selected static mesh name in the provided dropdown button

the widget appears as this.

alt text

and my latest code attempt snippet

         .OnObjectChanged(this, &object_iteration_panel_toolkit::on_static_mesh_changed)
 void on_static_mesh_changed(const FAssetData &static_mesh){
  static_mesh_fullname = static_mesh.GetFullName();

I thought it would be inbuilt into this widget that once a selection was made, the selected static mesh name would be reflected by updating the text in the drop down combo button. But it is not, even though the selected mesh information does get passed to the binding function on_static_mesh_changed where I can assign and use it.

Does anyone know if I am missing something in the on_static_mesh_changed function that needs to be there like a hidden variable that needs to be reassigned or updated for the selected static mesh to be reflected in the widget button. Or is this how this is supposed to behave? There are no examples or documentation I can find in using this slate widget, and I only came across this by accident.

This is quite important if nothing other than confirming that a static mesh has been selected to be used.

Much appreciate any help in advance.

Product Version: UE 4.21
capture-2.jpg (2.8 kB)
more ▼

asked Dec 14 '18 at 06:12 AM in C++ Programming

avatar image

31 3 5 7

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

1 answer: sort voted first

It took me a while to figure it out, but there are two ways to use SObjectPropertyEntryBox. 1: Use with PropertyHandle. 2: Use with ObjectPath.

1st method is pretty straightforward if you are actually modifying a property, like when you are implementing IPropertyTypeCustomization. But if you are not modifying a property, for example adding a context menu in a content browser, you don't have access to PropertyHandle. Then you have to take the 2nd approach.

For 2nd approach you have to set the ObjectPath when you are creating the SObjectPropertyEntryBox.

 TSharedRef<SObjectPropertyEntryBox>  ObjectPropertyEntryBox = SNew(SObjectPropertyEntryBox)

And because you can't modify the ObjectPath after initialization, you have to pass in a function that returns the path, which should change according to the OnObjectChanged_Static event. So something like this:

 void FMyTest::OnStaticMeshSelected(const FAssetData& AssetData)
     s_AssetData = AssetData;
 FString FMyTest::GetPath()
     if (s_AssetData.IsValid())
         return s_AssetData.ObjectPath.ToString();
     return "";

more ▼

answered Apr 02 '19 at 03:05 PM

avatar image


(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