Python 'View' functions for Sequencer/Preview makes Blender crash #56859

Closed
opened 2018-09-21 04:37:15 +02:00 by tintwotin · 9 comments

Blender 2.79b on Windows 8

This line crashes Blender in the script context bellow:

bpy.ops.sequencer.view_all_preview() 

And so does:

view_frame, view_ghost_border, .view_zoom_ratio

Script to expose the crash:

- Adds a windowless fullscreen preview to the sequencer
- Have a Sequencer/Preview area open, and select 'True Fullscreen' in the View Menu.
- Uncomment this line: "bpy.ops.sequencer.view_all_preview()" to make Blender crash.
- Use Alt+F11, Alt+F10 and home to return to a normal screen

import bpy

class SEQUENCE_MT_true_fullscreen(bpy.types.Operator):
	"""True fullscreen preview. Close in upper right corner"""
	bl_label = "True Fullscreen"
	bl_idname = "sequencer.true_fullscreen"
	bl_options = {'REGISTER', 'UNDO'}

	def execute(self, context):
		scene=bpy.context.scene

		if not bpy.context.scene.sequence_editor: #create sequence, if missing
			bpy.context.scene.sequence_editor_create() 
  
		context = bpy.context
		for area in bpy.context.screen.areas:
			if area.type == 'SEQUENCE_EDITOR':
				if area.spaces[0].view_type == 'PREVIEW':  
				   override = bpy.context.copy()
				   override['space_data'] = area.spaces.active
				   override['region'] = area.regions[-1]
				   override['area'] = area
       			           override['screen'] = context.screen
				   bpy.ops.screen.screen_full_area(override, use_hide_panels=True)
				   bpy.ops.wm.window_fullscreen_toggle()
				   bpy.ops.sequencer.view_all_preview() # This line crashes Blender
                                  #and so does .view_frame(), view_ghost_border(), .view_zoom_ratio()

		return {'FINISHED'}

def menu_append(self, context):
	self.layout.operator(SEQUENCE_MT_true_fullscreen.bl_idname)

def register():
	bpy.utils.register_class(SEQUENCE_MT_true_fullscreen)
	bpy.types.SEQUENCER_MT_view.append(menu_append) # add to "view" vse header menu

def unregister():
	bpy.utils.unregister_class(SEQUENCE_MT_true_fullscreen)
	bpy.types.SEQUENCER_MT_view.remove(menu_append)

if __name__ == "__main__":
	register()  
Blender 2.79b on Windows 8 This line crashes Blender in the script context bellow: ``` bpy.ops.sequencer.view_all_preview() ``` And so does: ``` view_frame, view_ghost_border, .view_zoom_ratio ``` Script to expose the crash: ``` - Adds a windowless fullscreen preview to the sequencer - Have a Sequencer/Preview area open, and select 'True Fullscreen' in the View Menu. - Uncomment this line: "bpy.ops.sequencer.view_all_preview()" to make Blender crash. - Use Alt+F11, Alt+F10 and home to return to a normal screen import bpy class SEQUENCE_MT_true_fullscreen(bpy.types.Operator): """True fullscreen preview. Close in upper right corner""" bl_label = "True Fullscreen" bl_idname = "sequencer.true_fullscreen" bl_options = {'REGISTER', 'UNDO'} def execute(self, context): scene=bpy.context.scene if not bpy.context.scene.sequence_editor: #create sequence, if missing bpy.context.scene.sequence_editor_create() context = bpy.context for area in bpy.context.screen.areas: if area.type == 'SEQUENCE_EDITOR': if area.spaces[0].view_type == 'PREVIEW': override = bpy.context.copy() override['space_data'] = area.spaces.active override['region'] = area.regions[-1] override['area'] = area override['screen'] = context.screen bpy.ops.screen.screen_full_area(override, use_hide_panels=True) bpy.ops.wm.window_fullscreen_toggle() bpy.ops.sequencer.view_all_preview() # This line crashes Blender #and so does .view_frame(), view_ghost_border(), .view_zoom_ratio() return {'FINISHED'} def menu_append(self, context): self.layout.operator(SEQUENCE_MT_true_fullscreen.bl_idname) def register(): bpy.utils.register_class(SEQUENCE_MT_true_fullscreen) bpy.types.SEQUENCER_MT_view.append(menu_append) # add to "view" vse header menu def unregister(): bpy.utils.unregister_class(SEQUENCE_MT_true_fullscreen) bpy.types.SEQUENCER_MT_view.remove(menu_append) if __name__ == "__main__": register() ```
Author

Added subscriber: @tintwotin

Added subscriber: @tintwotin

Added subscriber: @mont29

Added subscriber: @mont29

Cannot reproduce any crash here with this code (once tabulation is fixed…). Please at the very least give us error message!

Cannot reproduce any crash here with this code (once tabulation is fixed…). Please at the very least give us error message!
Author

Strange. It crashes here on 2.8 too.

I get no error message. The Blender UI just disappears.

The bug was encountered on StackExchange: https:*blender.stackexchange.com/questions/118741/how-to-make-the-sequencer-preview-area-fullscreen-with-python

Apparently, it can be worked-around by delaying the call.

Strange. It crashes here on 2.8 too. I get no error message. The Blender UI just disappears. The bug was encountered on StackExchange: [https:*blender.stackexchange.com/questions/118741/how-to-make-the-sequencer-preview-area-fullscreen-with-python ](https:*blender.stackexchange.com/questions/118741/how-to-make-the-sequencer-preview-area-fullscreen-with-python) Apparently, it can be worked-around by delaying the call.

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2018-09-21 15:30:34 +02:00

OK finally managed to reproduce (that operator only works when VSE editor is in only-preview mode).

You simply have invalid context for the crashing op call, just pass your override to it and it works as expected.

Also, We do not handle user support on this tracker, only bug reports. User forums like blenderartists.org or blender.stackexchange.com should be used for that matter.

OK finally managed to reproduce (that operator only works when VSE editor is in only-preview mode). You simply have invalid context for the crashing op call, just pass your `override` to it and it works as expected. Also, We do not handle user support on this tracker, only bug reports. User forums like [blenderartists.org](http:*blenderartists.org/) or [blender.stackexchange.com](http:*blender.stackexchange.com/) should be used for that matter.

Added subscriber: @snuq

Added subscriber: @snuq

I was working with him on this script, we did end up getting it to work, and yes, the context was the problem... but regardless, shouldn't blender give an error rather than just crashing? Seems like it is still a bug.

I was working with him on this script, we did end up getting it to work, and yes, the context was the problem... but regardless, shouldn't blender give an error rather than just crashing? Seems like it is still a bug.

There are gazillions of ways to make Blender crash with bad py code… ideally yes, that should be checked in the poll callback of the operators, but that’s not a bug.

There are gazillions of ways to make Blender crash with bad py code… ideally yes, that should be checked in the poll callback of the operators, but that’s not a bug.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#56859
No description provided.