Page MenuHome

GPencil: Fix size difference between radial control and Brush size
ClosedPublic

Authored by Antonio Vazquez (antoniov) on Dec 26 2022, 11:33 AM.

Details

Summary

Due an internal scale of the brush size done by grease pencil
draw tool (this scale factor cannot be removed), the size of the
radial control is not equal to the actual stroke thickness and
this makes the radial size displayed useless.

This patch adds a new property that allows to pass the
path of the tool path and this value is used to apply
the correct scale to the radial size.

Note: The size of the Brush while is not changing was fixed also in other patch. The old version was captured without this patch and the display size of the cursor is not showing real stroke size (see: D16851)

Before the patch:

After the patch:

Diff Detail

Repository
rB Blender

Event Timeline

Antonio Vazquez (antoniov) requested review of this revision.Dec 26 2022, 11:33 AM
Antonio Vazquez (antoniov) created this revision.

@Brecht Van Lommel (brecht) Not sure if you must review this patch or not. I set as reviewer to @Campbell Barton (campbellbarton) because was not sure if he is in charge of this area. Fell free to change reviewers to the right ones.

Antonio Vazquez (antoniov) edited the summary of this revision. (Show Details)
  • GPencil: Adjust scale factor
  • GPencil: Rename prop
Antonio Vazquez (antoniov) planned changes to this revision.Dec 26 2022, 5:10 PM

The patch needs some changes because now there are problems with the zoom factor.

  • GPencil: Apply zoom to cursor size
This revision is now accepted and ready to land.Dec 26 2022, 6:38 PM

Tested, works as expected, thanks for the fix!
Really makes strokes more predictable

The patch works well now, it's a long awaited feature for Grease Pencil.
Now the F keyboard shortcut works as it always should

Yes, totally agree, it's a long awaited feature

  • Merge branch 'master' into temp-gp-radial-size

Super useful!! I've been waiting for a long time for this feature. It was really unconfortable having to do test strokes before drawing to see if you had the proper brush size.

Thank you so much!

Brecht Van Lommel (brecht) requested changes to this revision.EditedJan 4 2023, 1:32 PM

If you're going to add a hardcoded exception for grease pencil in radial_control_set_initial_mouse anyway, I don't see any point to adding a tool_path property and having the keymap be affected by this. ED_gpencil_cursor_radius already accesses the brush through the context also.

Instead add a utility function like ED_gpencil_radial_control_scale(C, rc->ptr->id_owner, rc->prop, ..) that checks if the ID and property are the active grease pencil brush and size.

This revision now requires changes to proceed.Jan 4 2023, 1:32 PM
  • GPencil: Refactor Radial Control size after patch review
  • Cleanup header files
Brecht Van Lommel (brecht) requested changes to this revision.Jan 4 2023, 4:51 PM
Brecht Van Lommel (brecht) added inline comments.
source/blender/windowmanager/intern/wm_operators.c
2286

You can't assume this is a brush, and that it's modifying the size.

You can include RNA_property_types.h and then do something like this:

if (rc->ptr.owner_id && ID(rc->ptr.owner_id) == ID_BR && rc->prop == &rna_Brush_size) {
  ...
}
This revision now requires changes to proceed.Jan 4 2023, 4:51 PM
  • Check ID type before check radius

    I didn't use ID as you proposed because I couldn't include RNA_property_types.h. I have used GS which does the same
Antonio Vazquez (antoniov) marked an inline comment as done.Jan 4 2023, 6:09 PM
Antonio Vazquez (antoniov) added inline comments.
source/blender/windowmanager/intern/wm_operators.c
2286

Thanks for the info, I didn't know that. I have used GS instead of ID because I could include the header file. I guess is the same.

This revision is now accepted and ready to land.Jan 5 2023, 6:20 PM