Page MenuHome

waveforms are reprocessed when undoing
Closed, ResolvedPublic


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"

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

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) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.

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 ;) ).