Grease Pencil selection order is wrong #62101

Closed
opened 2019-03-01 21:59:33 +01:00 by William Reynish · 13 comments

System Information
Operating system: macOS 10.14.3
Graphics card: AMD Radeon R9 M395X 4096 MB

Blender Version
Broken: Blender 2.80 beta, 2019-03-01

Short description of error
Grease Pencil selection order is wrong. Grease Pencil objects will always be selected last, even if they are in front.

Exact steps for others to reproduce the error
In the blend file below, there's a simple example of a bunch of GP objects in front of a mesh:
Screenshot 2019-03-01 at 21.55.27.png
Click over the Grease Pencil monkey objects to select them. Rather than the GP objects being selected, the mesh object behind them will be selected instead.

GP_selection_order_bug.blend

**System Information** Operating system: macOS 10.14.3 Graphics card: AMD Radeon R9 M395X 4096 MB **Blender Version** Broken: Blender 2.80 beta, 2019-03-01 **Short description of error** Grease Pencil selection order is wrong. Grease Pencil objects will always be selected last, even if they are in front. **Exact steps for others to reproduce the error** In the blend file below, there's a simple example of a bunch of GP objects in front of a mesh: ![Screenshot 2019-03-01 at 21.55.27.png](https://archive.blender.org/developer/F6738247/Screenshot_2019-03-01_at_21.55.27.png) Click over the Grease Pencil monkey objects to select them. Rather than the GP objects being selected, the mesh object behind them will be selected instead. [GP_selection_order_bug.blend](https://archive.blender.org/developer/F6738251/GP_selection_order_bug.blend)

Added subscriber: @WilliamReynish

Added subscriber: @WilliamReynish
Antonio Vazquez was assigned by William Reynish 2019-03-01 22:01:46 +01:00

Added subscriber: @fclem

Added subscriber: @fclem

We need @fclem help here.

I only add the render section for select, but I did not make any code of the selection itself. No idea why is working in this way.

We need @fclem help here. I only add the render section for select, but I did not make any code of the selection itself. No idea why is working in this way.
Antonio Vazquez was unassigned by William Reynish 2019-03-01 23:37:45 +01:00
Clément Foucault was assigned by William Reynish 2019-03-01 23:37:45 +01:00

Added subscriber: @antoniov

Added subscriber: @antoniov

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Is this bug still reproducible in the latest builds?

Is this bug still reproducible in the latest builds?

I tried again by disabling the OpenGL Depth Picking option and I was able to reproduce the bug.

The problem is that gpencil calls gpencil_free_runtime_data(stl) inside GPENCIL_draw_scene() thus releasing some resources in the first call from DRW_draw_select_loop(...).
However, DRW_draw_select_loop(...) calls drw_engines_draw_scene() at least three consecutive times.
I don't know if the solution has to be done in the DRW_manager itself or in the GPencil engine.

I also noticed an efficiency issue.
gpu_select_query_load_id(id) is called several times consecutively for the same id.
This forces the creation and use of more glQueries.
It would be good to investigate this too.

I tried again by disabling the `OpenGL Depth Picking` option and I was able to reproduce the bug. The problem is that gpencil calls `gpencil_free_runtime_data(stl)` inside `GPENCIL_draw_scene()` thus releasing some resources in the first call from `DRW_draw_select_loop(...)`. However, `DRW_draw_select_loop(...)` calls `drw_engines_draw_scene()` at least three consecutive times. I don't know if the solution has to be done in the `DRW_manager` itself or in the `GPencil engine`. I also noticed an efficiency issue. `gpu_select_query_load_id(id)` is called several times consecutively for the same `id`. This forces the creation and use of more `glQueries`. It would be good to investigate this too.

This forces the creation and use of more glQueries.

If I remember correctly, Similar queries are merged together.

However, DRW_draw_select_loop(...) calls drw_engines_draw_scene() at least three consecutive times.

Best way of fixing it would be to introduce a post draw callback in the draw engine struct and free the runtime data here. But that maybe a bit too big of a modification at this time.

Other possible fix is to move all these resources to a per layer storage (DRW_view_layer_engine_data_get) and discard only in cache_init.

>This forces the creation and use of more glQueries. If I remember correctly, Similar queries are merged together. >However, DRW_draw_select_loop(...) calls drw_engines_draw_scene() at least three consecutive times. Best way of fixing it would be to introduce a post draw callback in the draw engine struct and free the runtime data here. But that maybe a bit too big of a modification at this time. Other possible fix is to move all these resources to a per layer storage (DRW_view_layer_engine_data_get) and discard only in cache_init.

Is there any way to recreate the entire runtime_data within GPENCIL_draw_scene(...)?
It would be another possible fix.

Is there any way to recreate the entire runtime_data within `GPENCIL_draw_scene(...)`? It would be another possible fix.

I think this can be complex...you have a list of object sorted by z-depth, the layers, the strokes with different types, etc...not sure what really you need, but maybe could be possible if you give me more details of what you want to do.

Have you checked drw_gpencil_select_render(stl, psl); function?

I think this can be complex...you have a list of object sorted by z-depth, the layers, the strokes with different types, etc...not sure what really you need, but maybe could be possible if you give me more details of what you want to do. Have you checked `drw_gpencil_select_render(stl, psl);` function?

@antoniov would be nice to remove that gpencil_free_runtime_data(stl) from GPENCIL_draw_scene(...).
At least for selection.

@antoniov would be nice to remove that `gpencil_free_runtime_data(stl)` from `GPENCIL_draw_scene(...)`. At least for selection.

This issue was referenced by a0f3ea7da3

This issue was referenced by a0f3ea7da3f65333fbac9c2d528c4242c417860d
Clément Foucault was unassigned by Antonio Vazquez 2019-07-05 23:16:35 +02:00
Antonio Vazquez self-assigned this 2019-07-05 23:16:35 +02:00

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 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#62101
No description provided.