Page MenuHome

Grease pencil draw operator is not working in the sequencer
Closed, InvalidPublic

Description

System Information
Win 10 / Quadro 4000

Blender Version
Broken: (example: 2.78 RC2)

Short description of error
The draw operator of the grease pencil is not working in the sequencer area.
layout.operator("gpencil.draw").mode = 'DRAW' enable the draw cursor, but stop as soon as the button is pressed.
bpy.ops.gpencil.draw(mode='DRAW') does nothing at all.
The only thing that is working is to draw with the "D" shortcut.

Exact steps for others to reproduce the error
Load the .blend, execute the script and try to use the draw buttons in the properties panel of the VSE.

Details

Type
Bug

Event Timeline

I not sure we can consider this as a bug. The draw button is not available for some reasons in the sequence panel. If you create a new panel yourself, we maybe can support this, but need review.

@Joshua Leung (aligorith) what do you think? I have checked the code and the trick is that BLI_rcti_isect_pt_v function return false because the visble rect in ED_region_visible_rect is (0, 0 ,0, 0).

Joshua Leung (aligorith) claimed this task.

Not a bug.

  1. The toolshelf in the 3D view is only for the 3D view, and nothing else. Occasionally you might get lucky with an operator that doesn't care about which editor it's called from. But for everything else where the editor does matter (e.g. the draw operator here, most of the other Grease Pencil operators, and anything in the animation editors are good examples), those operators won't really work because when you click on the button in the toolshelf, you're activating the operator in the 3D view that hosts the button + region that the button lives in. By and large, there isn't really any way to really know with any certainty which editor you had been intending the action to get directed to.
  1. The Grease Pencil draw operator needs to know about which editor it's working in, as each editor could have a different GP datablock active (e.g. if you have both a 3D view + a sequencer view open at the same time)
  1. The behaviour you're seeing where the operator exits as soon as you click somewhere in the sequencer is a consequence of a very deliberate feature to make the draw operator usable for people using a tablet only (without easy/convenient access to a keyboard). Namely, the operator is set up so that if you click outside the region (or the same area/editor, when invoking from the toolshelf/header) in which the operator was invoked, that is taken a sign that you've finished drawing and want to exit drawmode. Without this feature, it was impossible for some users to get out of draw mode when drawing with just a tablet (and the keyboard is out of reach for various reasons).

  1. As for why there isn't a toolshelf in the Sequencer: You'll have to ask the UI team about that one ;) Part of this might really boil down to a mixture of "not enough need" and/or a lack of interest in trying to find a way to shoehorn such a layout tweak into the code for this editor (and also ensure that all old files will load it correctly too)

On a more serious note, that's why for the most critical settings, we have a special panel (the "Grease Pencil Settings") panel. If you really need to have a button to launch this operator, I suggest putting it there. (Also, watch out for which "operator_context" the button will be executing stuff with...