Commit Graph

2539 Commits

Author SHA1 Message Date
Campbell Barton
f0fda91a55 Merge branch 'master' into blender2.8 2018-05-21 17:27:38 +02:00
Campbell Barton
605e184167 Cleanup: use const for transform internal API 2018-05-21 17:24:14 +02:00
Germano
f14e4510ac Transform Snap: Fix normal in the wrong space. 2018-05-21 11:05:34 -03:00
Ines Almeida
4308602d6a Fix: crash when rotating the view in pose mode 2018-05-20 17:44:50 +02:00
Joshua Leung
0492e56fec Fix: When trying to transform animated bones, they would jump to and use random old values
The transform code needed to use data from the "_eval" copy of the posebone
instead of the main-db version, otherwise the initial/reset value would be
wrong, causing the jumping.
2018-05-19 19:54:47 +02:00
Joshua Leung
6ba28ff8b1 WIP COW Fix: Insert keyframe operators/api now queries depsgraph for evaluated data
When using copy on write, insert keyframe operators were reading from old
bmain data instead of COW data. This meant that inserting keyframes would
often read old/stale data, resulting in invalid keyframes getting created
(e.g. from last transform operation, instead of actual current state).

This commit makes it so that keyframing operators will ask depsgraph for
the evaluated copy of the data, so that it can read values from that. It
introduces a new function - `DEG_get_evaluated_rna_pointer()`, which when
working correctly/fully, should work just like the other `DEG_get_evaluated_*()`
functions, except it lets you pass in an RNA Pointer.

However, currently, this is only done for Pose Bones (as a dirty hack, since this
is an important/pivotal requirement for production) and/or datablock
properties directly (since we can just use the DEG_get_evaluated_id() directly).
on the datablock.

Committing to a branch for now as this all needs more testing. More work to come
later at a more sane time of day!
2018-05-19 19:54:47 +02:00
Germano
e785048ef3 Fix snap with occlusion. 2018-05-18 17:26:22 -03:00
Germano
4df99bd601 Ruler: Fix mixed snap. 2018-05-18 17:12:20 -03:00
Germano
2d6bfb5b63 Transform: Improve the hierarchy in the choice of snapped elements in the mixed snap.
To snap to small edges in 3d_view is no longer obfuscated by vertices if then is also enabled.
2018-05-18 11:40:32 -03:00
Germano
db2c966e2c Cleanup: remove unused function. 2018-05-18 10:55:51 -03:00
Campbell Barton
987d1df571 Tool System: store the active tool in ScrArea
Without this we need to have the context to get the
(space_type, mode) args for an active tool lookup.

For event handling & poll its more convenient to have direct access.
2018-05-18 09:40:52 +02:00
Campbell Barton
edf6676a77 Tool System: per space/mode tool support
This patch adds support for:

- Per space-type tools (3D view and edit).
- Per mode tools (object, edit, weight-paint .. etc).

The top-bar shows the last activated tools options, this is a design
issue with using a global topbar to show per-space settings.

See D3395
2018-05-17 15:57:33 +02:00
Germano
41cba97f47 Cleanup: Use ED_view3d_win_to_ray_ex to get the ray and remove unused parameter. 2018-05-16 23:04:28 -03:00
Germano
efe3042368 Transform: Use isect_ray_seg_v3 instead dist_squared_ray_to_seg_v3 in the function that tests the snap on edges. 2018-05-16 22:04:41 -03:00
Germano
d038f4651e Transform: Fix bugs for the latest changes to the snap system. 2018-05-16 21:32:52 -03:00
Sybren A. Stüvel
def1c3eb4b Particle System: ported most DerivedMesh → Mesh
There are a few places where DerivedMesh is still used, most notably
when calling the (not yet ported) cloth simulation. There is also still
the use of Object.derivedDeform and Object.derivedFinal. Those places are
marked with a TODO.

Some functions in the editors module were copied to accept Mesh. Those
already had 'mesh' in the name; the copies are suffixed with '__real_mesh'
for easy renaming later when the DM-based functionality is removed.
2018-05-16 16:31:38 +02:00
Germano
1b2ba24749 fix build error in last commit. 2018-05-16 11:02:54 -03:00
Germano
2ba0951e52 Snap system: Adds support to Clip Planes and uses a clip plane to simulate occlusion
This patch adds support for clip_planes (ie ignore what is behind a face)...

The idea is to first execute a raycast to get the polygon to which the mouse cursor points.
Then a snap test is done on the vertices or edges of the polygon.
Then with the normal and location obtained in raycast a new clip_plane is created and the snap over the whole scene is processed ignoring the elements behind the clip_plane.

Here 2 gif of how the previous patch would work on blender2.79:

{F497176}

{F497177}

Reviewers: mont29, campbellbarton

Reviewed By: campbellbarton

Subscribers: bliblubli

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2527
2018-05-16 10:32:54 -03:00
Germano
0a8d6bd893 Transform: Snap: Make sure if bmesh arrays need to be recalculated. 2018-05-15 16:15:14 -03:00
Germano
9619a90da1 Scene raycast: The return index should indicate the polygon instead of the looptri.
This was the default behavior and could break some addon since looptri is almost useless for the current python API.
2018-05-15 15:38:17 -03:00
Germano
7a69c59b35 Revert "BLI_kdopbvh: Reference clip_planes callback to find nearest projected."
This reverts commit 717dd4cecd.

