Page MenuHome

waveforms are reprocessed when undoing
Closed, ResolvedPublic

Description

System Information
Illegal copy of win 8.1
nVidia GF GT 630

Blender Version
Broken: 2.79.4 c78804a17af (patched by D2424)
BUILD_DATE "Fri 06/08/2018"
BUILD_TIME "04:12 PM"

Short description of error
On each undo action, waveforms of each sound file are reprocessed

Exact steps for others to reproduce the error
Load sound strip into blender VSE
Check "Draw Waveform"
Do undoable action or two(so the "Draw Waveform" stay checked to avoid confusion)
Waveform will redraw

Note
I was digging into this and found that this behavior is caused by function BKE_sound_load() in file sound.c by calling BKE_sound_free_waveform(sound); on line 395
I couldn't find any reason why I would like to free memory at this point, so I bravely commented the line and I wasn't able to cause any weird behavior or crash blender(at least not because of this) and waveforms did not redraw on undo step.

Event Timeline

I'm afraid this is how Undo works in blender.
Not aware of any workaround other than disabling "Draw Waveform".
[patching like you did will work fine if you use the same sound, but will fail to draw the correct waveform if you actually load a new file into the same sound datablock...]

But will @Campbell Barton (campbellbarton) decide whether this can be closed...

I tested swapping sound files - it worked OK, because another function is handling this and new waveform is at different memory address.
Undoing this action will therefore correctly swap waveforms back.

EDIT: oops it's not different function, but the fact the new waveform has new address is enough. I am not looking at source now...

Bastien Montagne (mont29) claimed this task.
Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.

Yeah, we actually have a system to 'pass' that kind of data across undo steps, it’s just being ignored by BKE_sound_load()...
Will fix (and slightly refactor bSound flags, there is at least one flag here that is purely runtime and should be a tag ;) ).