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"

Creating Animation Notifies from C++

I am creating a plugin which would automatically create animation notifies on all selected animations on a button click with naming and frames data extracted from a DataTable. The notify is a custom notify which has a property NotifyID and it is unique to every instance of the notify. This notify is supposed to print its NotifyID in its Notify method, which is working. The plugin is doing what it is supposed to do, only with a weird (but understandable) bug:

When I create the notifiers with the plugin button, all those notifies would only work during the editor is open, but they convert to a simple named custom animation notify when I restart the editor or right click and select reload on the anim asset.

BUT

If I create the same notifier from animation window, it remains consistent and works fine.

With some debugging I noticed that there is a difference between the path of the ones that the plugin is creating from script and the ones that I create from the animation window:

Plugin created notifiers' path is transient i.e. "/Engine/Transient.CustomAnimNotify_X"

And the ones created from the animation window have the path "/Game/AnneAnimatinos/Uniclass_shot01_Anne_IK.Uniclass_shot01_Anne_IK:CustomAnimNotify_X" (X = index number)

Here's my notifier creation code:

 UCustomAnimNotify* customNotify = NewObject<UCustomAnimNotify>();
                         customNotify->NotifyID = audioName;
                         customNotify->AddToRoot();
                         customNotify->ClearPendingKill();
                         
                         UE_LOG(LogTemp, Warning, TEXT("CustomNotify path name: %s"), *customNotify->GetPathName());
                         
                         
                         FString newName = FString("DialogueNotify");
 
                         int32 NewNotifyIndex = animAsset->Notifies.Add(FAnimNotifyEvent());
                         FAnimNotifyEvent& NewEvent = animAsset->Notifies[NewNotifyIndex];
                         NewEvent.NotifyName = FName(*newName);
                         NewEvent.Notify = customNotify;
                         
                         NewEvent.LinkSequence(animAsset, animAsset->GetTimeAtFrame(frameNo));


I think the transient thing is causing the problem. Maybe there is a way to use the same functions that the animation window uses to create notifiers.

Any help would be greatly appreciated.

Product Version: UE 4.17
Tags:
more ▼

asked Mar 19 '18 at 08:19 AM in C++ Programming

avatar image

Hallar Azad
58 1 3 8

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

1 answer: sort voted first

I think setting the Outer when you call NewObject() is what you want. By default it points to the transient package. Try supplying the Anim Sequence the notify belongs to as the Outer param to NewObject()

more ▼

answered Jul 26 '18 at 01:04 AM

avatar image

FableBen
91 2 5 7

avatar image Hallar Azad Aug 15 '18 at 10:01 AM

Thank you FableBen! This was the solution.

(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