Commit Graph

438 Commits

Author SHA1 Message Date
Julian Eisel
572bc1364c BLI_listbase: Add/use utility to move link (BLI_listbase_link_move)
We were calling BLI_remlink and then BLI_insertlinkbefore/after quite often. BLI_listbase_link_move simplifies code a bit and makes it easier to follow. It also returns if link position has changed which can be used to avoid unnecessary updates.

Added it to a number of list reorder operators for now and made use of return value. Behavior shouldn't be changed.

Also some minor cleanup.
2016-09-18 21:44:42 +02:00
Julian Eisel
2aca1d85e6 Improve description of move operator direction properties
These may be exposed in UI (keymap editor & redo panel), so better avoid using identifiers like "UP" "DOWN". They are redundant anyway (already displayed).
2016-09-16 17:03:44 +02:00
Campbell Barton
8343518272 Cleanup: comment blocks 2016-07-15 02:39:45 +10:00
Bastien Montagne
d231260212 Replace of (id->lib != NULL) check by meaningful macro.
Idea is to replace hard-to-track (id->lib != NULL) 'is linked datablock' check everywhere in Blender
by a macro doing the same thing. This will allow to easily spot those checks in future, and more importantly,
to easily change it (see work done in asset-engine branch).

Note: did not touch to readfile.c, since there most of the time 'id->lib' check actually concerns the pointer,
and not a check whether ID is linked or not. Will have a closer look at it later.

Reviewers: campbellbarton, brecht, sergey

Differential Revision: https://developer.blender.org/D2082
2016-07-06 14:11:01 +02:00
Campbell Barton
c1e4aaa289 Fix T48387: Mirror weights keeps groups assigned
Swapping the weights kept zero weight verts assigned.
2016-05-11 02:47:38 +10:00
Campbell Barton
299a25cb35 Fix weight-mirror reporting invalid failed mirror verts
Use vertex tagging instead of clearing mirror index.
2016-05-10 00:57:00 +10:00
Campbell Barton
29acdb4889 Mesh API: add BKE_mesh_vert_edge_vert_map_create
Handy when you need to reference connected verts directly.
2016-03-22 22:07:45 +11:00
Alexander Gavrilov
c6afa36f47 Fix group flipping when syncing mirror weights
Corrects mirror syncing for invert, levels & smooth.

Note that the code changed to process mirroring even if both verts are selected,
since group flipping can mean that is still meaningful.
2016-02-09 00:19:28 +11:00
Campbell Barton
f2a93faa7c Fix T47271: Vertex Group to Selected missing update 2016-01-29 15:12:57 +11:00
Alexander Gavrilov
b147ecb991 Fix Smooth Weight expand logic
Since weight_other is equal to weight_accum_prev[i_other], the original
lines actually are no-op. The visible effect is that when smoothing just
two vertices with weights 1 and 0, the expand value has no effect until
it reaches exactly 1. This change makes it gradual.
2016-01-24 16:25:53 +11:00
Bastien Montagne
aad24468e2 Fix T47038: Particles in Particle Edit Mode get added in completely wrong location.
It also fixes another issue (crash) related to symmetric editing.

Quite involved, we (try to!) fix complete broken logic of parts of particle code, which would use poly index
as tessface one (or vice-versa). Issue most probably goes back to BMesh integration time...

This patch mostly fixes particle editing mode:
  - Adding/removing particles when using generative modifiers (like subsurf) should now work.
  - Adding/removing particles with a non-tessellated mesh (i.e. one having ngons) should also mostly work.
  - X-axis-mirror-editing particles over ngons does not really work, not sure why currently.
  - All this in both 'modes' (with or without using modifier stack for particles).

Tech side:
  - Store a deformed-only DM in particle modifier data.
  - Rename existing DM to make it clear it's a final one.
  - Use deformed-only DM's tessface2poly mapping to 'solve' poly/tessface mismatches.
  - Make (part of) mirror-editing code able to use a DM instead of raw mesh, so that we can mirror based on final DM
    when editing particles using modifier stack (mandatory, since there is no way currently to find orig tessface
    from an final DM tessface index).

Note that this patch is not really nice and clean (current particles are beyond hope on this side anyway),
it's more like some urgency bandage. Whole crap needs complete rewrite anyway,
BMesh's polygons make it really hard to work with current system (and looptri would not help much here).

Also, did not test everything possibly affected by those changes, so it needs some users' testing & validation too.

Reviewers: psy-fi

Subscribers: dfelinto, eyecandy

Maniphest Tasks: T47038

Differential Revision: https://developer.blender.org/D1685
2016-01-04 12:19:45 +01:00
Campbell Barton
48b1656a6c Cleanup: shadowing (editors) 2015-11-23 17:40:50 +11:00
Campbell Barton
1fb512f4a9 Fix T46611: Vertex group locking fails 2015-11-04 03:00:50 +11:00
Campbell Barton
09e40a4956 Cleanup: spelling 2015-09-14 02:22:22 +10:00
Campbell Barton
96fa58e22c Math Lib: Add closest_to_plane helper functions
- closest_to_plane3 (for float3 planes)
- closest_to_plane*_normalized_v3 (for unit length planes)

Use when the plane is known to be unit length
2015-08-31 20:10:36 +10:00
Campbell Barton
72565fbf30 Cleanup: style, spelling 2015-07-06 17:45:11 +10:00
Campbell Barton
c40205738b Weight Paint: replace Blend with Smooth tool
Improved behavior

