Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it seems like just running simple scripts turns the waveform in the timeline off I was hoping that you could update this #5

Open
mjoe67886 opened this issue Jan 25, 2023 · 5 comments

Comments

@mjoe67886
Copy link

this has happened in multiple occurrences....or maybe give a clue how I might update this I have a programmer that works with me And if you could give me some clue why this might be happening maybe we could update it for you and send you the code... I made a video detailing the issue https://drive.google.com/file/d/1D5mp9shqUbJw9wSL4F_X-DRPoqj-Hw_A/view?usp=sharing

import bpy

def add_all_keyframe(obj, attr="value", frame=bpy.context.scene.frame_current):
if obj.type != 'MESH': return

blocks = obj.data.shape_keys.key_blocks
if not blocks: return

for k in blocks:
    k.keyframe_insert(attr, frame=frame)

add_all_keyframe(bpy.context.object)
bpy.context.scene.frame_set(bpy.context.scene.frame_current) #update ui

bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=False)

@Pullusb
Copy link
Owner

Pullusb commented Jan 25, 2023

Hi,
The problem lies in the last line when you use the data purge.
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=False)

When you call this operator, you are purging the image of the waveform as well.
The waveform image is loaded without fake user so that it's not stored in the blend file and automatically purged when closed

You have to enable fake user for the image.
Since there is a use case I'll add choice in preferences in next update.

For now, here is a permanent "Fix" in code for you:
Add image.use_fake_user = True after image loading (line 308 in file display_wave_image.py)

Alternatively, you can adapt your own script to purge only what's needed instead of a global orphan data purge.


For a manual quick fix in currently opened blend:

Just tick it in the outliner > data api
image
Alternatively, you can also adapt your own script to purge only what's needed instead of a global orphan data purge.
Cheers.

@mjoe67886
Copy link
Author

mjoe67886 commented Jan 25, 2023 via email

@mjoe67886
Copy link
Author

https://drive.google.com/file/d/1DcLQZ-vhpmWUVsaya4SN0RZgxvVvEbi4/view?usp=sharing OKAY I think our lines 308 differs or something because I place this in the code about where i thought it should go and it's not working Can you tell me precisely after which line to place this and at what level of indentation... I posted a link that show where I put it

@Pullusb
Copy link
Owner

Pullusb commented Jan 27, 2023

It's a few lines up, just after image variable is assigned.

You probably did not have the last version. But in that case you can inspect on github directly.
It's here exactly : https://github.com/Pullusb/sound_waveform_display/blob/main/display_wave_image.py#L309

@mjoe67886
Copy link
Author

mjoe67886 commented Jan 28, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants