0
$\begingroup$

I try to playback different video clips one after the other on a mesh face using keyframes.

enter image description here

I achived pretty interesting result with changing material offset of a solidify modifier by keyframe with python. I used this modifier because the model texture is not animatable.

screen = bpy.data.objects['TvScreen']
mod = screen.modifiers['Solidify']
mod.keyframe_insert(data_path="material_offset", frame=currentFrame, group='CurrentVideo')

enter image description here

The problem is that all clips inside materials are playing at the same time. Which on the one hand freeze my Blender and on the other hand I have no control over the movie image frame sequence timing.

I tried to set a keyframe for frame_start in my script but this property is not animatable.

TypeError: bpy_struct.keyframe_insert() property "frame_start" not animatable.

I also tried to mute the image texture note of all materials and unmute them by keyframe. This fixes the GUI freeze effect but video squences still playing in background.

enter image description here

So the final question is "How to start and stop movie sequence of image node at specific frame of mp4 by keyframe in final rendering in python script?".

Maybe there is a much better way to achive this "virtual TV model" in blender. Any tips are welcome.

$\endgroup$
0
$\begingroup$

Not sure how to answer but I am trying to access the start_frame parameter of a sequence strip in the VSE and my guess is it has to do with this thing called context. Looks like where ever the start_frame is being defined or allocated in it's parameter the context is where it is inherited.
So it seems you have to create a context which is local to your script so any called functions to "play at some start_frame" will be assigning the "start_frame" from a locally created/allocated "context". See: https://blenderartists.org/t/solved-add-effect-strip-transform-for-image-vse-lm18/688456/2 and Ctrl+F: You just need to set the context.

I have read however, this is not so good for when the local allocation is un-allocated you then have a reference which points to ??? or is broken and a potential for blender crash. See: https://docs.blender.org/api/current/info_gotcha.html and Ctrl+F: # polygons have been re-allocated

Sounds like there is a start_frame being set from a GLOBAL context in your case so every start_frame=1 and that is a context you have to modify. Good luck I'm just trying to get: bpy.ops.sequencer.effect_strip_add(frame_start=frame_start, frame_end=frame_end, type=‘SPEED’) to use a frame_start from the selected strip and I don't know how to pass a frame_start parameter which equals the frame_start of the already selected strip without having to recreate a new context. I would imagine I could pass by reference but where is the allocated reference?

Anyway the answer is in the inherited context it seems.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.