Commit Graph

41 Commits

Author SHA1 Message Date
Martin Poirier
06c43148a1 transform snap bugfix: correctly ignore hidden elements when snapping to edit mode mesh 2008-10-02 17:20:58 +00:00
Martin Poirier
75685a9ca8 == Transform Snap ==
Tighten test for excluding objects as snap target.

Now exclude all object that are themselves moving (that includes childs of selected objects) as well as objects with moving geometry (like hooked meshes).

The previous situation would cause unfrequent bugs, but especially present in alignment cases (those concerned will understand).
2008-09-16 19:10:58 +00:00
Martin Poirier
a06a4663c4 === Transform Snap ===
Bugfix face snapping in edit mesh didn't test for selection properly
2008-07-06 15:38:51 +00:00
Martin Poirier
7a55f52b1b Transform Snapping
Snap to edges and vertice without have to go through faces.

This means you can import floor plans and use the edges as snapping guides and other sort of fun things.

The bounding box test still needs padding though.
2008-06-22 23:21:29 +00:00
Martin Poirier
dac3434b03 [#14398] In Object- and EditMode, global rotate manual input is different than mouse
The sign of the rotation angle was sometimes different between num input and mouse input.
2008-06-22 20:40:13 +00:00
Daniel Genrich
d6c8d2f701 Just make gcc compiler happy (stupid harmless warning) 2008-06-19 13:41:06 +00:00
Martin Poirier
bb539ce1b5 Snapping
Snap to cage only in edit mode (respect the edit cage flag of modifiers).

Especially important for subsurf, otherwise, Andy's automerge + snap video doesn't work in current SVN.
2008-06-16 16:48:09 +00:00
Martin Poirier
ad023e108a [#13691] apricot Snap didn’t work correct in svn
1. Updated selected restriction to not be so stingy. Snapping on edges and vertices work if they are part of a partially moving face

2. Change depth ordering (which didn't work all the time). Hits are sorted according to 2D distance and then depth, so for overlapping hits, it picks the one in front.
2008-06-15 17:54:42 +00:00
Martin Poirier
fd1faa5542 Merge from Apricot Revisions 14897, 14913, 14914, 14915, 14929, 15009, 15046
---------------------------------------------------
Snappy stuff

* Align rotation with snapping target: rotate the object, aligning it with the target (object mode only - temporarily) (New icon in the header when snap is turned on)

* Snap to different mesh elements (face, edge, vertice): snapping target slide on faces and edge or use exact position of vertice. When using Align rotation with edge snapping, the normal is interpolated as you slide along.

Snaps correctly to derived mesh (sculpt, modifiers, ...) and duplis. In object and edit mode.

NOTE: The snapping code is now based on faces, so even if you're snapping to vertices or edges, it will not work on meshes without faces. This might change if needed.
2008-06-09 18:41:16 +00:00
Chris Want
5d0a207ecb Patch from GSR that a) fixes a whole bunch of GPL/BL license
blocks that were previously missed; and b) greatly increase my
ohloh stats!
2008-04-16 22:40:48 +00:00
Martin Poirier
ca982d2a23 Proper fix for camera transform with snap.
Please email me or report a bug when such problem arise, it's simpler if done properly the first time.
2008-04-08 13:40:05 +00:00
Brecht Van Lommel
35f094f209 Fix for bug #8380: snapping in the uv editor didn't work with
non-square images.

Fix for uv limit stitch, was broken since editmode integration.
2008-02-27 19:35:27 +00:00
Brecht Van Lommel
36c41c96e7 Fix for bug #5986: snap circle too big when far away from the origin
(e.g. 1000 blender units).
2008-02-21 14:28:20 +00:00
Martin Poirier
7ad378e0b3 Use proper projection for contrained scale snapping. 2008-02-03 17:08:54 +00:00
Martin Poirier
4069449918 == Transform Snap ==
Snapping for Resize
First draft, there might be some things to iron out.

Minor terminology fixes in CTO (custom transform orientation).
2008-02-03 00:42:00 +00:00
Martin Poirier
3d7271f059 === Transform Snap ===
Snapping Mode: Active

With this mode, the active element (at this time, object or vertice) is used as snapping target. If there is no active element in the selection, it reverts back to median mode.


Edit Mode snapping, other meshes no longer have to be selected to act as snapping point.


Fix a potential bug with snapping point from other meshes.
2008-01-20 22:43:48 +00:00
Martin Poirier
1f3dc315d5 Fix crash in previous commit for objects that don't have a boundbox.
In that case, the object's center is used.
2008-01-13 22:57:36 +00:00
Martin Poirier
e4e66c9aa4 === Transform Snap ===
Snapping for object mode

Changes:
- Transform snap now working in object mode and not just mesh edit mode
- Shift-Tab can be used to toggle snap on/off inside transform too (no more Esc,toggle,restart)
- Object mode snap: Closest uses the bounding box corners of all selected objects, Median uses object center and Center uses transform center (same as edit mode).
- Object mode snap: all visible meshes can be used to get the snapping point (unlike edit mode snap which is limited to selected mesh: this might be adjusted to make edit mode snap use all visible too).

To Do:
- Add "Active" snap target method: use active object (or mesh element) as snap target
- Add snapping capabilities to Scale
- (Maybe) Add "Near pointer" snap target method: use selected element that is closest to mouse pointer as snap target. Active could probably accomplish that already in a less confusing manner, so I might skip this.
2008-01-13 22:20:18 +00:00
Martin Poirier
04dcd34883 Correct aweful bug in transform snapping code. How that even work is beyond magic!
Reported by some (crash) and pin pointed by Briggs, thanks a lot!

This should fix the apparently completely random crashes.
2007-12-13 21:10:00 +00:00
Campbell Barton
c2331e06cb re-arranged buttons from matts suggestions. removed some unused vars and added some constants to replaced magick numbers for draw types. 2007-09-26 06:46:08 +00:00
Campbell Barton
ea32119d0b snap transform for UV editing, missing the draw circle at the moment. 2007-09-25 07:42:55 +00:00
Campbell Barton
4ad6ac1cad store snapping in the scene, (theeth's suggestion) 2007-09-25 04:11:57 +00:00
Campbell Barton
afdd54fa37 moved source and text to american spelling
* colour -> color
* centre -> center
* normalise -> normalize
* modelling -> modeling
2007-04-04 13:18:41 +00:00
Martin Poirier
600c62a32d === Transform Snap ===
Inter-mesh snap optimization and fixes.

For larger meshes, tests are made against the bounding box first to speed things up (suggested by Brecht).

Also, verts are accessed through mesh_get_mapped_verts_nors() it can snapped to deformed vertices (only the deformed originals, not new verts for now).
2007-03-24 20:57:15 +00:00
Martin Poirier
1c2b52ab21 === Misc ===
Removing leftover debugging printfs.
2007-02-28 22:04:37 +00:00
Martin Poirier
f6ebfd6f80 === Transform Snap ===
Snapping to other meshes from edit mode.

This commit adds the capacity to snap to vertice of other selected meshes. (This is for sanity reasons, big scenes would kill the speed)
So, if you want to snap to another mesh, just add it to the selection and you're done.

NOTE: Priority is given to vertice inside the current mesh (if they overlap with outside verts)
2007-02-28 17:16:17 +00:00
Martin Poirier
0bd2d0ff45 === Transform Snap ===
adding GL_DEPTH_TEST disable and enable to make sure snapping circle is drawn on top.
2007-02-25 16:22:19 +00:00
Martin Poirier
531dc2d2b6 === Transform Snap ===
Missing distance calculation in Snap Closest when only one element was selected made it not work correctly for rotations.
2007-01-30 16:07:54 +00:00
Martin Poirier
ff75e7d302 === UV Transform ===
[ #5880 ] Crash on editing UVs

Caused by late check for 3d view in transform snap.
2007-01-30 15:48:09 +00:00
Martin Poirier
eb3d720bd9 === Transform Snapping ===
Snap/Grid icon button in 3D view header (edit mesh). FIXME NOTICE: make nice looking icons (yes, that's for you Matt)
When snap is on, a drop down appears for the target method (closest, median, center)

Hotkey to toggle snap is Shift-Tab (this was previously used for a not totally equivalent to Tab. Ton said OK to scrap it). That hotkey is currently restricted to edit mesh (where snap is currently restricted).

Changed a couple of ugliness on how snap settings are stored.
2007-01-07 19:33:00 +00:00
Martin Poirier
3c13561ab5 === Transform Snap ===
Fixed the bug where it would snap to a selected (moving) vertex.

Fixed a bug with Snap Closest with only one vertex selected.

=== Internals: EditMesh Mods ===

Modify and documented findnearestvert.

Added a new parameter to restrict the search to selected or unselected vert instead of just adding a bias to them (as previously). Currently, the "strict" method bypasses the openGL optimisation, people with more knowledge about that should feel invited to fix it.

=== Internals: EditMesh Tools ===

Adding missing newline at the end.
2006-12-28 22:42:58 +00:00
Martin Poirier
8dcf6c2602 === Transform Snap ===
==== Rotation Snap ====

Bug fixes. "Should learn to test properly" * 100

It works ok now, not just when rotating around the Y axis...
2006-12-23 01:55:13 +00:00
Martin Poirier
1ad1522d10 === Transform Snap ===
==== Rotation Snap ====

Snap is no longer limited to Translation, it works in Rotation too.

There's some bugs left with rotation snap when using constraints, I'll be ironing that next.

==== Bug Fixes ====

* Fix manipulators to always use Grid.
* Fix initialization bug (took two transform call to do a correct snap init when changing between Grid and Snap)
2006-12-23 00:52:34 +00:00
Martin Poirier
39c0f6dd83 === Transform Snap ===
The circle drawn around the snap point is now truely constant regardless of zoom and size of the window. That size if linearly proportional to the vertex size (bigger vertex -> bigger circle).
2006-12-21 20:45:57 +00:00
Martin Poirier
88ef092876 === Transform Snap ===
(Implementing Matt's idea)

Grid and Snap are now exclusively controlled by the Control key (pun intented).

You can switch to Snap by selecting the snap option in the Transform menu (this option is only available in edit mode on a mesh. this option is per 3D view) (NOTE: There is currently no hotkey for that, anyone should feel free to add one).

When Snap is selected, holding down Ctrl during translations (grab) snaps to vertex.

All other situations which have no snapping code yet defaults to Grid.
2006-12-20 19:47:12 +00:00
Martin Poirier
f4a03182fb === Transform Snap ===
Draw a circle around the snapping point for visual aid.

Different snapping target method, switchable in the 3d view header menu in the Transform menu.

* Closest: Snaps the closest vertex to the point
* Median: Snaps the median of the selection to the point
* Center: Snaps the transform center to the point (this is different from median because you can use Cursor/Boundbox as center)

Fix a bug with constraints/snap handling.
2006-12-19 22:25:07 +00:00
Martin Poirier
59b30d178a === Transform Snap ===
Work in Progress: this adds vertex snapping capabilities to translations.

As before, use the menu or the hotkey (` during transform) to turn on snapping.

Currently, snapping is restricted to translation and only snap to verts. Also, it will snap the nearest moving vert to the snapping vert.

This also has a timeout period and refreshes the snapping point only every 0.25 seconds (assuming the timer is precise enough to do that) to mitigate the slowdown due to repeated calls to findnearestvert. Eventually, a faster method will have to be used.

Also, this uncovered a bug in findnearestvert which can manifest itself as jumps and lags in snapping. People are looking into it.

Still, with all those disclaimers, get the suggestions/critics pouring in.
2006-12-18 23:48:32 +00:00
Martin Poirier
f72a56bdfc === Transform ===
Modified version of patch #5281 by Joshua Leung.

It's a two part patch:

	Add a Roll button in the transform properties floating panel with bones selected in edit mode

	Add a Roll transform (Ctrl-R) that can be used to modify the roll of selected bones in edit mode

The transformation modifies the roll of all selected bones incrementally (like a rotation does to the bones' rotation) [that is the part that differs from the patch. The patch would set the same roll value to all bones]


Also, this commit includes some shuffling around of the functions, to keep the previously logical order. :)
2006-12-03 19:54:27 +00:00
Brecht Van Lommel
cca16111bf Fix for bug #5280:
Crash transforming UVs with only image window open, new transform snapping
code didn't check if a 3d view exists.
2006-11-22 02:16:29 +00:00
Nathan Letwory
008d6987d0 move SPACE_* (enum) and SPACEICONMAX to DNA_space_types (being the more logical place than DNA_screen_types). SPACEICONMAX gets its value now through this enum, so it is not anymore easy to forget to update it correctly :) 2006-11-07 11:24:11 +00:00
Martin Poirier
f0dcd2db75 == Transform ==
Embryon functionnality for snapping.

- Only snaps to grid on translations (grab)
- Transform constraints are supported but header display is wrong.
- Can be turned on/off in the Object/Mesh header menu under Transform Properties (tentative spot, will have to integrate better and in other object type menus too)
- Can be turned on/off during transform with ` (Back Quote, also tentative)

This is, of course, very much Work in Progress.

This implements part of the structural ideas for the transform cleanup I've been juggling around with.
2006-10-25 23:57:00 +00:00