It was causing problems in the protactor ruler.
I'll think of a better solution.
2018-05-15 14:37:45 -03:00
Germano
50c29e2391 Cleanup: pass the use_depth parameter to the SnapObjectParams struct in the ED_transform_snap_object_project_view3d_mixed. 2018-05-15 14:32:30 -03:00
Germano
717dd4cecd BLI_kdopbvh: Reference clip_planes callback to find nearest projected.
Clip_planes are an important parameter to be used in callbacks.
2018-05-15 14:14:25 -03:00
Germano
3d1f5cb9a2 Cleanup: Pass Snap Object Params * params to iter_snap_objects.
And remove unnecessary `defaulf:` labels.
2018-05-15 12:44:37 -03:00
Bastien Montagne
a95d417db0 Fix broken PoseMode editing when CoW is enabled.
We need to get data from evaluated object/posechannel too, then...
2018-05-15 16:30:02 +02:00
Campbell Barton
b3d4f99d48 Fix bone-size crash
Own regression from multi-object transform.
2018-05-15 11:36:39 +02:00
Campbell Barton
55b241d32a Fix texture space transform crash
Own regression from multi-object transform.
2018-05-15 09:25:16 +02:00
Germano
04fa65e356 Cleanup: Use switch statement to test the object type in snap functions. 2018-05-14 19:18:26 -03:00
Campbell Barton
e159ec8bc1 Cleanup: compiler warnings, use const 2018-05-14 23:12:51 +02:00
Germano
bf7c46cae0 Transform: Use the new BLI_bvhtree_find_nearest_projected function to snap. 2018-05-14 16:08:17 -03:00
Campbell Barton
9d677212ee Transform: fix regression in bound-box calculation
Error in multi-object merge.
2018-05-13 07:20:35 +02:00
Campbell Barton
59c6487e93 Merge branch 'master' into blender2.8 2018-05-13 06:56:51 +02:00
Campbell Barton
b99d064e91 Cleanup: trailing space 2018-05-13 06:44:03 +02:00
Campbell Barton
7a56d31af3 Fix 3D view axis align flag
Missed from recent pivot-point move to scene.
2018-05-13 06:38:43 +02:00
Germano
6c6a394373 Cleanup: Remove unused member. 2018-05-12 23:39:36 -03:00
Germano
0d9f77d954 transform_snap_object: perf: Check the distance of the bound_box of objects of type armature and curve first.
And remove unused variables.
2018-05-12 19:39:21 -03:00
Germano
375c6a7967 Cleanup: transform_snap_object: Remove unused variables and reuse the precalc used to test the distance to the projected bound_box. 2018-05-12 19:10:23 -03:00
Campbell Barton
1422c0650c UI: move pivot to the topbar
Pivot variables are now stored in scene toolsettings.
2018-05-12 22:04:45 +02:00
Campbell Barton
1813f00b94 Fix missing fallback in recent aabb precalc func
Also comment unused vars
2018-05-12 08:19:20 +02:00
Germano
be8add5d50 Refactor: Move functions to get the distance to a projected aabb to BLI_match and remove confusing parameters. 2018-05-11 20:20:51 -03:00
Campbell Barton
334b1cf92f Cleanup: warnings 2018-05-10 19:07:03 +02:00
Germano
55389d4899 Transform: Make snapDerivedMesh use bvhtrees from loose edges and bvhtrees from loose verts.
Bvhtrees take up a lot of memory space, reusing the common bvhtree of looptris to snap to vertices and edges is a good way to save memory.
Unfortunately we have a worsening performance in the snapping operation around 63% (addition to the original time).
But as we often do not need to build a bvhtree of loose verts and loose edges, we have an improvement in cache time :)

Since the CPU time of snapping operations (no matter how higth poly the object is) corresponds to less than 0.01% of all CPU time of a blender frame, that change is not really significant.

Snapping operations on a mesh in edit mode have not changed significantly.

Signed-off-by: Germano <germano.costa@ig.com.br>
2018-05-10 13:40:30 -03:00
Campbell Barton
27da2db0ca 3D View: utility to get matrix from cursor 2018-05-10 12:24:07 +02:00
Campbell Barton
e65a2cb52c Fix crash moving grease pencil frames 2018-05-09 14:09:05 +02:00
Germano
d1cd872fef ED_transform: Port ED_transform_snap_object to new Mesh-based system.
Differential Revision: https://developer.blender.org/D2896
2018-05-08 20:04:32 -03:00
Campbell Barton
579c01da60 Extrude Widget: with/without axis constraint 2018-05-08 20:30:29 +02:00
Campbell Barton
fa69ce9e3a Cleanup: whitespace, duplicate includes 2018-05-08 16:57:07 +02:00
Campbell Barton
a48186c5d7 Orientation for 3D cursor
Currently set when setting the cursor location,
optionally used as an orientation type.

Intended for use by tools too.

See: D3208
2018-05-08 15:35:04 +02:00
Campbell Barton
eefaec4114 Extrude Widget: Add orientation to topbar
Add extrude operator that's intended to work on the current selection
and be activated as a tool.
2018-05-07 21:40:51 +02:00
Campbell Barton
170223804b Extrude Widget: orient correctly w/ rotated object 2018-05-07 21:40:51 +02:00