Commit Graph

213 Commits

Author SHA1 Message Date
45b02cee47 Code cleanup: no need to use calloc when memory is initialized after
also replace AT with __func__ since AT expands the full pathname
2014-04-04 14:26:01 +11:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
a5606fadbb Code Cleanup: remove object arg to CDDM_from_mesh mesh_create_derived 2013-12-26 08:27:08 +11:00
c1c26c36f6 Style Cleanup: remove preprocessor indentation (updated wiki style guide too) 2013-12-22 14:12:19 +11:00
e23f77b935 Code Cleanup: move mesh mapping functions into their own file/header 2013-12-12 16:28:52 +11:00
5102a02b38 Fix T37541: multires not reading external displacement file after entering edit mode. 2013-11-26 19:55:41 +01:00
3073a5b1c4 Mark some CCG funcrions as inlined
This seems to be giving speedup up to 10% in own tests.

--
svn merge -r60104:60105 ^/branches/soc-2013-depsgraph_mt
2013-10-01 09:17:35 +00:00
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
00b39c4e5b code cleanup: more confusion with 0/NULL/false 2013-08-07 03:55:21 +00:00
04ea8c0ee8 remove the pointer from BLI_bitmap's typedef,
hides that an arg passed is really an array which may be modified by other functions.
2013-07-22 23:20:48 +00:00
ef4db04da8 code cleanup: lots of calls to BKE_mesh_calc_normals_mapping were not using the mapping functionality.
replace ED_mesh_calc_normals with BKE_mesh_calc_normals().
2013-05-28 14:23:07 +00:00
b39a532083 Fix #35513: Multires modifier normal corruption on apply base
Seems it was simply missing mesh normals update in multiresModifier_base_apply.
2013-05-28 08:40:47 +00:00
11186184aa Fix #35404: crash in file save with python code that accesses mesh from panel.
On file save the mesh gets loads from the editmesh but the derived mesh caches
wer not cleared. This usually happens through the depsgraph but it needs to be
done manually here. Most changes are some refactoring to deduplicate derived
mesh freeing code.
2013-05-18 10:24:34 +00:00
6da961775f code cleanup: rename BKE_tessmesh -> BKE_editmesh, rename EditDerivedBMesh.tc -> em. ('tc' is odd name which isn't used elsewhere). 2013-04-13 20:31:52 +00:00
e7c15beaf6 code cleanup: use booleans for mesh and selection code. 2013-03-19 23:17:44 +00:00
162c331417 style cleanup 2013-01-19 06:12:25 +00:00
22c02c9d3a Code cleanup: rename BLI_pbvh to BKE_pbvh 2012-12-30 18:31:31 +00:00
a6bee579e9 move pbvh into BKE, it used many BKE bad level includes.
now blenlib/BLI doesn't depend on any blenkern/BKE functions,
there are still some bad level includes but these are only to access G.background and the blender version define.
2012-12-15 15:59:25 +00:00
2bb174cfa4 style cleanup: indentation 2012-11-09 09:33:28 +00:00
12ed0c64bc make use customdata typeoffset more, add an assert to ensure its to date. 2012-10-31 09:50:24 +00:00
aeba4950c3 style cleanup 2012-10-27 10:42:28 +00:00
f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
67e2768570 quiet some -Wshadow warnings 2012-10-12 14:35:10 +00:00
df298490b8 mask data is no longer automatically added when sculpting (except when there is a multi-res modifier). 2012-10-01 05:19:57 +00:00
a5367802ac fix for crash deleting higher multi-res levels without mask data. 2012-10-01 03:45:31 +00:00
e32c60284a style cleanup 2012-07-29 00:20:28 +00:00
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
3a039d0e10 Put paint mask grid allocation in a critical section
When OpenMP is enabled, memory allocation needs to be protected.

Fixes bug [#32111] Memory management regression from svn_46520
projects.blender.org/tracker/index.php?func=detail&aid=32111&group_id=9&atid=498
2012-07-16 16:55:58 +00:00
ee7ae2cdbb Fix [#32013] Crash loading a 2.49b model
Problems were in the old multires loading system.

Actually, the sigsev itself was the easy part of the job (simply had to convert from tesselated data to polys/loops), but after that I was getting a horrible bunch of wild stray faces...

It finally turned out it was a mismatch in two different subsurf structs used while computing a mdisps layer from the multires DM, leading to getting complete random normals (null ones, NAN ones...), leading to complete dummy tangent space matrix, leading to absurds mdisps values...

Note: I also moved the copy of first layer's vertex and face data from old me->mr to mesh's v/fdata earlier in multire_load_old(), to be able to use general face_to_poly conversion function (later on we would have to do it by hand, the general function would erase our newly computed mdisps layer...).

Took me the whole week (something like 20h) to track this down: multires + subsurf = C nightmare!
2012-07-13 20:50:32 +00:00
ac9344de75 Fixes for modifier data in multi-user meshes.
When removing a skin or multires modifier, it skips deletion of the
associated CustomData layer if the object has any other modifiers of
that type. This check has been extended to all objects that use the
object's data.

Similarly, deleting higher multires levels and multires subdivision
will not update the maximum level of any other multires modifiers on
objects that link to the same mesh.

Note that modifier_apply_obdata() doesn't need any changes as it
does not allow applying to multi-user data.

Object joining has also been modified to synchronize multires levels
objects that share a mesh. This is needed because joining can
subdivide or delete levels in order to match the maximum level of the
join-from object to the join-to object.

Fixes bug [#31880] instance multiresolution modifier error.
http://projects.blender.org/tracker/index.php?func=detail&aid=31880&group_id=9&atid=498

Reviewed by Sergey:
http://codereview.appspot.com/6332047/
2012-06-24 20:18:32 +00:00
8015b7a4a5 Fix applying object transform to multires objects.
Bug [#31785] Applying a transform to an object with multires weird result

Was reading interleaved coord/mask data incorrectly since paint mask
merge. Fixed by using two separate CCGKeys.

Some additional code cleanup: deduplicate multires tangent matrix
calculation.
2012-06-11 08:37:35 +00:00
4260804c00 Fix NULL free warning in multires. 2012-06-04 23:14:57 +00:00
b33f0ef0e3 style cleanup 2012-05-27 19:40:36 +00:00
9dd981a440 style cleanup: block comments 2012-05-16 23:37:23 +00:00
8107130854 Fix bug #31460, crash in multires on leaving edit mode
Fix overly aggressive check for creating GridPaintMasks, wasn't
creating them in the right place after adding new faces in editmode.
2012-05-15 07:37:42 +00:00
ce17c35240 style cleanup: mainly sculpt/whitespace 2012-05-11 08:05:47 +00:00
f4929ad609 Add mask support to CCGSubSurf and multires.
* Add new CCG function ccgSubSurf_setAllocMask(). Similar to to
  ccgSubSurf_setCalcVertexNormals(), it sets whether the CCG elements
  have a mask layer and what that layer's offset is. Unlike normals
  however, it doesn't change any behavior during CCG calculation; it's
  there only to give CCGKey information on the mask.

* Add a new flag to _getSubSurf(), CCG_ALLOC_MASK. If set, space for
  an extra layer is allocated, but the number of CCG layers is not set
  to include it. This is done because GridPaintMasks are absolute,
  rather than being relative to the subdivided output (as MDisp
  displacements are), so we skip subdividing paint masks here.

* Add a new flag to subsurf_make_derived_from_derived(),
  SUBSURF_ALLOC_PAINT_MASK. This controls whether CCG_ALLOC_MASK is
  set for _getSubSurf(). Related, masks are never loaded in during
  ss_sync_from_derivedmesh(). After subdivision is finished, if the
  alloc mask flag is set, the number of CCG layers is increase to 4
  with ccgSubSurf_setNumLayers().

* Add a new flag to multires_make_from_derived(),
  MULTIRES_ALLOC_PAINT_MASK. Not all multires functions need paint
  mask data (e.g. multiresModifier_base_apply.) This flag is always
  set in MOD_multires.c so that subdividing a mesh with a mask updates
  properly even when not in sculpt mode.

* Update multiresModifier_disp_run() to apply, calculate, and add mask
  elements. It's almost the same as the existing operations with xyz
  coordinates, but treats masks as absolute rather than displacements
  relative to subdivided values.

* Update multires_customdata_delete to free CD_GRID_PAINT_MASK in
  addition to CD_MDISPS.

* Update multires_del_higher() to call the new function
  multires_grid_paint_mask_downsample(), which allocates a
  lower-resolution paint mask grid and copies values over from the
  high-resolution grid.
2012-05-10 20:34:08 +00:00
f751d0f6ae Replace hardcoded DMGridData structure with CCGElem/CCGKey.
* Changes to DerivedMesh interface: DMGridData has been removed,
  getGridData() now returns an array of CCGElem pointers. Also added
  getGridKey() to initialize a CCGKey (implemented only by
  CCGDerivedMesh.)

* PBVH: added BLI_pbvh_get_grid_key().

* A lot of code is affected, but mainly is just replacing
  DMGridData.co, DMGridData.no, and sizeof(DMGridData) with the
  CCG_*_elem functions, removing the reliance on grid elements of
  exactly six floats.
2012-05-10 20:33:09 +00:00
3794ad5e14 Code cleanup for multires_dm_create_from_derived().
Changed name to multires_make_derived_from_derived() and parameter
order to be more similar to subsurf_make_derived_from_derived().

Added MultiresFlags enum with flag values to replace the local_mmd and
useRenderParams parameters.
2012-05-10 20:32:09 +00:00
6dbfbabcd6 Code cleanup for parameters of subsurf_make_derived_from_derived.
This is the first commit of the sculpt masking merge. Documentation:
http://wiki.blender.org/index.php/User:Nicholasbishop/PaintMasks

Thanks to Brecht for reviewing!

Replaced four boolean parameters with a single flag and a new enum,
SubsurfFlags.
2012-05-10 20:31:55 +00:00
318b44fe5d Refactor of modifiers' apply function: now use a single bit-flag parameter to pass options, instead of having one parameter per boolean flag (i.e. replaces current useRenderParams and isFinalCalc by a single ModifierApplyFlag flag. ModifierApplyFlag is an enum defined in BKE_modifier.h). This way we won't anymore have to edit all modifier files when e.g. adding a new control flag!
Should have no effect over modifier behavior.
2012-05-09 15:00:26 +00:00
d20c129a9c style cleanup: whitespace/operators 2012-05-09 09:24:15 +00:00
ffed654ff2 style cleanup: blenkernel 2012-05-06 17:22:54 +00:00
c91cee2bb9 code cleanup: naming - BKE_mesh_* 2012-05-05 21:28:12 +00:00
1dccd4c98a code cleanup: naming - pose/armature/image
also use ..._find_name(..., name) rather then ..._find_named(..., name) --- both were used.
2012-05-05 16:03:57 +00:00
a731e13043 code cleanup: function naming, use BKE_*type* prefix. 2012-05-05 14:03:12 +00:00
e701f9b670 style cleanup: whitespace / commas 2012-04-29 15:47:02 +00:00
f1d680d4b5 fix for crash when multires subdividing a mesh with no faces (new bug in bmesh grr!) 2012-04-28 07:00:53 +00:00
b340f930ec style cleanup: changes to brace placement / newlines - for/while/if/switch 2012-04-28 06:31:57 +00:00