Grease Pencil Canvas Grid Overlay Broken after DRW refactor #70399

Closed
opened 2019-09-30 20:05:45 +02:00 by Bun ny · 7 comments

System Information
Operating system: Windows 7 x64
Graphics card: NVIDIA GTX 580

Blender Version
Broken: ddb157999e
Worked: 2.80

Short description of error
The Canvas overlay isn't appearing at all, regardless of Mode and Overlay settings. This seems to have happened gradually after 2.80 release; a week or two ago (?) the Canvas started occasionally appearing at the wrong position and rotation, and in the last few days it's stopped appearing altogether.

Exact steps for others to reproduce the error
Create new .blend, create new Grease Pencil object, open Overlay menu, toggle Canvas visibility.

**System Information** Operating system: Windows 7 x64 Graphics card: NVIDIA GTX 580 **Blender Version** Broken: ddb157999eed Worked: 2.80 **Short description of error** The Canvas overlay isn't appearing at all, regardless of Mode and Overlay settings. This seems to have happened gradually after 2.80 release; a week or two ago (?) the Canvas started occasionally appearing at the wrong position and rotation, and in the last few days it's stopped appearing altogether. **Exact steps for others to reproduce the error** Create new .blend, create new Grease Pencil object, open Overlay menu, toggle Canvas visibility.
Author

Added subscriber: @bunny

Added subscriber: @bunny
Antonio Vazquez self-assigned this 2019-10-01 22:53:26 +02:00
Antonio Vazquez removed their assignment 2019-10-01 23:22:43 +02:00
Clément Foucault was assigned by Antonio Vazquez 2019-10-01 23:22:43 +02:00

Added subscribers: @fclem, @antoniov

Added subscribers: @fclem, @antoniov

@fclem This was broken with the DRW refactor.

I have seen this fix partially the problem:

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 10e9a79d143..397c1c58387 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -545,6 +545,7 @@ void GPENCIL_cache_init(void *vedata)
                                        DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA |
                                            DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS);
       stl->g_data->shgrps_grid = DRW_shgroup_create(e_data.gpencil_line_sh, psl->grid_pass);
+      DRW_shgroup_uniform_mat4(stl->g_data->shgrps_grid, "gpModelMatrix", obact->obmat);
     }
 
     /* blend layers pass */

But still there is problems if the mode is View mode.

@fclem This was broken with the DRW refactor. I have seen this fix partially the problem: ``` diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 10e9a79d143..397c1c58387 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -545,6 +545,7 @@ void GPENCIL_cache_init(void *vedata) DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS); stl->g_data->shgrps_grid = DRW_shgroup_create(e_data.gpencil_line_sh, psl->grid_pass); + DRW_shgroup_uniform_mat4(stl->g_data->shgrps_grid, "gpModelMatrix", obact->obmat); } /* blend layers pass */ ``` But still there is problems if the mode is View mode.

@fclem It looks this code in gpencil_engine.c is not working (at least is not passing the right matrix to shader group)

/* grid */
if ((v3d) && ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && (v3d->gp_flag & V3D_GP_SHOW_GRID) &&
(ob->type == OB_GPENCIL) && (ob == draw_ctx->obact) &&
((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) == 0) &&
((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) == 0)) {

  stl->g_data->batch_grid = gpencil_get_grid(ob);

  /* define grid orientation */
  switch (ts->gp_sculpt.lock_axis) {
    case GP_LOCKAXIS_VIEW: {
      /* align always to view */
      invert_m4_m4(grid_matrix, draw_ctx->rv3d->viewmat);
      /* copy ob location */
      copy_v3_v3(grid_matrix- [x], ob->obmat[3]);
      break;
    }
    case GP_LOCKAXIS_CURSOR: {
      float scale- [x] = {1.0f, 1.0f, 1.0f};
      loc_eul_size_to_mat4(grid_matrix, cursor->location, cursor->rotation_euler, scale);
      break;
    }
    default: {
      copy_m4_m4(grid_matrix, ob->obmat);
      break;
    }
  }

  /* Move the origin to Object or Cursor */
  if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) {
    copy_v3_v3(grid_matrix- [x], cursor->location);
  }
  else {
    copy_v3_v3(grid_matrix- [x], ob->obmat[3]);
  }

  DRW_shgroup_call_obmat(stl->g_data->shgrps_grid, stl->g_data->batch_grid, grid_matrix);
}

}

@fclem It looks this code in `gpencil_engine.c` is not working (at least is not passing the right matrix to shader group) > /* grid */ > if ((v3d) && ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && (v3d->gp_flag & V3D_GP_SHOW_GRID) && > (ob->type == OB_GPENCIL) && (ob == draw_ctx->obact) && > ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) == 0) && > ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) == 0)) { > > stl->g_data->batch_grid = gpencil_get_grid(ob); > > /* define grid orientation */ > switch (ts->gp_sculpt.lock_axis) { > case GP_LOCKAXIS_VIEW: { > /* align always to view */ > invert_m4_m4(grid_matrix, draw_ctx->rv3d->viewmat); > /* copy ob location */ > copy_v3_v3(grid_matrix- [x], ob->obmat[3]); > break; > } > case GP_LOCKAXIS_CURSOR: { > float scale- [x] = {1.0f, 1.0f, 1.0f}; > loc_eul_size_to_mat4(grid_matrix, cursor->location, cursor->rotation_euler, scale); > break; > } > default: { > copy_m4_m4(grid_matrix, ob->obmat); > break; > } > } > > /* Move the origin to Object or Cursor */ > if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { > copy_v3_v3(grid_matrix- [x], cursor->location); > } > else { > copy_v3_v3(grid_matrix- [x], ob->obmat[3]); > } > > DRW_shgroup_call_obmat(stl->g_data->shgrps_grid, stl->g_data->batch_grid, grid_matrix); > } > }
Antonio Vazquez changed title from Grease Pencil Canvas Overlay Broken in Windows 7 to Grease Pencil Canvas Grid Overlay Broken after DRW refactor 2019-10-02 08:24:12 +02:00

@fclem proposed fix: D5966

@fclem proposed fix: [D5966](https://archive.blender.org/developer/D5966)
Clément Foucault was unassigned by Antonio Vazquez 2019-10-02 15:15:14 +02:00
Antonio Vazquez self-assigned this 2019-10-02 15:15:14 +02:00

This issue was referenced by ddd40985e7

This issue was referenced by ddd40985e7dfe026323dede900fa2417fde225c0

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
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#70399
No description provided.