Page MenuHome

UI: 2D cursor as a separate overlay option in the Image Editor
Needs ReviewPublic

Authored by Alessio Monti di Sopra (a.monti) on Nov 3 2021, 10:53 AM.

Details

Summary

The patch exposes the 2D cursor drawing as a distinguished option in the overlays panel of the Image Editor.

Diff Detail

Repository
rB Blender

Event Timeline

Alessio Monti di Sopra (a.monti) requested review of this revision.Nov 3 2021, 10:53 AM
Alessio Monti di Sopra (a.monti) created this revision.

Personally I think this is a reasonable option to have, esp now that it exists for the 3D View as well.

In the past, Campbell had some reservations about introducing such options to the 3D View. So I'd like his opinion on this.

To complete this, a secondary patch I wanted to work on would be about blocking the cursor position while it is not drawn. I initially though to include it here for the image editor, but I think that should affect all the editors that have a cursor.

I honestly still haven't checked if there are already design tasks about this, but IMO being able to move the cursor while you don't see is a big problem, especially since there is no Undo for its position.

Campbell Barton (campbellbarton) requested changes to this revision.Nov 3 2021, 12:42 PM
Campbell Barton (campbellbarton) added inline comments.
source/blender/draw/intern/draw_view.c
232–233

G_TRANSFORM_CURSOR should be checked here.

source/blender/makesdna/DNA_space_types.h
1325

This is off by default, you can follow 3D view V3D_OVERLAY_HIDE_CURSOR and flip the flag so it's visible by default (without the need for version patching).

Also, reuse one of the existing SI_FLAG_UNUSED_* flags.

source/blender/makesrna/intern/rna_space.c
3519

This should be added to the overlay struct.

Name show_cursor following 3D view and sequencer.

This revision now requires changes to proceed.Nov 3 2021, 12:42 PM
  • check for G_TRANSFORM_CURSOR in the drawing poll function
  • renamed the new cursor flag to SI_OVERLAY_HIDE_CURSOR and move it in the eSpaceImageOverlay_Flag enum
  • moved the rna definition in rna_def_space_image_overlay() and renamed the flag "show_cursor"
source/blender/makesdna/DNA_space_types.h
1325

Also, reuse one of the existing SI_FLAG_UNUSED_* flags.

Ok, I wasn't sure about the versioning aspect of using those.
But I didn't noticed that there was eSpaceImageOverlay_Flag below, so I moved it there.

... flip the flag so it's visible by default (without the need for version patching).

The flag is already a boolean_negative in rna, I don't think I have to change something there, unless I'm missing something.

Update to current state of master

This revision is now accepted and ready to land.Feb 7 2022, 1:48 AM
Campbell Barton (campbellbarton) requested changes to this revision.EditedFeb 7 2022, 5:29 AM

The overlay part of this patch seems fine, please remove other changes that rename/relocate the panel as they don't seem so relevant, adding an unresolved question in the patch text meaning it can't be committed as-is.

Re-arranging may be fine but can be done separately.

Reminder that patch submission text should be usable for the commit log:

This revision now requires changes to proceed.Feb 7 2022, 5:29 AM
Alessio Monti di Sopra (a.monti) edited the summary of this revision. (Show Details)
  • removed the ui reordering part, and placed the property inside the existing IMAGE_PT_overlay_image panel

Noticed some additional issues, suggest fewer changes P2782.
@Alessio Monti di Sopra (a.monti) do you see any issues with this change? If not, I'll update the patch and commit this.

release/scripts/startup/bl_ui/space_image.py
1627–1628

Checking cursor drawing logic, if sima.mode not in {'VIEW', 'PAINT'}: matches the check in drawing code.

source/blender/makesrna/intern/rna_space.c
5445–5448

This doesn't seem to be needed, other properties are only included because the checks involve more than a single value - where this is the same as checking mode == 'VIEW'

Noticed some additional issues, suggest fewer changes P2782.
@Alessio Monti di Sopra (a.monti) do you see any issues with this change? If not, I'll update the patch and commit this.

Yes it makes total sense, thank you!
Sorry about that, I was following the other checks done in the panels.