Commit Graph

87 Commits

Author SHA1 Message Date
Campbell Barton
26a251202b Fix mesh-validate for polys using successive verts 2015-03-03 15:32:35 +11:00
Campbell Barton
d282728f1d mesh_validate: don't add invalid edges into the hash 2015-02-26 17:49:21 +11:00
Campbell Barton
1f527c6033 Fix BKE_mesh_validate_arrays, ignored do_fixes 2015-02-24 13:10:15 +11:00
Bastien Montagne
7bae9ee6b6 Mesh validate: add an option to not clean temp/cache CDLayers.
This is mandatory for incoming custom normal imports from io scripts, because
often geometry here is corrupted, so we need to call mesh.validate() to clean it up.

Issue is, we cannot set custom normals before geometry is clean, so we need to store
temporary plain loop normals in a CD_NORMAL layer, validate, and then set custom normals.
So we need a way to prevent 'temp' lnors to be freed by validate.
2015-02-05 14:03:01 +01:00
Campbell Barton
46e2d5ee41 Cleanup: typo 2014-11-21 14:16:35 +01:00
Campbell Barton
5e6b79c1f5 Fix crash in BKE_mesh_validate_arrays 2014-08-19 21:11:57 +10:00
Campbell Barton
37da1dadb6 Fix mesh validate skipping first vertex 2014-08-19 18:49:54 +10:00
Bastien Montagne
51120efbce Fix bug in validate mesh code (could use index out of range). 2014-07-25 18:44:32 +02:00
Bastien Montagne
1097a3f70d Add helper to validate (and fix) material indices of meshes' polygons, curves' splines and texts' letters.
Useful especially for importer addons.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D650
2014-07-17 17:16:07 +02:00
Campbell Barton
a2c107aef1 Code cleanup: use 'const' for arrays (blenkernel) 2014-04-27 00:25:15 +10:00
Campbell Barton
a15b3c4d11 Code cleanup: use bool 2014-04-11 11:33:29 +10:00
Campbell Barton
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
Campbell Barton
63ccb26303 Code Cleanup: spelling 2014-01-17 17:35:03 +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
Bastien Montagne
59e4600526 Fix [#37380] vertex paint colors don't render.
Another Evil Typo (r) one, you could add much more than the 8 allowed VCol layers!

Note: added some (warning-only) checks in mesh validate functions, but we still have a big issue with new cdlayer merge function, which could generate more than 8 layers of UVs or VCol... Don't know yet how to handle this situation. :(
2013-11-11 20:37:19 +00:00
Campbell Barton
3c05662f5e fix error where BKE_mesh_cd_validate layer renaming would use invalid index values. from r60260
also correct some comments.
2013-09-25 11:11:41 +00:00
Bastien Montagne
2cca73eeb1 Fix [#36759] UV Project - Specified UV Map doesnt work properly
In fact, the issue was that names of mloopuv/mtespoly layers could very easily get out of sync (a simple rename was enough), while most tools (such as the UVProject modifier) expect matching layers to have the same name!

Now matching names are check on load, and renaming of a layer through RNA is guaranted to be synchronized with its counterparts.

Thanks to Brecht & Campbell for reviews.
2013-09-20 11:14:08 +00:00
Campbell Barton
6317f1eafd fix [#36291] Applying subsurf to mesh or setting subdivisions to zero crashes Blender
issue was mesh somehow had a mismatch of UV/texpoly layers. we may want to allow this in the future but for now sync on load just in case.
2013-09-16 06:00:25 +00:00
Campbell Barton
2646bbdccb move mesh evaluation functions (normal, mapping, smooth group... etc, calculations) into mesh_evaluate.c.
mesh.c was over 4k lines and complex functions mixed in with general library management.
2013-09-09 02:11:44 +00:00
Campbell Barton
38075c7b3c fix for building on msvc 2013-09-04 06:50:15 +00:00
Campbell Barton
f3af9de618 debug option for modifier stack calculation USE_MODIFIER_VALIDATE,
checks that every modifier gives a valid mesh (very slow) - so off by default even in debug mode.
2013-09-04 01:29:34 +00:00
Campbell Barton
25ffb79a0b use reserve argument for more edgehashs 2013-08-24 14:40:15 +00:00
Campbell Barton
0b88b4fad7 when the size of an edgehash is known or can be guessed,
pass in the argument to reserve the size.
2013-08-24 13:47:57 +00:00
Campbell Barton
f2acb10b6b edge hash: take an arg for the guarded-malloc string (as ghash does) 2013-08-24 13:08:55 +00:00
Campbell Barton
d68917cb86 code cleanup: typos 2013-07-27 07:02:27 +00:00
Campbell Barton
225c5fee6b move BLO_sys_types.h -> BLI_sys_types.h (it had nothing todo with loading)
remove MEM_sys_types.h which was a duplicate.
2013-05-28 19:35:26 +00:00
Brecht Van Lommel
8f9150871c Fix part of #34233: bad alpha blending for 2D image painting. This is a very
old issue, the formulas here were never quite right, should all work ok now
with byte and float images.

Some differences:

* Colors with zero alpha from the background will never have an influence, so
  you don't get alpha fringes when painting over such areas. This does give
  hard edges when looking at the RGB channels alone, but there's no way to
  avoid that and fringes at the same time, same behavior as other painting apps.

* Add/Subtract/Multiply/Lighten/Darken now leave the alpha channel unchanged
  and work only the RGB channels, again same behavior as many other apps.

* Erase/Add alpha now compensates for premultiplied float images to keep the
  straight RGB colors the same.

Next: fix projection painting.
2013-04-27 12:51:23 +00:00
Campbell Barton
319036f2d5 fix [#35026] Curve build modifier 2013-04-22 12:00:37 +00:00
Thomas Dinges
858ff6b696 Fix for [#34898] Typo in error message of mathutils.Vector
* Also fixed some more cases of "more then" -> "more than".
2013-04-07 15:09:06 +00:00
Campbell Barton
3dababa7ec code cleanup: name mesh functions more consistently, also use bools for mesh args. 2013-03-17 19:55:10 +00:00
Campbell Barton
a0351fd97e object converting curve/mball to a mesh would give invalid selection state (edges selected but nothing else).
add arg to BKE_mesh_calc_edges() so selecting newly created edges is optional.
2013-03-16 01:19:03 +00:00
Campbell Barton
0ac07404ba style cleanup: braces with multi-line statements, also add some comments. 2013-03-01 14:47:06 +00:00
Campbell Barton
d705c52e65 no longer use 'check_existing' to see if we need to have a save popup, instead use 'exec' operator on a saved file and
invoke on unsaved files.

correct missing memset --> CustomData_reset switch too.
2012-10-31 17:03:31 +00:00
Campbell Barton
67e2768570 quiet some -Wshadow warnings 2012-10-12 14:35:10 +00:00
Bastien Montagne
b0598a203c Cosmetic updates to mesh validate messages. 2012-07-05 13:02:42 +00:00
Sergey Sharybin
e2e79b9e10 Validate mesh selection stack in mesh_validate function
Related on #31944: Blender crashes on switching to mesh edit mode
2012-07-02 09:57:31 +00:00
Sergey Sharybin
33e8feb880 Fix #31835: OBJ Importer corrupts a model (crash in edit mode)
Added back face validation to BKE_mesh_validate_arrays.

This is needed because some addons (like OBJ importer) are reading
tessfaces and then converting them to ngons and validation of tessfaces
is needed before such a conversion.

Validation of faces would happen only if there's no polys in mesh.
2012-06-28 09:08:11 +00:00
Campbell Barton
2ab62ce126 code cleanup: defines with braces - end with '(void)0' so callers must end with ';' like normal function.
... without this some editors dont parse the source so well.
2012-05-27 12:21:13 +00:00
Campbell Barton
2d2d36fe3b code cleanup:
- style - multi-line ifs move braces onto new lines.
- iterators - convert some to macros, other split up and move brace.
2012-05-20 19:49:27 +00:00
Campbell Barton
c91cee2bb9 code cleanup: naming - BKE_mesh_* 2012-05-05 21:28:12 +00:00
Campbell Barton
6cc48ec555 mesh.validate() / BKE_mesh_validate() --- functions now check for duplicate vertices used within the same polygon.
(which would crash otherwise)
2012-04-25 07:23:20 +00:00
Campbell Barton
8765dfccf7 style cleanup: correct typos 2012-04-21 14:14:58 +00:00
Campbell Barton
40f4a4b6ba style cleanup: mesh validate.
also add code cleanup script which runs uncrustify and then undoes trailing whitespace edits (reducing diff noise)
2012-04-18 09:16:30 +00:00
Campbell Barton
b8a71efeba style cleanup: follow style guide for/with/if spacing 2012-03-24 07:52:14 +00:00
Campbell Barton
69e6894b15 style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:18:31 +00:00
Bastien Montagne
c9d0de49b9 mesh_validate code for bmesh (i.e. polys/loops).
Everything seems to work well (many tests making random changes over various meshes went good), but the code is a bit complex and hard to follow, due to the various possibilities of invalid poly/loop combinations… Code also makes more operations than previous tri/quad faces version (hence is a bit slower), but I don’t think we can do otherwise, it’s just the price for bmesh flexibility. ;)

Note: added the py script I used to make the tests, under source/tests/...
2012-03-15 20:10:07 +00:00
Campbell Barton
95670e03a0 style cleanup / comment formatting for bli/bke/bmesh 2012-03-03 20:19:11 +00:00
Campbell Barton
47c373c7a9 style cleanup (mostly whitespace) 2012-02-27 10:35:39 +00:00
Campbell Barton
53fece44cf style cleanup for blenkernel, no functional changes. 2012-02-23 02:17:50 +00:00
Campbell Barton
2da527b017 un-inline edgehash functions, BLI_edgehash_insert was far too big to inline.
and have edge hash use unsigned ints since edge verts are unsigned ints for MEdge's
2011-12-28 10:06:10 +00:00