Page MenuHome

GPencil: New Brush option to define Caps type
ClosedPublic

Authored by Antonio Vazquez (antoniov) on Jul 22 2021, 4:51 PM.

Details

Summary

This is used to set the default caps type for the stroke. Before always was rounded and only could be changed later in Edit mode

Two new buttons has been added to topbar.

NOTE: We need better icons

The buttons are expanded to list in Properties panel.

Diff Detail

Repository
rB Blender

Event Timeline

Antonio Vazquez (antoniov) requested review of this revision.Jul 22 2021, 4:51 PM
Antonio Vazquez (antoniov) created this revision.

This option would be useful for primitives. With the patch it is only possible to access the new brush property using the Draw tool, maybe this property should be outside any particular brush menu

Hans Goudey (HooglyBoogly) requested changes to this revision.Jul 22 2021, 6:19 PM

Antonio, feel free to assign me as a reviewer for patches like this in the future. Pablo mentioned this to me and there are a quite a few pretty straightforward tweaks to make here.

source/blender/makesdna/DNA_brush_enums.h
158 ↗(On Diff #39813)

I think this should reuse the existing eGPDstroke_Caps enum, I don't see a reason to add a new one.
This adds a new place to maintain when adding types, more defines to find when reading code, etc.

source/blender/makesdna/DNA_brush_types.h
79–81

Rather than listing the options here, mention the enum type: #eGPDstroke_Caps

80

You can use int8_t here, and keep one char of padding.

source/blender/makesrna/intern/rna_brush.c
272

This enum can be defined directly in the function that uses it, like gppaint_mode_types_items

273

I'd suggest "Round" instead of "Rounded" here, it's just a bit simpler, and more similar to "Flat"

1762

In most cases only the first letter of the UI description should be capitalized.

Additionally, the description is not useful here. We have to take care to imagine the perspective of someone who hadn't seen this before.
I suggest something like: "The shape of the start and end of the stroke"

1763

This property is missing RNA_def_property_update

This revision now requires changes to proceed.Jul 22 2021, 6:19 PM
Antonio Vazquez (antoniov) marked 7 inline comments as done.
  • GPencil: Changes after first review
source/blender/makesrna/intern/rna_brush.c
1763

Don't need update...it's only for new strokes

Nice Antonio, functionality is much better now.

We have to look for a better UI solution in Active tool panel in properties editor. IMO in that panel a dropdown would work better than the icon toggle.

  • GPencil: Expand Enum only for tool header
Hans Goudey (HooglyBoogly) requested changes to this revision.Jul 24 2021, 3:42 AM

I don't think this should be committed to master with those icons.
With the option presented in the UI this way, the two types should have their own icons.

source/blender/makesdna/DNA_gpencil_types.h
339 ↗(On Diff #39855)

Adding this flag here is confusing since it duplicates the stroke type, even with the "used only while drawing" comment.

I would replace one of the padding bytes under sbuffer_sflag with int8_t sbuffer_cap_type;

Then assigning the value becomes much simpler, since you don't have to go back and forth between a flag and the direct values.

This revision now requires changes to proceed.Jul 24 2021, 3:42 AM
  • Simplify code and reduce variables

@Hans Goudey (HooglyBoogly) Thanks a lot for the idea to use the runtime flag... After reading your comment, I realised I could simplify a lot the code and remove the flag because the runtime has a pointer to Brush, so don't need the flag for drawing engine.

I have updated the patch and now all it's more clear.

I don't think this should be committed to master with those icons.
With the option presented in the UI this way, the two types should have their own icons.

Agree, having those icons first would be great

Agree with Icons... who is the person in charge of making new icons?

@Pablo Vazquez (pablovazquez) @Hans Goudey (HooglyBoogly) Matias is working in the new icons, but IMHO it would be better apply this patch and open a task for the icons later in order to close patches. We have this patch waiting afor something that can be fixed later easily.

What do you think?

Okay, as long as icon work is actually underway I'm fine with committing this.

This revision is now accepted and ready to land.Aug 3 2021, 3:05 PM