- can smooth # iterations
- option to expand/contract weights
- optionally mix with all/selected/unselected
2015-06-25 16:17:24 +10:00
Campbell Barton
ba98e6148b API calls for converting weights to float array 2015-06-25 16:17:24 +10:00
Campbell Barton
42314b32f2 Cleanup: generalize weight paint poll function 2015-06-25 08:32:09 +10:00
Campbell Barton
1676fcded0 WeightPaint Blend: don't stack mem for dverts
Bad assumption since this could be a large list
2015-06-24 20:42:02 +10:00
Campbell Barton
ecdbe3cc63 Cleanup: style 2015-06-17 07:06:59 +10:00
Campbell Barton
57d9badc21 Cleanup: use bool /w flag checks 2015-04-21 01:50:20 +10:00
Campbell Barton
b12f3cbee7 cleanup: style 2015-02-07 04:50:21 +11:00
Bastien Montagne
1b3b011354 Transfer data: cleanup: Remove 'vertex_group_transfer_weight' operator.
We can now use 'generic' data transfer instead.

Note new one is not an exact replacement, it should be able to do
everyting old op could do though, and more.
2015-01-11 18:33:12 +01:00
Campbell Barton
bcbbc66795 Cleanup: unused headers 2014-11-28 15:52:30 +01:00
Campbell Barton
46e2d5ee41 Cleanup: typo 2014-11-21 14:16:35 +01:00
Bastien Montagne
19cc516f51 Refactor: Move part of vgroup handling code from ED_mesh/object_vgroup.c to BKE_object_deform.
Along with some minor cleanup and simplifications.

Reviewers: campbellbarton

Subscribers: sergey

Differential Revision: https://developer.blender.org/D903
2014-11-18 23:52:29 +01:00
Bastien Montagne
1e5d508567 Cleanup: Shapekey: get rid of ED_vgroup_object_is_edit_mode()
It was doing exactly the same thing as `BKE_object_is_in_editmode_vgroup()`, tsst...
2014-11-17 20:33:25 +01:00
Daniel Salazar
c721ef5fd6 Slight improvements to vgroup tooltips 2014-11-17 07:58:22 -06:00
Campbell Barton
7d040d2a08 Cleanup: use BLI_listbase_*** prefix for count,sort,sort_r 2014-11-16 13:57:58 +01:00
Bastien Montagne
5bcda29658 Replace tooltips of copy vgroups to ... operators.
Those ops actually replace vgroups in destination, tooltips were really misleading.

Issue raised by zanqdo (Daniel Salazar), thanks.
2014-11-14 19:52:34 +01:00
Campbell Barton
059e0dafb4 Cleanup: const correctness for BLI_sortlist 2014-09-24 14:55:02 +10:00
Campbell Barton
a04a8039f0 Code cleanup 2014-07-18 11:55:59 +10:00
gaiaclary
10da6ddbee Automatic commit by arc 2014-07-16 14:03:37 +02:00
gaiaclary
7eb539c04b Sort vertex groups by Armature Hierarchy
Sort vertex groups by Armature Hierarchy

Reviewers: mont29

Differential Revision: https://developer.blender.org/D649
2014-07-16 14:03:36 +02:00
Campbell Barton
c04f301fc3 Replace BLI_SMALLSTACK_FREE with fake user (quiet warnings in msvc) 2014-07-12 16:48:52 +10:00
Campbell Barton
b82d639f3d Stop all dynamic enums using translations (from blend file data) 2014-05-05 15:23:35 +10:00
Campbell Barton
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
Bastien Montagne
a28dce6cc8 Fix T38955: Misleading tooltip for Clean Tool in Weight Tools Toolshelf. 2014-03-06 14:30:44 +01:00
Campbell Barton
4f1a6eb96f Fix T38970: Invert weights remove weights option not working
Patch D382 from Henrik Aarnio
2014-03-06 03:07:31 +11:00
Lukas Tönne
a938640036 Fix T38717: Copy Vertex Group To Selected fails when all Vertex Groups
are empty.

This is now considered a no-op and counts as a successful copy (since
nothing would have changed anyway).
2014-02-19 14:19:32 +01:00
Campbell Barton
b3afbcab8f ListBase API: add utility api funcs for clearing and checking empty 2014-02-08 06:24:05 +11:00
Campbell Barton
fed1b8b16d Code cleanup: suffix vars to make obvious they are squared 2014-02-03 02:46:45 +11:00
Campbell Barton
70f2389f5a Code cleanup: be less vague checking invalid index values 2014-02-01 02:01:00 +11:00
Campbell Barton
1c29fd77d3 Code Cleanup: style and correct API class ref 2014-01-26 22:17:01 +11:00
Brecht Van Lommel
386d3a9cfb Fix T38265: transferring vertex weights from an object with modifiers not working.
It was using the modified mesh for the vertex coordinates, and the unmodified mesh
for the vertex weights, which can't work and crashed in some cases, now it used the
modified mesh for both.

Perhaps an option should be added to indicate if you want to transfer from the
unmodified mesh or transfer to the modified mesh, but I think this fix makes it
works as intended when this was implemented.
2014-01-21 15:36:00 +01:00
Campbell Barton
6734936c13 RNA API: use bool's for enum itemf callbacks. 2014-01-04 18:10:01 +11:00
Campbell Barton
e23f77b935 Code Cleanup: move mesh mapping functions into their own file/header 2013-12-12 16:28:52 +11:00
Campbell Barton
63caaa2b12 Code Cleanup: rename vars for detecting change to be more consistent
rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
2013-11-26 06:39:14 +11:00
Campbell Barton
c9209de573 vertex weights: add weight quantize tool. 2013-11-17 14:58:23 +11:00