scaling in viewport doesn't work with snap to nearest vertex. #39161

Closed
opened 2014-03-13 16:30:36 +01:00 by mattali · 17 comments
mattali commented 2014-03-13 16:30:36 +01:00 (Migrated from localhost:3001)

System Information
All

Blender Version
Broken: 2.70
Short description of error
Scaling an object relative to 3d cursor and with snap to nearest vertex gives random results.

Exact steps for others to reproduce the error
Open attached file, place mouse cursor on the bottom-left vertex of the active cube, hit S, move cursor to nearest vertex of the bottom cube : it scales properly, now press ctrl to have it exactly touch the vertex, it scales back to a random position.
bug_scale_snap_closest.blend

**System Information** All **Blender Version** Broken: 2.70 **Short description of error** Scaling an object relative to 3d cursor and with snap to nearest vertex gives random results. **Exact steps for others to reproduce the error** Open attached file, place mouse cursor on the bottom-left vertex of the active cube, hit S, move cursor to nearest vertex of the bottom cube : it scales properly, now press ctrl to have it exactly touch the vertex, it scales back to a random position. [bug_scale_snap_closest.blend](https://archive.blender.org/developer/F80967/bug_scale_snap_closest.blend)
mattali commented 2014-03-13 16:30:36 +01:00 (Migrated from localhost:3001)
Author

Changed status to: 'Open'

Changed status to: 'Open'
mattali commented 2014-03-13 16:30:36 +01:00 (Migrated from localhost:3001)
Author

Added subscriber: @mattali

Added subscriber: @mattali
Member

Added subscriber: @LukasTonne

Added subscriber: @LukasTonne
Member

This behavior is admittedly awkward. Scaling is a very limited operation (1 degree or freedom only), which makes it rather unsuitable for snapping in the way it works with other transform modes. I'm not sure how this could fit better into the snapping system, but it's not a bug or regression.

Afaik the snapping works like roughly this:

  • Select the element indicated by the mouse (the orange circle)
  • Select the closest corresponding element of the transformed object (in untransformed state)

Calculate a transform such that the distance (whatever the actual metric is) between snap target and selected element becomes minimal.

The first 2 steps should be independent of the transform mode, but the 3rd can be quite tricky depending on the mode and additional constraints. For scaling there might not be an efficient way to calculate such a transform or it may require an iterative approach. Apart from that you cannot expect the elements to snap together precisely, due to the inherent limitation of (uniform) scaling to 1 degree of freedom.

This behavior is admittedly awkward. Scaling is a very limited operation (1 degree or freedom only), which makes it rather unsuitable for snapping in the way it works with other transform modes. I'm not sure how this could fit better into the snapping system, but it's not a bug or regression. Afaik the snapping works like roughly this: - Select the element indicated by the mouse (the orange circle) - Select the *closest* corresponding element of the transformed object (in untransformed state) # Calculate a transform such that the *distance* (whatever the actual metric is) between snap target and selected element becomes minimal. The first 2 steps should be independent of the transform mode, but the 3rd can be quite tricky depending on the mode and additional constraints. For scaling there might not be an efficient way to calculate such a transform or it may require an iterative approach. Apart from that you cannot expect the elements to snap together precisely, due to the inherent limitation of (uniform) scaling to 1 degree of freedom.
Campbell Barton was assigned by Bastien Montagne 2014-03-15 12:06:22 +01:00

Added subscriber: @mont29

Added subscriber: @mont29

Assigning to Campbell to get its advice here! :)

Assigning to Campbell to get its advice here! :)
mattali commented 2014-03-17 07:19:04 +01:00 (Migrated from localhost:3001)
Author

On the same scene, translating on 1 local axis, here Y, works (G Y Y). So blender finds a way to snap that nearest vertex without it to be presicely snapped (also 1 degree of freedom). If blender succeed in finding the right position for that vertex, it can deduce the scale from the new edge length comparing to the old?

On the same scene, translating on 1 local axis, here Y, works (G Y Y). So blender finds a way to snap that nearest vertex without it to be presicely snapped (also 1 degree of freedom). If blender succeed in finding the right position for that vertex, it can deduce the scale from the new edge length comparing to the old?
mattali commented 2014-03-17 07:21:25 +01:00 (Migrated from localhost:3001)
Author

Scripting it in Python works (makes a 1 axis translation, save snap location, compute new edge length, divide by old edge length, undo trtanslation and scale with that factor).

Scripting it in Python works (makes a 1 axis translation, save snap location, compute new edge length, divide by old edge length, undo trtanslation and scale with that factor).

Added subscriber: @bliblubli

Added subscriber: @bliblubli

Encountered same bug today, can confirm. When used in "nearest vertex" mode, it is for that nearest vertex a translation constrained on the center-nearest vertex axis. Translating on local axis with snap works (GXX combo with snap active for example). So it is possible to determine a perfect scale factor too, at least in "nearest vertex" (by doing a 1 axis translation with snap of the nearest vertex and using the given new location to determine the appropriate scale). For modes where no factor can be determined, a warning would be better than the current random scale.

Encountered same bug today, can confirm. When used in "nearest vertex" mode, it is for that nearest vertex a translation constrained on the center-nearest vertex axis. Translating on local axis with snap works (GXX combo with snap active for example). So it is possible to determine a perfect scale factor too, at least in "nearest vertex" (by doing a 1 axis translation with snap of the nearest vertex and using the given new location to determine the appropriate scale). For modes where no factor can be determined, a warning would be better than the current random scale.

since 2.73 is mostly a bugfix release, would it be possible to fix such old, waiting bugs? Many professionals prefer polishing over new features, please use this quiet release to polish Blender. Would be a lovely Christmas present :)

since 2.73 is mostly a bugfix release, would it be possible to fix such old, waiting bugs? Many professionals prefer polishing over new features, please use this quiet release to polish Blender. Would be a lovely Christmas present :)

Added subscriber: @georgK

Added subscriber: @georgK
Author

This issue was referenced by 3dd16946aa

This issue was referenced by 3dd16946aa43e804d028262f7368346c56ba1045

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

thanks for the fix, it works well with "median" as pivot point but with "individual origins" it breaks.
In attached file:
Scale and choose a vertex with "ctrl" pressed, cube seems to disappear.
To compare, press "G" and choose a vertex for snap, the cube's center is moved as a cube (also individual origins could make all selected verts move to that position making a point instead of a cube?) to that vertex.
Scale with "median" as pivot, it works
bug scale individual origins.blend

So maybe to make it consistent, make "individual origins behave like median.

thanks for the fix, it works well with "median" as pivot point but with "individual origins" it breaks. In attached file: Scale and choose a vertex with "ctrl" pressed, cube seems to disappear. To compare, press "G" and choose a vertex for snap, the cube's center is moved as a cube (also individual origins could make all selected verts move to that position making a point instead of a cube?) to that vertex. Scale with "median" as pivot, it works [bug scale individual origins.blend](https://archive.blender.org/developer/F228656/bug_scale_individual_origins.blend) So maybe to make it consistent, make "individual origins behave like median.

@bliblubli

While we try to keep track of all reports (even updates to closed ones), they do get overlooked sometimes since theres a lot of activity.

Please open new reports if you find further problems, you can always reference other reports if you think they're related.

@bliblubli While we try to keep track of all reports (even updates to closed ones), they do get overlooked sometimes since theres a lot of activity. Please open new reports if you find further problems, you can always reference other reports if you think they're related.

Ok, as it's stil not resolved by last commit, I made https://developer.blender.org/T46505.

Ok, as it's stil not resolved by last commit, I made https://developer.blender.org/T46505.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#39161
No description provided.