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"

Sequence events fire twice?

In working with the new level sequencer within release 4.12.5, I have discovered that the events on an event track fire twice? I'm not sure if this is the intended behavior but it certainly creates problems for blueprint scripts attached to the associated custom events that are only expecting it to fire once. There is already a bug(Level Sequence Event Duplicate Bug) that described this behavior but its resolution was lack of follow through. And that's not adequate since there was really no answer if this is correct behavior or a bug. IMHO this should be a bug. Below is how I produce the issue in a brand new 4.12.5 project on Windows 10.

First create a simple scene with a sphere and add a level sequencer to the scene. Open the level sequencer editor and create a simple movement animation as seen in the image below. Next add an Event track and place a event at the 1.0 second mark(30 frames). Name the event using the properties by right clicking it.

alt text

Now open the level blueprint and duplicate the setup below. Be sure to name your custom event to the same name as was used in the sequencer event track. Mine was named Event1. I wired the P key to allow the sequence to be played again and again.

alt text

Now if you play this project and press the P key(or whatever key you wired up), you will see sphere move as expected but you will notice that the PrintString attached to the custom event(Event1) will actually print twice. Setting a breakpoint on the PrintString and pressing the P key again also confirms that it hits the PrintString node twice.

Note this is hard to work around because there is a timing element to it. You basically need to ignore the second event if it occurs within a certain delta time. Doing this really complicates the event handling is definitely not the preferred solution. I hope this issue can get some attention as we use this behavior extensively. Thanks.

alt text

Product Version: UE 4.12
Tags:
more ▼

asked Jul 09 '16 at 07:46 PM in Bug Reports

avatar image

CodeTackler
86 3 5 8

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

2 answers: sort voted first

Thanks for the detailed bug report.

This has been fixed and will be available in 4.13. The issue is that when the playback of the sequence is stopped, it returns the playback position to the start of the sequence and that caused all the events from the last playback position to the start of the sequence to be fired. Internally, we tracked this as bug UE-31494 and the changelist number that fixes this bug is 3019768.

more ▼

answered Jul 11 '16 at 02:42 AM

avatar image

Max.Chen STAFF
2.3k 28 14 69

avatar image CodeTackler Jul 11 '16 at 08:26 PM

Is there a way to get this fix prior to the 3.13 release so that I can include it into my local build? I don't see a way to access the changelist(3019768) mentioned.

avatar image CodeTackler Jul 12 '16 at 06:13 AM

Please not that this bug occurs even when Stop has not been called. You can connect the sequencer player Play function directly to the Event BeginPlay and see this behavior. Note that it is important to have some kind of animation playing to see this behavior. With only an Event Track the problem is harder to reproduce.

I've debugged this issue a little bit and the problem seems to be in the following code

 void UMovieSceneEventSection::TriggerEvents(TArray<UObject*> EventContextObjects, float Position, float LastPosition)
 {
     const TArray<FNameCurveKey>& Keys = Events.GetKeys();
 
     if (Position >= LastPosition)
     {
         for (const auto& Key : Keys)
         {
             if ((Key.Time >= LastPosition) && (Key.Time <= Position))
             {
                 TriggerEvent(Key.Value, EventContextObjects);
             }
         }
     }
     else
     {
         for (int32 KeyIndex = Keys.Num() - 1; KeyIndex >= 0; --KeyIndex)
         {
             const auto& Key = Keys[KeyIndex];
 
             if ((Key.Time >= Position) && (Key.Time <= LastPosition))
             {
                 TriggerEvent(Key.Value, EventContextObjects);
             }        
         }
     }
 }

The first if statement (Position >= LastPosition) is used for forward play and the else part of that if is for backwards play. What I see happen in the debugger when playing in the forward direction, is that the if

((Key.Time >= LastPosition) && (Key.Time <= Position))

statement evaluates true for two different Position and LastPosition values. The Key.Time value is 1.0.

First it triggers at Position=1.00000000, LastPosition=0.966666698

and then it trigger again at Position=1.40000010, LastPosition=1.00000000

Seems to me with this logic there is always a possibility of the event firing twice.

avatar image CodeTackler Jul 12 '16 at 06:14 AM

If the previously mentioned bug doesn't cover this use case, can we please create another bug to address this usage. Sometimes these issues are lumped in with a similar but different bugs and only part of the problem gets fixed. We would really like to see a fix for this make it into the 4.13 release. This is very important in allowing us to transition from matinee to sequences. Thanks again.

avatar image CodeTackler Jul 15 '16 at 04:19 AM

Can someone within Epic please see my response with my debug findings? I think this is a separate issue from the Stop scenario in bug UE-31494. Thanks.

avatar image Matt.Williams Jul 18 '16 at 03:42 PM

Hi CodeTackler,

The change Max made to MovieSceneEventTrack.cpp was to add this from lines 47 to 54:

     // Don't allow events to fire when playback is in a stopped state. This can occur when stopping 
      // playback and returning the current position to the start of playback. It's not desireable to have 
      // all the events from the last playback position to the start of playback be fired.
      if (Player.GetPlaybackStatus() == EMovieScenePlayerStatus::Stopped)
      {
          return;
      }
 

-Matt W.

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

if ((Key.Time >= LastPosition) && (Key.Time <= Position)) { TriggerEvent(Key.Value, EventContextObjects); }

current frame and next frame will trigger twice. that is not a logic wrong?

more ▼

answered Oct 18 '16 at 03:40 AM

avatar image

lululudan
1 1 1

(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