Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't transform in normal direction #1

Open
3DManuH opened this issue Dec 12, 2020 · 12 comments
Open

Can't transform in normal direction #1

3DManuH opened this issue Dec 12, 2020 · 12 comments
Assignees
Labels

Comments

@3DManuH
Copy link

3DManuH commented Dec 12, 2020

Can't transform in normal direction.
Pivot is set to 3D cursor (works) - orientation to normal (doesn't worK)
It scales as shown with red line but should work as shown with green lines on screenshot.
2020-12-13 00_42_47

@3DManuH
Copy link
Author

3DManuH commented Dec 13, 2020

2020-12-13_01-01-46

@EleotleCram
Copy link
Owner

Ah yes, this is currently a known limitation. Transforms are assumed to be in Cartesian directions (i.e. Global orientation). Figuring out the oriented bounding box is a known hard problem. Maybe we can take some shortcuts for orientations in the normal direction by calculating the sum of the normals of all selected elements. I assume at least that's how it works.

Has this ever worked for MeshTools btw ?

@3DManuH
Copy link
Author

3DManuH commented Dec 13, 2020

No, not working for MeshTools as well.
Would be awesome to have this working for CAD Mesh Dimensions and MeshTools. Would use/need this feature all day long.

@EleotleCram EleotleCram self-assigned this Dec 13, 2020
@EleotleCram EleotleCram added the accepted This issue is being worked upon label Dec 13, 2020
@EleotleCram
Copy link
Owner

EleotleCram commented Dec 13, 2020

I have something working. Needs some generalization though. And I don't know yet how it would be clear to the viewer/modeler which direction would be x, y or z. Look at the video, the gizmo changes orientation as I resize. Probably not what we want to happen in the Panel.
cad_mesh_dim_normal_orientation

@3DManuH
Copy link
Author

3DManuH commented Dec 14, 2020

cool, that looks promising! hopefully you can remedy the gizmo orientation.

@EleotleCram
Copy link
Owner

EleotleCram commented Dec 19, 2020

I've pushed a new version that implements transform orientation 'NORMAL'.

A few notes:

  • For transform orientation 'NORMAL':
    • I have made it so that for simple selections (i.e. selections that result in a single edge or face be selected) you can use the gizmo for reference. When you select more edges, faces, , the gizmo and CAD mesh dimensions each go their separate ways. CAD mesh dimensions tries to keep as many dimensions as possible aligned to world (because this typically results in cleaner/more orthogonal dimensions for technical parts).
    • When CAD mesh dimensions aligns to the gizmo, it does so whenever the selection changes. If you edit dimensions such that for example Length becomes Width (see animation in my previous comment), CAD mesh dimensions will not update to realign. Doing that would mess up interactive edits. So keep this in mind.
  • For transform orientation 'GLOBAL', the gizmo can always be used for reference.

Looking forward for some feedback.

@EleotleCram EleotleCram added test Implementation done; needs testing and removed accepted This issue is being worked upon labels Dec 19, 2020
@3DManuH
Copy link
Author

3DManuH commented Dec 20, 2020

sorry can't get it to work as expected. anything i am doing wrong?

cad_meshdimensions.mp4

@EleotleCram
Copy link
Owner

It looks like I screwed something up with matrices. It currently only works for objects which are at world origin (0,0,0) 🤣 I'll have another go at this... If you want a sneak preview, put your object at world center for now ;-)

@3DManuH
Copy link
Author

3DManuH commented Dec 20, 2020

ok, good to know. works really great so far besides the world origin limitation.

there is no local orientation right now. Is this something that could be added?

sorry, seems like i can not create a pull request. (Choose different branches or forks above to discuss and review changes. Learn about pull requests)

possible to add a shortcut for CAD Mesh Dimension? So you are not forced to use N-menu but can access the addon with shortcut?

@EleotleCram
Copy link
Owner

EleotleCram commented Dec 21, 2020

I'm afraid we hit a serious snag. I overlooked something in my approach. When custom orientations ('normal' is a special form of custom orientation) are involved, you cannot easily map the scale in the custom orientation to global and then expect this to work. There can be many bounding boxes in the custom orientation that map to a single bounding box in global orientation (vice versa).

This means, that we cannot use bpy.ops.transform.resize() (which is what cad_mesh_dimensions (and also MeshTools: edit_dimensions) is built around. I now understand why it wasn't included in the original addon either. It's hard.
Add to this that we cannot access the Gizmo matrix easily. And that the Gizmo most of the time is not aligned properly anyway (See blue arrow in picture), basically you'd have to manipulate the mesh vertices directly and implement it for all the possible anchor points. This is way more than I bargained for when I set out to implement this feature request.

So unless we can come up with some clever trick, or I develop a need for this feature that overcomes my reluctance to dive into direct vertex manipulation, this issue is stuck.... Sorry. I gave it my best for now...

gizmo-not-aligned

@EleotleCram EleotleCram added stuck and removed test Implementation done; needs testing labels Dec 21, 2020
@3DManuH
Copy link
Author

3DManuH commented Dec 21, 2020

sad to hear that. thank you for the hard work until now. hopefully you’ll find a workaround to get this fixed.

@3DManuH
Copy link
Author

3DManuH commented Apr 27, 2021

Hi Marcel, are there any plans to support normal (or 3d cursor) transformation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants