Page MenuHome

Measure tool: Add support to restrict dimension to one axis
ClosedPublic

Authored by Erik Abrahamsson (erik85) on Apr 1 2021, 1:57 AM.
Tokens
"Like" token, awarded by AlexeyAdamitsky."Like" token, awarded by Fracture128."Love" token, awarded by microcoder."Love" token, awarded by DotBow."Like" token, awarded by Moult."Like" token, awarded by PratikPB2123."Love" token, awarded by gilberto_rodrigues."Like" token, awarded by franMarz."Love" token, awarded by Schiette."Love" token, awarded by Lillya."Like" token, awarded by MJunk."Love" token, awarded by Blendify.

Details

Summary

The measure tool feels a bit forgotten and lacks a lot of features that other tools have. This is a proposal to make it a bit more useful.
Looking at the code it would probably need a lot of updating with a key map and so on, so maybe this could be concidered a hack, I don't know.

Press X, Y or Z to restrict the dimension to that axis (update: now also possible to toggle between orientations like in for example the move tool):

Diff Detail

Repository
rB Blender

Event Timeline

Erik Abrahamsson (erik85) requested review of this revision.Apr 1 2021, 1:57 AM
Erik Abrahamsson (erik85) created this revision.
Campbell Barton (campbellbarton) requested changes to this revision.Apr 1 2021, 1:36 PM

This seems useful, some changes requested.

source/blender/editors/space_view3d/view3d_gizmo_ruler.c
109–111

use bool restrict_axes[3]; - to avoid duplication.

397–407

This can support the current scene orientation. See: ED_transform_calc_orientation_from_type

This revision now requires changes to proceed.Apr 1 2021, 1:36 PM
Erik Abrahamsson (erik85) marked 2 inline comments as done.

Changed the keys X/Y/Z to toggle between none, scene orientation and global (or local if scene is global).

Campbell Barton (campbellbarton) requested changes to this revision.Apr 7 2021, 2:53 PM
Campbell Barton (campbellbarton) added inline comments.
source/blender/editors/space_view3d/view3d_gizmo_ruler.c
103–106

Should be a separate enum, use CONSTRAIN_AXIS_ prefix.

447–455

can be made into a for loop.

1004

This doesn't seem correct, changing from one axis to another shouldn't have to change this mode.

1006–1017

can be made into a for loop.

1019

Should include a comment for then this might happen.

This revision now requires changes to proceed.Apr 7 2021, 2:53 PM
Erik Abrahamsson (erik85) marked 4 inline comments as done.
Erik Abrahamsson (erik85) edited the summary of this revision. (Show Details)

Commented the code and tried to fix all things pointed out in the review. Also refactored the cycling code to make it clearer what is going on.

Updated to work with latest master.

This is now updated again to apply on master.

  • Sync with master, minor changes.
  • Use a define as we may want to replace this with full transform (supporting each feature duplicates logic).
  • Avoid passing in the context.
This revision is now accepted and ready to land.Aug 31 2021, 9:16 AM