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. 

How to avoid invoking property update callback function when a property is changed in the editor until the slider is released

I have a class UMyClass derived from UObject, and a property inside this class, e.g.

 class ENGINE_API UMyClass : public UObject
     UPROPERTY(EditAnywhere, Category = Parameters)
     float Property;

Plus, the function that uses these properties is included in

 void UStaticMesh::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)

By default, Function(Property) will be called lots of times using UE4 slider to tweak Property. However, Function() in our case is quite expensive, so we want to avoid calling it several times. Instead, we would like to avoid calling Function(Property) until the slider is released.

Is there a flag for UPROPERTY to do this? Or any other solutions?




Product Version: UE 4.17
more ▼

asked Dec 05 '17 at 06:12 AM in C++ Programming

avatar image

1 1 1

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

1 answer: sort voted first

I would guess you would need to only update it when OnControllerCaptureEnd or OnMouseCaptureEnd is triggered : https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Components/USlider/

more ▼

answered Dec 05 '17 at 12:38 PM

avatar image

311 22 17 39

avatar image Gfans Dec 06 '17 at 07:34 AM

Thanks for the links.

I was thinking maybe there is an option in UPROPERTY flags/meta data that can be used to indicate this kind of usage. But it turned out there is no such flag. As for OnMouseCaptureEnd, I don't see any function calls regarding to it in my case.

Any more details or suggestions?

avatar image rXp Dec 06 '17 at 07:04 PM

I see 3 solutions for you : 1) Go through the user widget tree to find your USlider widget and then use USlider->OnMouseCaptureEnd.AddDynamic(this, &MyListenerClass::OnMouseCaptureEndHandler); https://wiki.unrealengine.com/Simple_Global_Event_System#Listening_To_Events_From_Code

2) It would be better to first create/spawn the USlider widget from your c++ class with MySlider = CreateWidget<USlider>(MyPlayerController, ParentWidget); and then simply use the solution in 1 USlider->OnMouseCaptureEnd.AddDynamic(this, &MyListenerClass::OnMouseCaptureEndHandler); https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Blueprint/CreateWidget/1/


3) If you want total control over this slider you can inherit it. Look at the class https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Components/USlider/ And you can then just expose the event to blueprint and do even more :)

(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