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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

SetOnPropertyValueChanged Not triggering when values in array changed

I'm trying to do a bit of details panel customisation for a custom actor class and I'd like to refresh said details panel whenever a property, in this case an array called IncomingRoadPoints, is changed. This is the code I'm using:

 RoadNodeArrayPtr = LayoutBuilder->GetProperty(GET_MEMBER_NAME_CHECKED(AIntersectionController, IncomingRoadPoints));
 
 FSimpleDelegate OnNodeArrayChanged = FSimpleDelegate::CreateSP(this, &FIntersectionControllerDetails::UpdateRoadNodeInfo);
 
 RoadNodeArrayPtr->SetOnPropertyValueChanged(OnNodeArrayChanged);

This is triggered just fine whenever the length of the array changes, or if I get a different property (Like a bool or something), but is not triggered when I change one of the values in the array. From stepping through the source code, it looks like the delegate doesn't exist when it tries to broadcast the change event, but I can't figure out why.

Any ideas?

Product Version: UE 4.8
Tags:
more ▼

asked Jul 07 '15 at 12:42 AM in C++ Programming

avatar image

Ineni.Realtime
124 28 37 45

avatar image Ineni.Realtime Jul 16 '15 at 04:51 AM

No-one has any experience here?

avatar image fed0r Jul 29 '15 at 01:47 AM

Well, how about this dirty thing?

 TSharedPtr<IPropertyHandleArray> Elements = RoadNodeArrayPtr->AsArray();
 uint32 NumElements;
 Elements->GetNumElements(NumElements);
 for (uint32 ElemIndex = 0; ElemIndex < NumElements; ++ElemIndex)
 {
     TSharedRef<IPropertyHandle> ElemHandle = Elements->GetElement((int32)ElemIndex);
     ElemHandle->SetOnPropertyValueChanged(OnNodeArrayChanged)
 }
avatar image Ineni.Realtime Aug 03 '15 at 12:47 AM

Thanks for that, managed to get it working. I did need to put in a workaround to make sure I wasn't assigning the same delegate to the same property multiple times, since that throws an exception. It would be nice if there was a way to remove or at least check for existing delegate bindings.

As it is I just have an array of int32's that I store the indexes of bound properties in so I only bind new properties.

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

0 answers: sort voted first
Be the first one to answer this question
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